problem in cookies
Posted: Fri May 16, 2008 1:10 pm
hi 2 all
whenever a user login's to my site , I cant get the complete information about the user
(i.e) which user has logged in and at what time he has logged in
is there any problem in cookies i have created .....pls help
WEBSITE NAME win.x10hosting.com
Below is the php code of my website
<?php require_once('Connections/qwerty.php'); ?>
<?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'];
}
if (isset($_POST['textfield'])) {
$loginUsername=$_POST['textfield'];
$password=$_POST['textfield2'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "THANKYOU.html";
$MM_redirectLoginFailed = "register.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_qwerty, $qwerty);
$LoginRS__query=sprintf("SELECT username, password FROM login WHERE username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $qwerty) 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 );
setcookie(”visitor”, “index.php”, time()+3600);
echo $_COOKIE["visitor"];
// A way to view all cookies
print_r($_COOKIE);
}
}
?>
<!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">
<!-- DW6 -->
<head>
<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<title>Entertainment - Home Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="mm_entertainment.css" type="text/css" />
<style type="text/css">
<!--
.style1 {font-size: xx-large}
-->
</style>
</head>
<body bgcolor="#14285f">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="02021e">
<td width="400" colspan="4" rowspan="2" nowrap="nowrap"><img src="mm_entertainment_image.jpg" alt="Header image" width="400" height="140" border="0" /></td>
<td width="360" height="58" nowrap="nowrap" colspan="3" id="logo" valign="bottom"><div align="center" class="style1">WIN</div></td>
<td width="100%"> </td>
</tr>
<tr bgcolor="02021E">
<td height="57" nowrap="nowrap" colspan="3" id="tagline" valign="top"> </td>
<td width="100%"> </td>
</tr>
<tr>
<td colspan="8" bgcolor="#cc3300"><img src="mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
</tr>
<tr>
<td colspan="8"><img src="mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
</tr>
<tr>
<td colspan="8" bgcolor="#cc3300"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
</tr>
<tr>
<td colspan="8"> <br />
<br /> </td>
</tr>
<tr>
<td width="155" valign="top" height="370">
<table border="0" cellspacing="0" cellpadding="0" width="155" id="navigation">
<tr>
<td width="155" height="40"><a href="index.html">HOME</a><a href="register.php">REGISTER</a><a href="quiz.php">QUIZ</a><a href="javascript:;"></a></td>
</tr>
<tr>
<td width="155" height="40"><a href="javascript:;"></a></td>
</tr>
<tr>
<td width="155" height="40"><a href="javascript:;"></a></td>
</tr>
<tr>
<td width="155" height="40"><a href="javascript:;"></a></td>
</tr>
<tr>
<td width="155" height="40"><a href="javascript:;"></a></td>
</tr>
<tr>
<td width="155" height="40"><a href="javascript:;"></a></td>
</tr>
</table></td>
<td width="1" bgcolor="#445DA0"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
<td width="50"><img src="mm_spacer.gif" alt="" width="50" height="1" border="0" /></td>
<td width="304" colspan="2" valign="top"><img src="mm_spacer.gif" alt="" width="304" height="1" border="0" /><br />
<table border="0" cellspacing="0" cellpadding="0" width="304">
<tr>
<td height="41" class="pageName">HOME</td>
</tr>
<tr>
<td class="bodyText"> </td>
</tr>
</table> </td>
<td width="50"><img src="mm_spacer.gif" alt="" width="50" height="1" border="0" /></td>
<td width="200" valign="top"><img src="mm_spacer.gif" alt="" width="1" height="10" border="0" /><br />
<table border="0" cellspacing="0" cellpadding="0" width="200">
<tr>
<td colspan="3" id="sidebarHeader" class="sidebarHeader" align="center">On Stage This Week</td>
</tr>
<tr>
<td width="45"><img src="mm_spacer.gif" alt="" width="40" height="1" border="0" /></td>
<td width="110" id="sidebar" class="smallText">
<p><img src="mm_entertainment_image1.jpg" alt="image 1" width="110" height="110" border="0" vspace="6" /><br />
Lorem ipsum dolor sit amet consetetur.<br /> <a href="javascript:;">read more ></a></p>
<p><img src="mm_entertainment_image2.jpg" alt="image 2" width="110" height="110" border="0" vspace="6" /><br />
Lorem ipsum dolor sit amet consetetur.<br />
<a href="javascript:;">read more ></a><br /></p>
<br />
<br />
<br />
<br /> </td>
<td width="45"> </td>
</tr>
</table>
<br /> </td>
<td width="100%"><form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<label>username
<input type="text" name="textfield" />
</label>
<p>
<label>password
<input type="password" name="textfield2" />
</label>
</p>
<p>
<label>login
<input type="submit" name="Submit" value="Submit" />
</label>
</p>
</form>
</td>
</tr>
<tr>
<td width="155"> </td>
<td width="1"></td>
<td width="50"> </td>
<td width="194"> </td>
<td width="110"> </td>
<td width="50"> </td>
<td width="200"> </td>
<td width="100%"> </td>
</tr>
</table>
</body>
</html>
whenever a user login's to my site , I cant get the complete information about the user
(i.e) which user has logged in and at what time he has logged in
is there any problem in cookies i have created .....pls help
WEBSITE NAME win.x10hosting.com
Below is the php code of my website
<?php require_once('Connections/qwerty.php'); ?>
<?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'];
}
if (isset($_POST['textfield'])) {
$loginUsername=$_POST['textfield'];
$password=$_POST['textfield2'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "THANKYOU.html";
$MM_redirectLoginFailed = "register.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_qwerty, $qwerty);
$LoginRS__query=sprintf("SELECT username, password FROM login WHERE username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $qwerty) 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 );
setcookie(”visitor”, “index.php”, time()+3600);
echo $_COOKIE["visitor"];
// A way to view all cookies
print_r($_COOKIE);
}
}
?>
<!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">
<!-- DW6 -->
<head>
<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<title>Entertainment - Home Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="mm_entertainment.css" type="text/css" />
<style type="text/css">
<!--
.style1 {font-size: xx-large}
-->
</style>
</head>
<body bgcolor="#14285f">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="02021e">
<td width="400" colspan="4" rowspan="2" nowrap="nowrap"><img src="mm_entertainment_image.jpg" alt="Header image" width="400" height="140" border="0" /></td>
<td width="360" height="58" nowrap="nowrap" colspan="3" id="logo" valign="bottom"><div align="center" class="style1">WIN</div></td>
<td width="100%"> </td>
</tr>
<tr bgcolor="02021E">
<td height="57" nowrap="nowrap" colspan="3" id="tagline" valign="top"> </td>
<td width="100%"> </td>
</tr>
<tr>
<td colspan="8" bgcolor="#cc3300"><img src="mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
</tr>
<tr>
<td colspan="8"><img src="mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
</tr>
<tr>
<td colspan="8" bgcolor="#cc3300"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
</tr>
<tr>
<td colspan="8"> <br />
<br /> </td>
</tr>
<tr>
<td width="155" valign="top" height="370">
<table border="0" cellspacing="0" cellpadding="0" width="155" id="navigation">
<tr>
<td width="155" height="40"><a href="index.html">HOME</a><a href="register.php">REGISTER</a><a href="quiz.php">QUIZ</a><a href="javascript:;"></a></td>
</tr>
<tr>
<td width="155" height="40"><a href="javascript:;"></a></td>
</tr>
<tr>
<td width="155" height="40"><a href="javascript:;"></a></td>
</tr>
<tr>
<td width="155" height="40"><a href="javascript:;"></a></td>
</tr>
<tr>
<td width="155" height="40"><a href="javascript:;"></a></td>
</tr>
<tr>
<td width="155" height="40"><a href="javascript:;"></a></td>
</tr>
</table></td>
<td width="1" bgcolor="#445DA0"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
<td width="50"><img src="mm_spacer.gif" alt="" width="50" height="1" border="0" /></td>
<td width="304" colspan="2" valign="top"><img src="mm_spacer.gif" alt="" width="304" height="1" border="0" /><br />
<table border="0" cellspacing="0" cellpadding="0" width="304">
<tr>
<td height="41" class="pageName">HOME</td>
</tr>
<tr>
<td class="bodyText"> </td>
</tr>
</table> </td>
<td width="50"><img src="mm_spacer.gif" alt="" width="50" height="1" border="0" /></td>
<td width="200" valign="top"><img src="mm_spacer.gif" alt="" width="1" height="10" border="0" /><br />
<table border="0" cellspacing="0" cellpadding="0" width="200">
<tr>
<td colspan="3" id="sidebarHeader" class="sidebarHeader" align="center">On Stage This Week</td>
</tr>
<tr>
<td width="45"><img src="mm_spacer.gif" alt="" width="40" height="1" border="0" /></td>
<td width="110" id="sidebar" class="smallText">
<p><img src="mm_entertainment_image1.jpg" alt="image 1" width="110" height="110" border="0" vspace="6" /><br />
Lorem ipsum dolor sit amet consetetur.<br /> <a href="javascript:;">read more ></a></p>
<p><img src="mm_entertainment_image2.jpg" alt="image 2" width="110" height="110" border="0" vspace="6" /><br />
Lorem ipsum dolor sit amet consetetur.<br />
<a href="javascript:;">read more ></a><br /></p>
<br />
<br />
<br />
<br /> </td>
<td width="45"> </td>
</tr>
</table>
<br /> </td>
<td width="100%"><form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<label>username
<input type="text" name="textfield" />
</label>
<p>
<label>password
<input type="password" name="textfield2" />
</label>
</p>
<p>
<label>login
<input type="submit" name="Submit" value="Submit" />
</label>
</p>
</form>
</td>
</tr>
<tr>
<td width="155"> </td>
<td width="1"></td>
<td width="50"> </td>
<td width="194"> </td>
<td width="110"> </td>
<td width="50"> </td>
<td width="200"> </td>
<td width="100%"> </td>
</tr>
</table>
</body>
</html>