I have the following code:
Code: Select all
<?php
if(isset($_POST['submit'])){
if (!$_POST['username'] | !$_POST['password'])
{
die('You did not complete all the required fields. Please go to the <a href="login.php">login page</a>');
}
include("connection.php");
$username=$_POST['username'];
$password=$_POST['password'];
$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
$password = md5($password);
$query = "SELECT * FROM `members` WHERE `password` = '".$password."' ";
$result1 = mysql_query($query) or die("Can't execute insert query: " . mysql_error());
$row = mysql_fetch_array($result1);
$passwordcheck = $row['password'];
$passwordcheck = stripslashes($passwordcheck);
$sql = "SELECT * FROM members WHERE username='$username' and password='$password'";
$result2 = mysql_query($sql);
$count=mysql_num_rows($result2);
if($count == 1 && $password == $passwordcheck) {
$_SESSION['username'] = $username;
session_write_close();
header("location: guild_registration.php");
}
else
{
echo "Wrong Username or Password <br />";
echo "Please try again"; ?>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="loginverify.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong>Member Login</strong></td>
</tr>
<tr>
<td width="78">Username</td>
<td width="6">:</td>
<td width="294"><input name="username" type="text" maxlength="20" /></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="password" type="password" maxlength="20" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<?php
}
}
if(!isset($_POST['submit'])){
die('The server requires you login to access this page. Please go to the <a href=\"login.php\">login page</a>');
}
?>'Warning: Cannot modify header information - headers already sent by (output started at /www/1stfreehosting.com/a/s/h/ashpea1/htdocs/verifylogin.php:10) in /www/1stfreehosting.com/a/s/h/ashpea1/htdocs/verifylogin.php on line 38'
(ignore the line reference when looking at the code above, i have other code about that. Line 38 is the line where it sets the header.)
Now i have read some FAQs about this, something about removing white space. Well i have done that, to no avail so can anyone poiint out whats wrong?