I am getting the error "Cannot modify header information - headers already sent by..." you know the rest. I have searched and found a number of people asking the same question however I do not understand the responses.
1) White space in the code - how do I find the white space to remove it?
2) No HTML output - sorry how do I get round this?
The php file I am running is:
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><title>Web Template by Glyndwr D. Bartlett</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta content="CD Copyright © 2005 Glyndwr D. Bartlett" name="description"> <meta content="Glyndwr D. Bartlett" name="author"></head> <?php //Quote variable to make safe function quote_smart($value) { //Strip slashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } //Quote if not integer if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } return $value; } //Connect $link=mysql_connect("127.0.0.1","root") OR die(mysql_error()); $db=mysql_select_db("db1",$link); //Check validity of UserName and Password if(isset($_POST['LogIn_x'])) { $query = sprintf("SELECT * FROM tbl_user WHERE User_Name=%s AND Password=md5(%s)", quote_smart($_post['UserName']), quote_smart($_post['PassWord'])); $result = mysql_query($query); $affected = mysql_num_rows($result); if ($affected != 1) { session_unset(); echo "<font face='Verdana' size='2' color=red>Wrong Login. Use your correct UserID and Password and try again. <br>"; echo "<center> <input type='button' value='Retry' onClick='history.go(-1)'></center>"; exit(); } } //If Reset was selected we redirect to the homepage. ?> <?php if(isset($_POST['Reset_x'])) { header ("Location: index.php"); exit(); } ?> </html>
The error comes from the fifth last line header "("Location: index.php");".
The page I am going to is:
PHP Code:
<? if(file_get_contents("lang.tmp")=="") { header("Location: splash.php"); exit(); } ?> <html> <head> <meta name="author" content="Glyndwr D. Bartlett"> <title>Kortge Cutlers</title> <frameset rows="140,*" marginwidth="0" marginheight="0" frameborder="0" border="0" borderwidth="0"> <frame name="head" src="head.php" scrolling=no> <frameset cols="225,*,225" marginwidth="0" marginheight="0" frameborder="0" border="0" borderwidth="0"> <frame name="navi" src="navi.php" scrolling=auto> <frame name="content" src="start.php" marginwidth=20> <frame name="login" src="login.php" marginwidth=20 scrolling=no> </frameset> </frameset> </head> <body bgcolor=#ffffff> </body> </html>
Your help is greatly appreciated.
Regards,
Glyn
|