Why Won't This Login Script Work?
Posted: Fri Mar 10, 2006 4:57 pm
I'll send you a cookie if you can tell me...
Code: Select all
<?php session_start(); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<title>Untitled</title>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<?php
ob_start();
if (isset($_GET['action']) && $_GET['action'] == 'submitted') {
$_SESSION['employee'] = $_GET['this_employee'];
$_SESSION['password'] = $_GET['password'];
header("Location: do_what.php");
} else {
mysql_connect( 'localhost','root','password' )
or die( "error connecting to database to get employee list" . mysql_error() );
mysql_select_db( 'pmg_finance' )
or die( "could not select pmg_finance" . mysql_error() );
echo "<form action=".$_SERVER['PHP_SELF']." method=\"GET\" />";
$employee_query = "SELECT full_name from employees order by full_name";
$employee_result = mysql_query( $employee_query );
echo "<select name=\"employee_select\" size=\"1\">";
echo "<option disabled=\"true\" value=\"\"><br>";
while ($employee_fetch = mysql_fetch_object( $employee_result ))
{$this_employee = $employee_fetch -> full_name ;
echo "<option>".$this_employee."<br>";
}
echo "</select>";
mysql_close();
}
ob_end_flush();
?>
<input type="password" name="password" />
<input type="hidden" name="action" value="submitted" />
<input type="submit" name="submit" value="Go Do It" />
</td>
</form>
</body>
</html>