Sessions Are Killing ME!!!
Posted: Wed Jun 07, 2006 2:52 pm
Ok, I may have posted this many times,but i still cannot get sessions to work!!!!!!!!! I have tried almsot all of the ways people have posted back to me,none of them work. This is what i hve so far:
form page
loging checker page
i am trying to access the session on this page:
this is really killing me. please someone give me a way to make this work. print_r tellsme Array() and then gives me my error message.
form page
Code: Select all
<?PHP
session_start();
?>
<!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>Admin Page</title>
<style type="text/css">
<!--
.style1 {font-size: 16px}
.style4 {font-size: 24px}
-->
</style>
</head>
<body>
<h1>
<?PHP
//simple check to see if the person is logged in
if(isset($_SESSION['in']) && $_SESSION['in'] == 1) {
echo '<font color=green>You are logged in,please go <a href="http://avi.aerohostale.com/admin/main.php">Here</a> to see the main page.</font>';
}
else {
?>
</h1>
<div align="center" class="style1">
<p class="style4"> Admin Login</p>
<form id="form1" name="form1" method="post" action="login.php">
<p>Username
<input name="you" type="text" id="you" />
</p>
<p>Password
<input name="me" type="text" id="me" />
</p>
<p>
<input type="submit" name="Submit" value="Submit" />
<input type="reset" name="Submit2" value="Reset" />
</p>
</form>
<p> </p>
<div align="center" class="style1"></div>
</div>
<?PHP
}
?>
</body>
</html>Code: Select all
<?PHP
session_start();
?>
<?PHP
$you = $_POST['you'];
$me = $_POST['me'];
if(($you == '***') && ($me == '***')) {
$_SESSION['in'] = 1;
echo 'You are in,please go <a href="http://avi.aerohostale.com/admin/main.php">Here</a>';
}
else{
header("Location: http://avi.aerohostale.com/admin");
}
?>
<!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>Logging In</title>
</head>
<body>
</body>
</html>Code: Select all
<?PHP
session_start();
?>
<!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>Main Admin Page</title>
</head>
<body>
<?PHP
print_r($_SESSION);
error_reporting(E_ALL);
if(!isset($_SESSION['in']) || $_SESSION['in'] != 1) {
echo 'You are not logged in,please go to <a href="http://avi.aerohostale.com/admin">Here</a> to login';
}
else {
echo 'Welcome to the admin page. This is the basic layout so far.<br>Please use one of the links below to do what you would like to.';
echo '<br>';
echo '<br>';
echo '<a href="http://avi.aerohostale.com/admin/addoffer.php">Add An Offer</a>';
echo '<br>';
echo '<a href="http://avi.aerohostale.com/admin/tabview.php">View Pending and Completed Offers</a>';
echo '<br>';
echo '<a href="http://avi.aerohostale.com/admin/pay.php">Make a Payment to Someone</a>';
}
?>
</body>
</html>