Hello!
Why my logon page is not working it was working fine
yesterday...
any immediate help is higly appreciated...
Thanks,
Sean
<?php require_once('Connections/MyConn.php'); ?>
<?php
session_start();
include "mysql_data.inc";
if ($POST['Func'] == "Submit") {
$username = $POST['username'];
$password = $_POST['password'];
//connect to the DB
$db = mysql_connect("localhost", $mysql_user, $mysql_password);
mysql_select_db($mysql_db,$db);
//set up the query
$query = "SELECT name FROM login WHERE username = '" . $username . "' AND password = '" . $password . "'";
//run the query and get the number of affected rows
$result = mysql_query($query, $db) or die('error making query');
//echo $username;
if(!$row = mysql_fetch_assoc($result)){
echo "<p align=\"center\"><font size=\"5\" color=\"red\"><b>Sorry the username and or password is not
valid</b></font></p>";
} else {
// session_register ("logged_in");
//session_register ("user_name");
$_SESSION['logged_in'] = "True";
$_SESSION['user_name'] = mysql_result($result,0,'name');
//$HTTP_SESSION_VARS ['user_name'] = mysql_result($result,0,'name');
// header("location: home_drop_downa.php");
if ($username =="admin") {
header("location: report2.php");
}
else
{
header("location: home_drop_downa.php");
}
}
}
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p> <table border="0" align="center" bgcolor="#336699" width="506" id="table1">
<tr>
<td>
<h1 align="center"><font color="#FFFFFF" size="6" face="Times New Roman, Times, serif"><strong>Dietary
Login</strong></font></h1>
<form method="POST" action="<?=$_SERVER['PHP_SELF']?>">
<p align="center"><font face="Arial" color="#FFFFFF"><strong><font size="4" face="Times New Roman, Times,
serif">User
Id:</font> </strong></font>
<input type="text" name="userid" bgcolor="#666666" size="20">
</p>
<p align="center"><font color="#FFFFFF" size="4" face="Times New Roman, Times,
serif"><strong>Password:</strong></font><strong> </strong>
<input type="password" name="password" bgcolor="#666666" size="20">
</p>
<p align="center">
<input type="submit" value="Submit" name="Func">
</p>
</form>
</td>
</tr>
</table>
</body>
</html>
-----------------------Logon Page-----------------------
-------------------Logged_in Page------------------------
<?php require_once('Connections/MyConn.php'); ?>
<?php
session_start();
// Check to see if session variable or redirect to logon page
if ($_SESSION['logged_in'] != "True") {
header("location: logon.php");
}
else
header("location: home_drop_downa.php");
// Check if Logoff button pressed - logoff and redirect
//if( $POST['Func'] == "Logoff") {
// unset($SESSION['logged_in']);
// $_SESSION = array();
// session_destroy();
// header("location: logon.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Logged In</title>
</head>
<body>
<h1 align="left"><font face="Arial">Hello <?=$_SESSION['user_name']?> </font></h1>
<form method="POST" action="home_drop_downa.php">
<!-- <p><input type="submit" value="Logoff" name="Func"></p> -->
</form>
<p align="center"> </p>
</body>
</html>