Jump to content

cannot transmit session variable


ani_anirban

Recommended Posts

<?php require_once('Connections/conn1.php'); ?>

<?php

mysql_select_db($database_conn1, $conn1);

$query_Recordset1 = "SELECT email_id, password FROM customer";

$Recordset1 = mysql_query($query_Recordset1, $conn1) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

?><?php

// *** Validate request to login to this site.

if (!isset($_SESSION)) {

session_start();

}

 

 

$loginFormAction = $_SERVER['PHP_SELF'];

if (isset($_GET['accesscheck'])) {

$_SESSION['PrevUrl'] = $_GET['accesscheck'];

}

$a =$_POST["email"];

$_SESSION["ab"] = $a ;

 

 

 

 

//now all i want to do is to transmit this $ab variable to another page say home.php how do i do it guys???please help...

 

 

 

 

if (isset($_POST['email'])) {

$loginUsername=$_POST['email'];

$password=$_POST['password'];

$MM_fldUserAuthorization = "";

$MM_redirectLoginSuccess = "home.php";

$MM_redirectLoginFailed = "not.php";

$MM_redirecttoReferrer = false;

mysql_select_db($database_conn1, $conn1);

 

$LoginRS__query=sprintf("SELECT email_id, password FROM customer WHERE email_id='%s' AND password='%s'",

get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

 

$LoginRS = mysql_query($LoginRS__query, $conn1) or die(mysql_error());

$loginFoundUser = mysql_num_rows($LoginRS);

if ($loginFoundUser) {

$loginStrGroup = "";

 

//declare two session variables and assign them

$_SESSION['MM_Username'] = $loginUsername;

$_SESSION['MM_UserGroup'] = $loginStrGroup;

 

if (isset($_SESSION['PrevUrl']) && false) {

$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];

}

header("Location: " . $MM_redirectLoginSuccess );

}

else {

header("Location: ". $MM_redirectLoginFailed );

}

}

 

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Untitled Document</title>

<script type="text/JavaScript">

<!--

function MM_findObj(n, d) { //v4.01

var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];

for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);

if(!x && d.getElementById) x=d.getElementById(n); return x;

}

 

function MM_validateForm() { //v4.0

var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;

for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args);

if (val) { nm=val.name; if ((val=val.value)!="") {

if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');

if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.n';

} else if (test!='R') { num = parseFloat(val);

if (isNaN(val)) errors+='- '+nm+' must contain a number.n';

if (test.indexOf('inRange') != -1) { p=test.indexOf(':');

min=test.substring(8,p); max=test.substring(p+1);

if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.n';

} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.n'; }

} if (errors) alert('The following error(s) occurred:n'+errors);

document.MM_returnValue = (errors == '');

}

//-->

</script>

</head>

 

<body>

<form action="<?php echo $loginFormAction; ?>" method="POST" name="form1" id="form1" onsubmit="MM_validateForm('email','','RisEmail','password','','R');return document.MM_returnValue">

<div align="center">

<p>my account </p>

<p align="left">email-id

<input name="email" type="text" id="email" size="64" maxlength="64" />

</p>

<p align="left">password

<input name="password" type="password" id="password" size="20" maxlength="20" />

</p>

<p align="left">

<input type="submit" name="Submit" value="Submit" />

</p>

<p align="left">new user???</p>

<p align="left"><a href="reg2.php">register </a></p>

<p> </p>

<p> </p>

<p>  </p>

</div>

</form>

</body>

</html>

<?php

mysql_free_result($Recordset1);?>

Link to comment
https://forums.phpfreaks.com/topic/44042-cannot-transmit-session-variable/
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.