jfs0479 Posted July 26, 2007 Share Posted July 26, 2007 Hi All, I have developed this problem as to where i am unable to call the session up in a page. The script below is the check_login.php which creates the session and all its variables. The way i am calling it is by $memberid = $_SESSION['memberid']; Thanks James <? session_start(); header("Location: home.php"); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Arabian Login Check</title> </head> <body> <?php include 'db.php'; $id = $_POST["username"]; $password = $_POST["password"]; $getmember = "SELECT memberid FROM arab_members WHERE id='$id' AND password='$password'"; $memberid = mysql_query($getmember); if((!$id) || (!$password)){ echo "Please enter ALL of the information for your login! <br />"; include 'index.php'; exit(); } $sql = mysql_query("SELECT * FROM $tablemembers WHERE id='$id' AND password='$password' AND level='1'"); $login_check = mysql_num_rows($sql); if($login_check > 0){ while($row = mysql_fetch_array($sql)){ foreach( $row AS $key => $val ){ $$key = stripslashes( $val ); } //Register session variables. session_register('memberid'); $_SESSION['memberid'] = $memberid2; session_register('forename'); $_SESSION['forename'] = $forename; session_register('surname'); $_SESSION['surname'] = $surname; session_register('email'); $_SESSION['email'] = $email; session_register('sex'); $_SESSION['sex'] = $sex; session_register('hub'); $_SESSION['hub'] = $hub; session_register('password'); $_SESSION['password'] = $password; session_register('reason'); $_SESSION['reason'] = $reason; mysql_query("UPDATE $tablemembers SET lastactive=now() WHERE memberid='$memberid'"); } } ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
vbnullchar Posted July 26, 2007 Share Posted July 26, 2007 be sure you add session_start(); on every page that will use the session vars Quote Link to comment Share on other sites More sharing options...
jfs0479 Posted July 26, 2007 Author Share Posted July 26, 2007 I have just tried something new. What i have done in a seperate page was to call $_SESSION['forename']; which is another of my variables in the session it churned it out good so i tried it with the $_SESSION['memberid']; and it just has a blank page Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted July 26, 2007 Share Posted July 26, 2007 be sure you add session_start(); on every page that will use the session vars When you say session vars are you talking about any session variable? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.