i have a big problem. I have a login script in php with sessions. Now the PHP script connects to the LUM_user and i can login with my username and my password but the session isn“t stored.
how can i make this.
i have searched in the board and google but didnt find anything.
i read something about saving the session in the VerivicationKey but this dont work too.
What is it you're trying to do exactly? Use the vanilla database to login to your main site?
I would suggest using the normal vanilla login form as your login form as that will keep it compatible with future vanilla updates.
Then you could add a tiny extension to redirect the login to your main site's page. You can study the session variables with a quick var_dump($_SESSION) on a php page and then use them in the rest of your site.
no i want use my own login script on mainsite to make the same session then vanilla. I use the Vanilla MySQL Table "LUM_User" to login. but how can i make it with the session?
<? function connect() { $con= mysql_connect('removed','removed','removed') or die(mysql_error()); mysql_select_db('removed',$con) or die(mysql_error()); }
function check_user($name, $pass) { $sql="SELECT UserID FROM LUM_User WHERE Name='".$name."' AND Password=MD5('".$pass."') LIMIT 1"; $result= mysql_query($sql) or die(mysql_error()); if ( mysql_num_rows($result)==1) { $user=mysql_fetch_assoc($result); return $user['UserID']; } else return false; }
function login($userid) { $sql="UPDATE LUM_User SET VerificationKey='".session_id()."' WHERE UserID=".$userid; mysql_query($sql); }
function logged_in() { $sql="SELECT UserID FROM LUM_User WHERE VerificationKey='".session_id()."' LIMIT 1"; $result= mysql_query($sql); return ( mysql_num_rows($result)==1); }
function logout() { $sql="UPDATE LUM_User SET VerificationKey=NULL WHERE VerificationKey='".session_id()."'"; mysql_query($sql); }