okay basically i am making a lil test script but for some reason this wont set a session?????? i am unsure why. Can anyone help me with this please?
Heres my code:
<?php
if (isset($_POST['submitted'])) {
$username = $_POST['username'];
$password = $_POST['password'];
if ($username == "test" && $password == "test")
{
session_start();
$_SESSION['admin'] = 1;
}
else
{
echo '<script type="text/javascript">
alert("Incorrect username or password.");
</script>';
}
}
?>
<?php
include_once('header.php');
echo '<div id="login"><br><br><br><br>
<center>
<form action="login.php" method="POST">
<fieldset style="width:500px; height: 170px;">
<legend>
  Staff login   
</legend><br>
Username: <input type="text" name="username">
<br><br>
Password: <input type="password" name="password">
<br><br><br>
<input type="hidden" name="submitted" value="TRUE">
<input style="font-family:Arial, Helvetica, sans-serif;color:#6294A8;font-size:12px; height: 25px; width: 100px" type="submit" value="Login" name="login">
</fieldset>
</form>
</center>
<br><br><br><br>
</div>';
?>
Many Thanks,
J


Sign In
Create Account


Back to top









