08 9 / 2011
While we’re at it: Logout, done.
I made the login script a while ago, and thought why not make a logout script as well. That’s done! It’s also pretty long! If your session doesn’t exist - it logs you out anyways (well it would have earlier), and creates a blacklist localstore on your computer, which will get the website to record your actions on your next visit.
Here’s the code, with variable names, column names, and cookie names, and session names blanked out! [security measures ;)]
<?
session_start():
session_destroy();
$xx = $_SERVER[‘xxxxx_xxxxxx’];
require_once(“xxxxxx.php”);
$data1 = mysql_query(“SELECT * FROM xxxxxxWHERE xxxxxx=’$xxxxxxx’ AND xxxxxxx=’$xxxxxx’”);
$xxxxxx= mysql_num_rows($xxxxxx);
$xxxxxx = $_COOKIE[‘xxxxxx’];
$xxxxxx = $_COOKIE[‘xxxxxx’];
setcookie(“xxxxxx”,$xxxxxx,time()-3600,”/”);
setcookie(“xxxxxx”,$xxxxxxx,time()-3600, “/”);
if($xxxxxx==1)
{
mysql_query(“DELETE FROM xxxxxx WHERE xxxxxx=’$xxxxxx’ AND xxxxxx=’$xxxxxxx’”);
}
else
{
setcookie(“xxxxx”,”xxxxxx”.$xx,time()+xxxx*xxx,”/”);
echo ‘
<head>
<meta http-equiv=”Refresh” content=”0;url=../index?louterr=x” />
</head>’;
}
if($_COOKIE[‘xxxxxx’]==”” && $_COOKIE[‘xxxxxx’] ==”” && $_SESSION[‘xxxxxx’]==”” && $_SESSION[‘xxxxxx’]==”“)
{
echo ‘
<head>
<meta http-equiv=”Refresh” content=”0;url=../index?logout=x” />
</head>’;
}
?>
Permalink 33 notes
08 9 / 2011
[Done]: Uber Complex Login Script
Well, that’s one script re-written! The login script for glorbi, is so complex, that I can hardly comprehend it without writing it all down in a web of scribbles. Well, I think it’s safe to say, that unless you can hack multiple encrypted cookies and sessions, whilst altering the encrypted data values from the database checks, all that occur in about 0.3 seconds, glorbi is safe from hackers. Just the login script is about 50 lines of PHP!
Right now, we’re going to move on to the sessions.php file, which will verify a session, check the cookies and sessions, and run a session id script, which will generate a unique code for every person that logs in, and verify that once more, on every page a user visits, with a session, a cookie, and a database check.
Permalink 23 notes