xbase Posted May 25, 2006 Share Posted May 25, 2006 I am using cookies to store the login variables, but for some reason they are not logging the user in: [a href=\"http://www.syc0logy.com\" target=\"_blank\"]http://www.syc0logy.com[/a][code]<?phpinclude('lib/conf/config.php'); include('lib/functions.php');// user logoutif($login==2){ setcookie("username", "", time()-60*60, "/", ".syc0logy.com",0); setcookie("password", "", time()-60*60, "/", ".syc0logy.com",0); $userid=0; $username=""; $password=""; $userid=0;} // user loginif ($login==1) { $pass = encryption($username,$password);$sql = "SELECT * FROM users";$result = mysql_query($sql);while($row = mysql_fetch_array($result)) { if($username==$row['username'] && $pass==$row['password'] && $login!=2){ $userid = $row['userid']; $usegroup = $row['usegroup']; } else{ $username = ""; $pass = ""; } $un = $row['username']; $pw = $row['password']; } //set cookies if($login==1 && $userid>0){ setcookie("username", "$username", time()+60*60, "/", ".syc0logy.com" ); setcookie("password", "$password", time()+60*60, "/", ".syc0logy.com" ); } }?> <html><head> <title>Syc0tests - Powered By: XBASE Online</title> <link rel="stylesheet" type="text/css" href="lib/css/style.css"></head><body><table border="0" width="100%" id="table1"> <tr> <td align=center> <table border=0 cellspacing=0 cellpadding=0 align=center width=760> <tr> <td> <p class=contest_small align=right>v1.2.5 <center> <img border="0" src="/images/top.jpg" width="760" height="285"></td></tr></table></td> </tr></table><br><table border=0 cellspacing=4 cellpadding=5 align=center width=760><tr><td colspan=2 width=760><? if($userid > 0){ ?><!-- begin user status --><div class=welcome><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class=contest_small align=right>Welcome <?=$username?> [ <a href=index.php?op=login=2>logout</a> ]</td> </tr></table><? } else { ?><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class=contest_small align=right><form action="index.php" method="post"> <input type="hidden" name="login" value="1">login: <input type=text name="username" size=10 value="" class=contest style="background-color:#2A2922; border:1px solid #C0C0C0"> password: <input type=password name="password" size=10 class=contest style="background-color:#2A2922; border:1px solid #C0C0C0"> <input type=submit value="login" class=submit><?// Error if bad loginif($login == 1 && $userid == 0) { echo "<br>Incorrect login information! Forgot Password? <a href=\"?op=forgotpasswd\">Click Here</a><br>";} else { echo "<br>Don't have an account? Then <a href=\"?op=register\">Register Now!</a>"; }?></form></td></tr></table><? } ?></td></tr><tr><td valign=top class=contest width=260><div id="mainmenu"><b>MAIN MENU</b><br><br>- <a href="?op=home">home</a><br>- <a href="?op=blogs">blogs</a><br>- <a href="?op=credits">credits</a><br>- <a href="?op=sponsers">sponsors</a><br>- <a href="?op=contact_us">contact us</a><br><p> </p><?php if ($userid>0) { echo "<b>USER MENU</b><br><br>"; echo "- <a href=?op=register>profile</a><br>"; echo "- <a href=?op=blogs>blogs</a><br>"; echo "- <a href=?op=pm>private messages</a><br>"; echo "- <a href=?op=home&login=2>logout</a><br>"; } else { }?><p> </p></div></td><td class=contest valign=top align=left width=500> <div id="leftcol"> <?php if(isset($op)) { if($op == 'home') { $op = "home"; } include($op.".php"); } else { include("home.php"); } ?> </div></td></tr></table> </div> </body></html>[/code] Link to comment https://forums.phpfreaks.com/topic/10459-cookie-issuesi-am-using-cookies-to-store-the-login-variables-but-for-some-reason-they-are-not-logging-the-user-in-urlhttpwwwsyc0logycomurl/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.