function create_sid() { // generiert eine sehr sichere absolut einzigartige // Session-ID mit beliebig vielen Zeichen. // Bei der Generierung werden mehrere Zufallszahlen berücksichtigt // by I.Runge 2004 define('SID_LENGTH', 15, false); # Anzahl der Zeichen mt_srand((double) microtime() * 1000000); $sid = crypt(randomx(mt_rand(5, 20)), randomx(mt_rand(3, 15))); $sid = str_replace('/', randomchar(), $sid); $sid = str_replace('.', randomchar(), $sid); $c = ''; for ($i = 0; $i < strlen($sid); $i++) { $s = substr($sid, mt_rand(0, strlen($sid)), 1); if (mt_rand(1, 3) == 2) { $c .= dechex(ord($s)); } else { switch (mt_rand(1, 3)) { case 1: $c .= strtolower($s); break; case 2: $c .= $s; break; case 3: $c .= strtoupper($s); break; } } } $sid = $c; if (strlen($sid) > SID_LENGTH) { $start = mt_rand(0, strlen($sid) - SID_LENGTH); $sid = substr($sid, $start, SID_LENGTH); #$c=''; #for($i=0;$i<SID_LENGTH;$i++) { # $s=substr($sid,mt_rand(0,strlen($sid)-1),1); # if(mt_rand(0,2)==1) $s=strtoupper($s); else $s=strtolower($s); # $c.=$s; #} #$sid=$c; } if (strlen($sid) < SID_LENGTH) { $sid .= randomx(SID_LENGTH - strlen($sid)); } $sid = preg_replace('/[-_:@.!=?$%&\\/]/', '', $sid); return $sid; }
for ($i = 0; $i < $length; $i++) { @($randomchar .= $char[rand(0, strlen($char) - 1)]); } return $randomchar; } if (@$_POST['title']) { $body = filter($_POST['body']); //$query = addslashes($query); //echo "<head><script>window.location = '$_SERVER[HTTP_REFERER]'</script></head>"; //echo $query; $titileInPath = str_replace("/", "-", $_POST['title']); $titileInPath = str_replace(" ", "-", $titileInPath); $path = $_COOKIE['name'] . "/" . $titileInPath . ".html"; @mkdir($_COOKIE['name']); //echo "提交成功了~马上返回!"; $uid = randomchar(); $query = "INSERT INTO post (id,time,title,body,user,path,uid) VALUES ('',now(),'{$_POST['title']}','{$body}','{$_COOKIE['name']}','{$titileInPath}','{$uid}')"; mysql_query($query); makehtml($file = 'post.html', $_POST['title'], $body, $path, $_COOKIE['name'], date('Y-m-d'), $list = '', $uid); ?> <div id='alertbox'> <div style="text-align:center;padding:27px;">Your Post is vivid now , share to your friend ! you can check it first:</div><br/> <div style="text-align:center;padding:2px;font-size:20px;"><a href= <?php $path = str_replace(" ", "-", $path); echo "{$path}"; ?> > <?php echo "{$_POST['title']}"; ?> </a></div> </div>
<?php include "conn.php"; function randomchar($length = 6) { $char = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; for ($i = 0; $i < $length; $i++) { $randomchar .= $char[rand(0, strlen($char) - 1)]; } return $randomchar; } if ($_COOKIE['uid'] == "") { $cookie = md5(randomchar(6)); setcookie("uid", $cookie, time() + 3600000); $uri = $_SERVER['HTTP_HOST']; } else { $cookie = $_COOKIE['uid']; $uri = $_SERVER['HTTP_HOST']; } $url = "https://chart.googleapis.com/chart?cht=qr&chs=200x200&choe=UTF-8&chld=L|4&chl=http://{$uri}/mobile.php?uid={$cookie}"; $bookmarklet = "javascript:(function(){window.open('http://{$uri}/mobileAdd.php?title='+encodeURIComponent(document.title)+'&url='+encodeURIComponent(location.href)+'&source=bookmark&uid={$cookie}','_blank','width=540,height=500');})()"; ?> <html> <head> <title>MobileRead</title> <meta name="emacs" content="content" /> <meta charset="UTF-8" /> <link rel="stylesheet" href="mobile.css" type="text/css" media="screen" /> </head> <body> <div id="wrapper">