PHP Code:
<?php include("header.php"); ?>
<?php
$User = "Shuttle_Wave";
$Pass = "test";
?>
<center>
<h1>Admin Login Panel</h1>
<form action='#' method='post'>
Username: <input type="text" name="username" id="username" />
Password: <input type="password" name="password" id="password" />
<input type="submit" name="Submit" value="Login" /></form>
</center>
<?php
if(isset($_POST["username"]) && isset($_POST["password"]))
{
if($_POST["username"] == $User && $_POST["password"] == $Pass)
{
session_register("username");
session_register("password");
header("location:system.php");
}
else
{
echo "Incorrect Username or Password";
}
}
?>
<body>
</body>
</html>
i did that. it wrks but when i enter the correct user and password i get this error
PHP Code:
Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\header.php:12) in C:\xampp\htdocs\login.php on line 27
Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\header.php:12) in C:\xampp\htdocs\login.php on line 27
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\header.php:12) in C:\xampp\htdocs\login.php on line 29
codes below is my system.php
PHP Code:
<?php include("header.php"); ?>
<?php include("databases.php"); ?>
<?
session_start();
if(!session_is_registered(username))
{
header("location:login.php");
}
?>
<center>
<h1>Login System Information</h1>
<?php
echo "<table border='1'>
<tr class=\"table_head\">
<th class=\"number\" style=\"min-width:20px;\">#</th>
<th> Name </th>
<th> UserName </th>
<th> Password </th>
<th> Status </th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td class=\"number\"> " . $row['num'] . " </td>";
echo "<td class=\"center\"> " . $row['name'] . " </td>";
echo "<td class=\"center\"> " . $row['username'] . " </td>";
echo "<td class=\"center\"> " . $row['password'] . " </td>";
echo "<td class=\"center\"> " . $row['status'] . " </td>";
echo "</tr>";
}
echo "</table>";
mysql_close($database);
?>
</center>
<body>
</body>
</html>
__________________