Exemplo n.º 1
0
function makecookie($id, $keeplogin = true)
{
    global $COOKIEEXPTIME;
    //生成一个足够复杂的md5
    $md5 = getmd5();
    //防止伪造remote地址注入
    $ip = mysql_real_escape_string(getIPv4());
    $time = time();
    $sql = "INSERT INTO `cookie` (`hash`, `id`, `ip` , `time`) VALUES ('{$md5}', {$id}, '{$ip}', {$time})";
    mysql_query($sql);
    setcookie('u2', $md5, $keeplogin == true ? time() + $COOKIEEXPTIME : 0);
}
Exemplo n.º 2
0
function doid($file)
{
    return str_replace("../", "", $file) . ": <br>&nbsp; &nbsp; ID[" . getid($file) . "] MD5[" . getmd5($file) . "]<br>";
}