Ok I have a login script that I made, it used to work but now it doesn't. It still sets the session variable and everything, but I use a function to log in, and everything works but the header location to transfer to the main admin page. I can't find out why it's not working.. The Log in Function(Database connect info removed). [code] <?php function aLogin($user, $pass) { $dbname = ""; $dbuser = ""; $dbpass = ""; $dbhost = ""; $connection = @mysql_connect ($dbhost, $dbuser, $dbpass) or die("Error Connecting: ".mysql_error()); @mysql_select_db($dbname, $connection) or die("Error Selecting Database:".mysql_error()); $query = "SELECT * FROM admin_user WHERE name = '".$user."'"; $result = @mysql_query($query) or die ("Error Retrieving Data: ".mysql_error()); while($data = mysql_fetch_assoc($result)){ $ulvl = $data['ulvl']; $usern = $data['name']; $pass1 = $data['pass'];} if(!$usern) { echo "Invalid username or password! Press back and try again!";} else { if($pass==$pass1) { session_start(); session_register('usern'); session_register('ulvl'); $_SESSION['usern']=$usern; $_SESSION['ulvl']=$ulvl; header("Location: main.php" ); <------------------DOESNT WORK HERE //we will redirect the user to another page where we will make sure they're logged in } else { echo "Invalid Password!"; }}} ?>[/code] Index.php [code]<?php $id = $_GET['id']; include("../db.php"); include("../functions.php"); echo "<link rel=\"stylesheet\" href=\"../style/id1.css\" />"; if(!$id){ ?> <div align="center"> <p>RSLegion Admin Login Page<br /> <a href="../">Back to Website</a> <p> </p> <form name="form1" method="post" action="index.php?id=1"> <p>Username: <input name="user" type="text" id="user" size="20" maxlength="20"> </p> <p> Password: <input name="pass" type="password" id="pass" size="20" maxlength="20"> </p> <p> <input type="submit" name="Submit" value="Log In"> </p> </form> <p> </p> </div> <?php } else { $user = $_POST['user']; $pass = $_POST['pass']; aLogin($user, $pass); } ?>[/code]