Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Login Script - Session Error

edited January 2008 in Vanilla 1.0 Help
Hello, 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. i hope somebode from this board can help me best regards, dominik

Comments

  • Options
    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.
  • Options
    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?
  • Options
    Wouldn't it be easier to let vanilla create the session and just check this with your own script?
  • Options
    but i dont know i have to do this? my script is : <? 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); } connect(); ?>
  • Options
    push :-)
  • Options
    I think if you do something like include(./path/to/appg/init_people.php); if ($Session->UserID > 0) { They're logged in } else { they're not } ..that's the general concept anyway. You might need to play with $Context->Session->UserID but see what happens...
  • Options
    can you modify my script that it works. i am not so professional to do this :-) it would be very nice
  • Options
    Well I was working on the basis that you scrapped your script and just used a small snippet like the one above to interface with vanilla..
  • Options
    no i want the same script only modified for the sessions. is anyone able to do this? :-)
This discussion has been closed.