Hi sorry to bother you again but im really stuck on this i carn't seem to find any errors in the script i have been at this all day and just carn't seem to get my head around it. π
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
* This problem can sometimes be caused by disabling or refusing to accept
cookies.
Here is my code below:
<?php
session_start();
include "common.php";
DBConnect();
$message = "";
//clear message
$username = $_REQUEST['username'];
$password = $_REQUEST['password'];
$action = $_REQUEST['action'];
//echo ("User Name = $username");
//echo ("Password = $password");
$action="Login";
$Link = mysql_connect($Dhost, $Duser, $Dpassword);
//Query for User Name And Password. Select 1 record, where username is equal to user input.
$Query = "SELECT username, password FROM $tbl_user WHERE username = '$username'";
$Result = mysql_db_query ($DBName, $Query, $Link);
//Check that the table contains the user name entered
$num_rows= mysql_num_rows($Result);
$passwordmatch= mysql_fetch_array($Result);
if(!($num_rows)){
//Deliver String Variable For User Not Recognised
$message = "User Name Not Recongised, Please Try Again!";
header("location: index.php?message=$message");
exit(); //to stop script, break it here
}else{
if($password !=$passwordmatch['password']){
//Deliver String Variable For Wrong Password
$message = "<div>Password Wrong, Please Login Again!</div>";
header("location: index.php?message=$message");
exit(); //to stop script, break it here
}else{
$_SESSION['username'] = $username;
$message = "Welcome ".$username."<br><br>You are now logged in<br>Please continue to<br>use the site!";
header("location: manager.php?message=$message");
exit(); //to stop script, break it here
}
}
?>
<?php
$message = $_GET['message'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>FYP - Teesside Football United</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
</head>
<body>
<div id="header"></div>
<div id="content">
<div id="right">
<div id="introwrap" class="clearfix">
<div class="introtext">
<h1>Welcome to Teesside Football United.</h1>
<p>Welcome to Teesside Football United the new home of footballing competition the aim of the site is to benefit competing football sides from saturday and sunday league football and allow them to compete against each other because they are unable to with the league there in.</p>
</div>
</div>
<div class="rightbox">
<h4>Manager Log In</h4>
<form id="form1" method="post" action="manager.php?action=Login">
<p>
<label>Username
<input type="text" name="username" id="username" />
</label>
</p>
<p>
<label>Password
<input type="password" name="password" id="password" />
</label>
</p>
<p>
<label>
<input type="submit" name="Login" value="Login" />
</label>
</p>
</form>
<p>
<label><br />
<?php echo $message ; ?>
</label>
<a href="register">Click Here To Register</a></p>
<p> </p>
</div>
<h2>Fixture 1: Team 1 v Team 3</h2>
<p>Brief match info</p>
<h2>Fixture 2: Team 2 v Team 4</h2>
<p>Brief match info</p>
<h2>Fixture 3: Team 5 v Team 6</h2>
<p>Brief Match info</p>
</div>
<div id="left">
<h3>Home</h3>
<ul>
<li><a href="teams.html">Teams</a></li>
<li><a href="comp.html">Competitions</a></li>
<li><a href="contact.html">Contact Us</a></li>
<li><a href="admin.html">Admin Login</a></li>
<li><a href="manager.html">Managers Page</a></li>
</ul>
</div>
</div>
</body>
</html>
Also is there maybe any books you could reccommend for beginners just I am a student and looking to learn PHP thanks for your time