Hello:
I have a login script in which I want to set a cookie. A cookie should be set only if a user checks the box, Remember Me.
When I run my script, I'm receiving a blank page. I tried placing the code in different places within the script and the result is always the same.
Can someone take a look at my script and help me set my cookie properly?
Thank you very much.
Here's the script:
<?php
session_start();
header("Cache-control: private");
include "conn.inc.php";
switch($_REQUEST['req'])
{
case "validate":
$validate = mysql_query("SELECT * FROM member WHERE
username = '{$POST['username']}' AND password = md5('{$POST['password']}')") or
die (mysql_error());
if (mysql_num_rows($validate) == 1)
{
while($row = mysql_fetch_assoc($validate))
{
$SESSION["status"] = "Logged";
$SESSION['memberid'] = $row['memberid'];
$SESSION['first_name'] = $row['first_name'];
$SESSION['last_name'] = $row['last_name'];
$SESSION['email'] = $row['email'];
$SESSION['phone1'] = $row['phone1'];
$SESSION['phone2'] = $row['phone2'];
$SESSION['username'] = $row['username'];
$_SESSION['password'] = $row['password'];
if ($_POST[remember] == "Yes")
{
setcookie("username", $_SESSION['username'], time()+(60*60*24), ".[url]http://www.bridgemilltennis.com[/url]";
setcookie("password", $_SESSION['password'], time()+(60*60*24), ".[url]http://www.bridgemilltennis.com[/url]";
}
$login_time = mysql_query("UPDATE member SET last_login=now() where memberid='{$row['memberid']}'");
}
header("Location: [url]http://www.bridgemilltennis.com/members/secure/member-area-main.php[/url]");
}
else
{
$_SESSION["status"] = "Not logged";
$_SESSION['username'] = Guest;
header("Location: [url]http://www.bridgemilltennis.com/members/secure/login_form.php[/url]");
exit;
}
break;
}
?>