Forgive me, my php is a little rusty. I'm trying to do a simple login form but every time I refresh the page, I get a new session id. Here's the code, every time I click login, I get a different session id. Any ideas why?
<?php session_start(); include("http://crossfitarchway.com/clients/includes/header.php"); ?>
<form name="loginForm" method="post">
<h3>Login</h3>
<table cellpadding="0" cellspacing="0">
<tr>
<td class="tablePadding">Username:</td>
<td class="tablePadding">
<input type="text" name="usernameInput" value="<?php echo($_SESSION['un']); ?>" />
</td>
</tr>
<tr>
<td class="tablePadding">Password:</td>
<td class="tablePadding">
<input type="password" name="passwordInput" />
</td>
</tr>
<tr>
<td class="tablePadding">
<input type="submit" name="loginButton" value="Login" />
</td>
</tr>
</table>
</form>
<?php
//if they clicked login
if(isset($_POST['loginButton'])){
//make sure they put in a username and password
$un = $_POST['usernameInput'];
$pw = $_POST['passwordInput'];
echo(session_id());
$_SESSION['un'] = $un;
if($un == "" or $pw == ""){
echo("<span class='errorClass'>Please enter a username and password</span>");
exit();
}//if un
//if we're here we connect
connect();
}//if isset post login button
?>
<?php include("http://crossfitarchway.com/clients/includes/footer.php"); ?>