PillmatiC Posted September 30, 2008 Share Posted September 30, 2008 OK So I have a text based game, not yet up and running fully due to a log in problem. "Warning: Cannot modify header information - headers already sent by (output started at /home/www/*.com/index.php:10) in /home/www/*.com/index.php on line 109" Line 109 on the said page is "header("Location: News.php");" I know this is down to a white space problem, but I am 99.99% sure I have NO white space. I have checked EVERY page. I am using freehostia (just whilst I code it and get it working how I want.) I have googled the problem and all i get back is "Delete white spaces" nothing more in-depth than that. Any ideas of other solutions to this problem, or if I have missed something fatally obvious, please feel free to post... Thanks, ~PillmatiC Edit: <?php include_once("config.php"); include_once("connect.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Mercenaries Online - Log In</title> <link href="style.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- body { background-image: url(../BG%20copy.jpg); } .style1 {color: #EBE9ED} .style2 {color: #FFFFFF} .style4 {color: #CCCCCC; } --> </style></head> <body OnLoad="document.login.mail.focus();"> <table width="1140" border="0"> <tr> <th width="1130" height="684" background="img/Backgroundlogin copy.png"><p> </p> <p> </p> <p> </p> <p> </p> <table width="800" border="0" align="center" cellspacing="0"> <tr> <td><table width="799" border="0" align="center" cellspacing="2" background=""> <tr> <td class="off" onclick="location.href='index.php'" onmouseover="this.className='on'" onmouseout="this.className='off'"><a href="index.php" class="on style4" onfocus="if(this.blur)this.blur()"> Login.</a></td> <td class="off" onclick="location.href='register.php'" onmouseover="this.className='on'" onmouseout="this.className='off'"><a href="register.php" class="style4" onfocus="if(this.blur)this.blur()">Register.</a></td> <td class="off" onclick="location.href='forgot.php'" onmouseover="this.className='on'" onmouseout="this.className='off'"><a href="forgot.php" class="style4" onfocus="if(this.blur)this.blur()">Forgot Password.</a></td> </tr> </table></td> </tr> <tr> <td height="250" align="center" valign="middle"><table width="647" height="214" border="0"> <tr </tr> </table></td> </tr> <tr> <td align="center" valign="bottom"><form action="" method="post" name="login" id="login"> <?php if(isset($_SESSION['user_id'])) { // if already logged in. session_unset(); session_destroy(); echo "You have been logged out."; } if(isset($_POST['submit'])) { if(!preg_match("/^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$/i", $_POST['mail'])) { echo "Invalid Password / Username combination."; }else{ $query = "SELECT password,id,login_ip,login_count,activated FROM login WHERE mail='".mysql_real_escape_string($_POST['mail'])."'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); if(empty($row['id'])){ echo "Invalid Password / Username combination."; }else{ if($row['login_count'] >= 5 ){ echo "You have tried 5 or more false combinations you can reclaim your account with the forgot password option."; }else{ if($row['activated'] == 1){ echo "Your account has not yet been activated."; }else{ if(md5($_POST['pass']) != $row['password']){ echo "Invalid Password / Username combination."; $update_login = mysql_query("UPDATE login SET login_count=login_count+'1' WHERE mail='".mysql_real_escape_string($_POST['mail'])."'") or die(mysql_error()); }else{ if(empty($row['login_ip'])){ $row['login_ip'] = $_SERVER['REMOTE_ADDR']; }else{ $ip_information = explode("-", $row['login_ip']); if (in_array($_SERVER['REMOTE_ADDR'], $ip_information)) { $row['login_ip'] = $row['login_ip']; }else{ $row['login_ip'] = $row['login_ip']."-".$_SERVER['REMOTE_ADDR']; } } $_SESSION['user_id'] = $row['id']; $result = mysql_query("UPDATE login SET userip='".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."',login_ip='".mysql_real_escape_string($row['login_ip'])."',login_count='0' WHERE id='".mysql_real_escape_string($_SESSION['user_id'])."'") or die(mysql_error()); header("Location: News.php"); }// count check. }// id check. }// password check. }// mail check. }// disabled check. }// if isset submit. // Activate. if(isset($_GET['activation_link'])){ // check if activation link is valid. if(is_numeric($_GET['activation_link']) and strlen($_GET['activation_link']) == 20 ){ // activate if valid. $result = mysql_query("UPDATE login SET activated='2' WHERE activated='1' and activation_id='".mysql_real_escape_string($_GET['activation_link'])."'") or die(mysql_error()); if(mysql_affected_rows()){ echo "Your account has been activated."; }else{ echo "Error! This account has already been activated or the submitted information was incorrect."; } }else{ echo "Error! Invalid Activation Link."; } } ?> <table width="450" border="0" align="center" cellspacing="0"> <tr> <td align="right" class="style1"><label>Email: </label></td> <td width="150" align="center"><input name="mail" type="text" class="entryfield" id="mail" style='width: 95%;'/></td> <td width="60" align="right" class="style1"><label>Password: </label></td> <td width="150" align="center"><input name="pass" type="password" class="entryfield" id="pass" style='width: 95%; ' maxlength="20"/></td> </tr> <tr> <td height="35" colspan="4" align="center"><table width="100" border="0" cellspacing="0"> <tr> <td align="center"><input name="submit" type="submit" class="button" value="Login." onfocus="if(this.blur)this.blur()" style="background-color:#222222;"/></td> </tr> </table></td> </tr> </table> </form></td> </tr> </table></th> </tr> </table> <p> </p> <p> </p> <center> </center> </body> </html> Included full code. Link to comment https://forums.phpfreaks.com/topic/126467-log-in-problem-the-infamous-whitespace-problem/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.