clown[NOR] Posted March 31, 2008 Share Posted March 31, 2008 basicly what i wanna do is to try keeping the $_SESSION's linked to the login alive... will this work or not? <?php function chkLogin() { // Check if user is logged in or not. if (!$_SESSION['id'] || !$_SESSION['userID'] || !$_SESSION['pass'] || !$_SESSION['sid']) { return FALSE; } else { con2db(); $id=mysql_real_escape_string($_SESSION['id']); $user=mysql_real_escape_string($_SESSION['userID']); $pass=mysql_real_escape_string($_SESSION['pass']); $dbq="SELECT * FROM `users` WHERE `userID`='$user' AND `pass`='$pass' AND `active`='1' LIMIT 1 "; $result=mysql_query($dbq); if (!$result) { return FALSE; } else { $num=mysql_num_rows($result); if ($num!=1) { return FALSE; } elseif ($num==1) { $_SESSION['id']=$_SESSION['id']; $_SESSION['userID']=$_SESSION['userID']; $_SESSION['pass']=$_SESSION['pass']; $_SESSION['sid']=$_SESSION['sid']; return TRUE; } } } } ?> Link to comment https://forums.phpfreaks.com/topic/98789-will-this-actually-work/ Share on other sites More sharing options...
MadTechie Posted March 31, 2008 Share Posted March 31, 2008 it would... but why do all the SQL stuff ? why not just! $_SESSION['id']=$_SESSION['id']; $_SESSION['userID']=$_SESSION['userID']; $_SESSION['pass']=$_SESSION['pass']; $_SESSION['sid']=$_SESSION['sid']; Link to comment https://forums.phpfreaks.com/topic/98789-will-this-actually-work/#findComment-505498 Share on other sites More sharing options...
clown[NOR] Posted March 31, 2008 Author Share Posted March 31, 2008 i run that on the front page to see if the user is signed in... i was actually only refering to the part u copied my bad Link to comment https://forums.phpfreaks.com/topic/98789-will-this-actually-work/#findComment-505516 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.