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
https://forums.phpfreaks.com/topic/61837-session-problems/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.