Jump to content

Session Problems


jfs0479

Recommended Posts

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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.