Hi,
I am running the following code to set a cookie but it is not working,
please
help me sorting out the problem. The code is from an online article
I am using Windows 2000 SP5, PHP 4.2.3, MYSQL 4.0.13-nt, apache 2.0.45
<?php
$psEmail = $_POST["psEmail"];
$psPassword = $_POST["psPassword "];
$psRefer = $_Post["psRefer"];
// Check if the information has been filled in
if($psEmail == '' || $psPassword == '')
{
// No login information
header('Locatio n: LoginTest.php?r efer='.urlencod e($psRefer));
}
else
{
// Authenticate user
$hDB = mysql_connect(' localhost', 'root', 'sarah');
mysql_select_db ('TestData', $hDB);
$sQuery = "Select iUser, MD5(UNIX_TIMEST AMP() + iUser +
RAND(UNIX_TIMES TAMP())) sGUID From tblUser Where sEmail = '$psEmail'
And sPassword = password('$psPa ssword')";
$hResult = mysql_query($sQ uery, $hDB);
if(mysql_affect ed_rows($hDB))
{
$aResult = mysql_fetch_row ($hResult);
// Update the user record
$sQuery = "
Update tblUser
Set sGUID = '$aResult[1]'
Where iUser = $aResult[0]";
mysql_query($sQ uery, $hDB);
// Set the cookie and redirect
setcookie("sess ion_id", $aResult[1], time() + 3600)
}
else
{
// Not authenticated
header('Locatio n: LoginTest.php?r efer='.urlencod e($psRefer));
}
}
?>
I am running the following code to set a cookie but it is not working,
please
help me sorting out the problem. The code is from an online article
I am using Windows 2000 SP5, PHP 4.2.3, MYSQL 4.0.13-nt, apache 2.0.45
<?php
$psEmail = $_POST["psEmail"];
$psPassword = $_POST["psPassword "];
$psRefer = $_Post["psRefer"];
// Check if the information has been filled in
if($psEmail == '' || $psPassword == '')
{
// No login information
header('Locatio n: LoginTest.php?r efer='.urlencod e($psRefer));
}
else
{
// Authenticate user
$hDB = mysql_connect(' localhost', 'root', 'sarah');
mysql_select_db ('TestData', $hDB);
$sQuery = "Select iUser, MD5(UNIX_TIMEST AMP() + iUser +
RAND(UNIX_TIMES TAMP())) sGUID From tblUser Where sEmail = '$psEmail'
And sPassword = password('$psPa ssword')";
$hResult = mysql_query($sQ uery, $hDB);
if(mysql_affect ed_rows($hDB))
{
$aResult = mysql_fetch_row ($hResult);
// Update the user record
$sQuery = "
Update tblUser
Set sGUID = '$aResult[1]'
Where iUser = $aResult[0]";
mysql_query($sQ uery, $hDB);
// Set the cookie and redirect
setcookie("sess ion_id", $aResult[1], time() + 3600)
}
else
{
// Not authenticated
header('Locatio n: LoginTest.php?r efer='.urlencod e($psRefer));
}
}
?>
Comment