PHP - How To Send This Array Of Header Information ?
Hi;
I have an array of header information that i want to send before doing an echo to the page. Something like :
// Send the header information in the array below, then echo $html; die();The information in the array is for example : HTTP/1.1 200 OK Date: Sat, 09 Aug 2014 00:01:36 GMT Server: Apache/2.2.22 (Ubuntu) X-Powered-By: PHP/5.4.9-4ubuntu2 X-Logged-In: False P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Cache-Control: public, must-revalidate, proxy-revalidate Expires: Sat, 09 Aug 2014 02:01:36 GMT Connection: keep-alive, close Pragma: public Vary: Accept-Encoding Content-Type: text/html; charset=utf-8Thank you. Similar TutorialsI have a page that adds name and date of birth of an actor. <input type='text' id='name' name='name' value=''/> <input type='text' id='dob' name='dob' value=''/> But I made a loop that enables the user to add multiple actor information at once, so the page will actually look like this. (if you can imagine how it would look on a website with these php codes) <input type='text' id='name' name='name' value=''/> <input type='text' id='dob' name='dob' value=''/> <input type='text' id='name' name='name' value=''/> <input type='text' id='dob' name='dob' value=''/> <input type='text' id='name' name='name' value=''/> <input type='text' id='dob' name='dob' value=''/> <input type="submit" Value="Add"/> How do I send all 3 of these actor information into my saving page instead of just 1 and how do I save all 3 in that saving page? Hey guys im getting the error Warning: Cannot modify header information - headers already sent by (output started at /home/kylegray/public_html/include/authenticate.php:12) in /home/kylegray/public_html/home.php on line 7 Any idea why this is coming up. I think its something to to with me setting the cookie setcookie("un", $id); but im not sure. home.php Code: [Select] <? include("include/config.php"); //$_SESSION["backpage"]=$_SERVER['PHP_SELF']; if($_SESSION["client_log"]!="true"){ session_unregister("MemberArea"); header("Location: index.php?redirect=".basename($_SERVER['PHP_SELF'])); exit(); } ?> authenticate.php Code: [Select] <?php include("include/required.php"); include("include/pagedetails.php"); include_once("include/authenticate.php"); $tblName = $tbluser; $id=$_SESSION["id"]; setcookie("un", $id); $ImgPath="$CatImage/"; $ImgPathsing="$SingUPImage/"; ?> i have problem when adding a subject it got two subject that need to be selected by teacher , management sub and DBMS sub.. said Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\PhpProject3\navhead_user.php:57) in C:\xampp\htdocs\PhpProject3\teacher_add_subject.php on line 104.. when i select one of them it appear that error.. but when i select DBMS it inserted the subject but with error.. let say 1st i selecting management as the subject, it occur error but after refresh the page it appear in the list of the teacher subject then i add another subject DBMS subject and it occur error but the management subject is dissappear from the teach subject list.. but i try to add the management subject again it said it existed but not listed.. but in my database it inside there already only the data not appear..
navhead_user.php
<div class="row-fluid"> <div class="span12"> <div class="navbar navbar-fixed-top navbar-inverse"> <div class="navbar-inner"> <div class="container"> <!-- .btn-navbar is used as the toggle for collapsed navbar content --> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <!-- Be sure to leave the brand out there if you want it shown --> <!-- Everything you want hidden at 940px or less, place within here --> <div class="nav-collapse collapse"> <!-- .nav, .navbar-search, .navbar-form, etc --> <i class="icon-facebook-sign icon-large" id="color_white"></i> <i class="icon-twitter icon-large" id="color_white"></i> <i class="icon-google-plus icon-large" id="color_white"></i> <i class="icon-github-alt icon-large" id="color_white"></i> <i class="icon-linkedin-sign icon-large" id="color_white"></i> <div class="pull-right"> <form class="navbar-search pull-left"> <i class="icon-search icon-large" id="color_white"></i> <input type="text" class="search-query" placeholder="Search"> </form> </div> <!-- end collapse --> </div> </div> </div> </div> <div class="hero-unit-header"> <div class="container"> <div class="row-fluid"> <div class="span12"> <div class="row-fluid"> <div class="span6"> <img src="admin/images/head.png"> </div> <div class="span6"> <div class="pull-right"> <!--- login button --> <?php $student_query=mysql_query("select * from teacher where teacher_id='$session_id'")or die(mysql_error()); $teacher_row= mysql_fetch_array($student_query); ?> <img src="admin/<?php echo $teacher_row['location']; ?>" class="img img-rounded" id="picture"> <div class="btn-group"> <button class="btn btn-success"><i class="icon-user icon-large"></i> <?php echo $user_row['firstname'] . " " . $user_row['lastname']; ?></button> <button class="btn dropdown-toggle" data-toggle="dropdown"> <span class="caret"></span> </button> <ul class="dropdown-menu"> <li><a href="#logout" role="button" data-toggle="modal"><i class="icon-signout icon-large"></i> Logout</a></li> </ul> </div> <?php include('logout_modal.php') ?> </div> </div> </div> </div> </div> </div> </div>teacher_add_subject.php <?php include ('session.php'); ?> <?php include('header.php'); $user_query = mysql_query("select * from teacher where teacher_id='$session_id'") or die(mysql_error()); $user_row = mysql_fetch_array($user_query); ?> <body> <?php include('navhead_user.php'); ?> <div class="container"> <div class="row-fluid"> <div class="span3"> <div class="hero-unit-3"> <div class="alert-index alert-success"> <i class="icon-calendar icon-large"></i> <?php $Today = date('y:m:d'); $new = date('l, F d, Y', strtotime($Today)); echo $new; ?> </div> </div> <div class="hero-unit-1"> <ul class="nav nav-pills nav-stacked"> <li class="nav-header">Links</li> <li> <a href="teacher_home.php"><i class="icon-home icon-large"></i> Home <div class="pull-right"> <i class="icon-double-angle-right icon-large"></i> </div> </a> </li> <li> <a href="teacher_class.php"><i class="icon-group icon-large"></i> Class <div class="pull-right"> <i class="icon-double-angle-right icon-large"></i> </div> </a></li> <li class="active"><a href="teacher_subject.php"><i class="icon-file-alt icon-large"></i> Subjects <div class="pull-right"> <i class="icon-double-angle-right icon-large"></i> </div> </a></li> <li><a href="students.php"><i class="icon-group icon-large"></i> Students <div class="pull-right"> <i class="icon-double-angle-right icon-large"></i> </div> </a></li> </ul> </div> </div> <div class="span9"> <a href="teacher_subject.php" class="btn btn-success"><i class="icon-arrow-left icon-large"></i> Back</a> <br> <br> <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> <strong><i class="icon-user icon-large"></i> Add Subject</strong> </div> <div class="hero-unit-2"> <form class="form-horizontal" method="POST"> <div class="control-group"> <label class="control-label" for="inputEmail">Subject</label> <div class="controls"> <select name="subject" class="span6"> <option></option> <?php $query = mysql_query("select * from subject") or die(mysql_error()); while ($row = mysql_fetch_array($query)) { ?> <option value="<?php echo $row['subject_id']; ?>"><?php echo $row['subject_title']; ?></option> <?php } ?> </select> </div> </div> <div class="control-group"> <div class="controls"> <button type="submit" name="save_subject" class="btn btn-success"><i class="icon-plus-sign icon-large"></i> Add Subject</button> </div> <br> <?php if (isset($_POST['save_subject'])) { $subject = $_POST['subject']; $result = mysql_query("select * from teacher_suject where teacher_id='$session_id' and subject_id='$subject'") or die(mysql_error()); $count = mysql_num_rows($result); if ($count > 0) { ?> <div class="alert alert-danger">Subject <strong>Already Exist</strong></div> <?php } else { mysql_query("insert into teacher_suject (subject_id,teacher_id) values('$subject','$session_id')") or die(mysql_error()); header('location:teacher_subject.php'); } } ?> </div> </form> <!-- end slider --> </div> </div> </div> <?php include('footer.php'); ?> </div> </div> </div> </body> </html>teacher_subject.php <?php include ('session.php'); ?> <?php include('header.php'); $user_query = mysql_query("select * from teacher where teacher_id='$session_id'") or die(mysql_error()); $user_row = mysql_fetch_array($user_query); ?> <body> <?php include('navhead_user.php'); ?> <div class="container"> <div class="row-fluid"> <div class="span3"> <div class="hero-unit-3"> <div class="alert-index alert-success"> <i class="icon-calendar icon-large"></i> <?php $Today = date('y:m:d'); $new = date('l, F d, Y', strtotime($Today)); echo $new; ?> </div> </div> <div class="hero-unit-1"> <ul class="nav nav-pills nav-stacked"> <li class="nav-header">Links</li> <li> <a href="teacher_home.php"><i class="icon-home icon-large"></i> Home <div class="pull-right"> <i class="icon-double-angle-right icon-large"></i> </div> </a> </li> <li> <a href="teacher_class.php"><i class="icon-group icon-large"></i> Class <div class="pull-right"> <i class="icon-double-angle-right icon-large"></i> </div> </a></li> <li class="active"><a href="teacher_subject.php"><i class="icon-file-alt icon-large"></i> Subjects <div class="pull-right"> <i class="icon-double-angle-right icon-large"></i> </div> </a></li> <li><a href="students.php"><i class="icon-group icon-large"></i> Students <div class="pull-right"> <i class="icon-double-angle-right icon-large"></i> </div> </a></li> </ul> </div> </div> <div class="span9"> <a href="teacher_add_subject.php" class="btn btn-success"><i class="icon-plus-sign icon-large"></i> Add Subject</a> <br> <br> <div class="hero-unit-3"> <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example"> <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> <strong><i class="icon-user icon-large"></i> Subject Table</strong> </div> <thead> <tr> <th>Course Code</th> <th>Course Description</th> <th>Action</th> </tr> </thead> <tbody> <?php $teacher_subject_query = mysql_query("select * from teacher_suject where teacher_id='$session_id'") or die(mysql_error()); $teacher_row = mysql_fetch_array($teacher_subject_query); $subject_id = $teacher_row['subject_id']; $query = mysql_query("select * from subject where subject_id = '$subject_id'") or die(mysql_error()); while ($row = mysql_fetch_array($query)) { $id = $row['subject_id']; ?> <!-- script --> <script type="text/javascript"> $(document).ready(function(){ $('#d<?php echo $subject_id; ?>').tooltip('show') $('#d<?php echo $subject_id; ?>').tooltip('hide') }); </script> <!-- end script --> <!-- script --> <script type="text/javascript"> $(document).ready(function(){ $('#e<?php echo $subject_id; ?>').tooltip('show') $('#e<?php echo $subject_id; ?>').tooltip('hide') }); </script> <!-- end script --> <tr class="odd gradeX"> <td><?php echo $row['subject_code']; ?></td> <td><?php echo $row['subject_title']; ?></td> <td width="50"> <a rel="tooltip" title="Delete Subject" id="d<?php echo $subject_id; ?>" href="#id<?php echo $id; ?>" role="button" data-toggle="modal" class="btn btn-danger"><i class="icon-trash icon-large"></i> </a> </td> <!-- user delete modal --> <div id="id<?php echo $id; ?>" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> </div> <div class="modal-body"> <div class="alert alert-danger">Are you Sure you Want to <strong>Delete</strong> this Subject?</div> </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria-hidden="true"><i class="icon-remove icon-large"></i> Close</button> <a href="delete_teacher_course.php<?php echo '?id=' . $course_id; ?>" class="btn btn-danger"><i class="icon-trash icon-large"></i> Delete</a> </div> </div> <!-- end delete modal --> </tr> <?php } ?> </tbody> </table> <!-- end slider --> </div> </div> </div> <?php include('footer.php'); ?> </div> </div> </div> </body> </html> Edited by aquilina, 26 May 2014 - 04:43 PM. Hey guys, I've searched on Google for this and have had no luck, and you guys have been EXTREMELY helpful with a few of my previous questions! Alright the error I get is: Warning: Cannot modify header information - headers already sent by (output started at /****/header.php:6) in /***/*login.php on line 65 Errr.. After I posted this I saw the Sticky regarding Header posts.. I read the post and cannot find where the issue is with this.. The PHP code comes before the form information, am I missing something? My login.php script is: Code: [Select] <?php include("header.php"); mysql_connect("10.6.186.84", "gilmdiniz", "Gil19471947") or die(mysql_error()); mysql_select_db("gilmdiniz") or die(mysql_error()); if(isset($_COOKIE['ID_my_site'])) { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass != $info['password']) { } else echo "SUP";//header($hdir."files.php"); } } if (isset($_POST['submit'])) { if(!$_POST['username'] | !$_POST['pass']) die('<center>You did not fill in a required field! <br /> <a href="'.$hdir.'login.php"> Back to Login </a> </center>'); if (!get_magic_quotes_gpc()) $_POST['email'] = addslashes($_POST['email']); $check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error()); $check2 = mysql_num_rows($check); if ($check2 == 0) die('<center>This username does not exist in our database, sorry. <br /> <a href="'.$hdir.'login.php"> Back to Login </a> </center>'); while($info = mysql_fetch_array( $check )) { $_POST['pass'] = stripslashes($_POST['pass']); $info['password'] = stripslashes($info['password']); $_POST['pass'] = md5($_POST['pass']); if ($_POST['pass'] != $info['password']) die('<center>Incorrect password, please try again. <br /> <a href="'.$hdir.'login.php"> Back to Login </a> </center>'); else { $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['username'], $hour); setcookie(Key_my_site, $_POST['pass'], $hour); echo "SUP";//header($hdir."files.php"); } } } else { ?> <center> <a href="<?php echo $hdir .'index.php'; ?>"> Back to Home </a> <table border="1"> <tr><td> <center><h2>Login Information</h2></center> </td></tr> <tr><td> <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> <table border="0"> <tr><td> Username: </td><td> <input type="text" name="username" maxlength="40"> </td></tr> <tr><td> Password: </td><td> <input type="password" name="pass" maxlength="50"> </td></tr> <tr><td colspan="2" align="right"> <input type="submit" name="submit" value="Login"> </td></tr> </table> </form> </td></tr> </table> </center> <?php } ?> and my header.php script is: Code: [Select] <?php $hdir = "http://www.ondemandagents.com/NewSite_ALPHA/"; ?> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="<?php echo $hdir .'style.css'; ?>" /> </head> <body> <table width="920" cellspacing="0" cellpadding="10" border="0" align="center"> <tr> <td class="bodyline"> <table align="center" border="0" width="635" height="121" background="<?php echo $hdir .'images/logo.png'; ?>"> <tr> <td height="69"> <table border="0" width="635" height="106"> <tr> <td width="800" height="70"> </td> <td width="600" height="70"> </td> </tr> <tr> <td width="400" height="18"> </td> <td width="600" height="18"> <a href="<?php echo $hdir .'index.php'; ?>" style="text-decoration: none"> <img src="<?php echo $hdir .'images/icon_mini_home.gif'; ?>" width="12" height="13" border="0" alt="Home" hspace="3" /> <font face="Arial" color="#FFFFFF" size="2">Home </font></a> <a href="<?php echo $hdir .'files.php'; ?>" style="text-decoration: none"> <img src="<?php echo $hdir .'images/icon_mini_files.gif'; ?>" width="12" height="13" border="0" alt="Files" hspace="3" /> <font face="Arial" color="#FFFFFF" size="2">Files </font></a> <a href="<?php echo $hdir .'admin.php'; ?>" style="text-decoration: none"> <img src="<?php echo $hdir .'images/icon_mini_login.gif'; ?>" width="12" height="13" border="0" alt="Administration" hspace="3" /> <font face="Arial" color="#FFFFFF" size="2">Administration</font></a> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> I have been using a header file in all my pages and scripts so far so that I wouldn't have to keep typing repetitive code.. Help is MUCH appreciated! Thanks in advance guys i Have a php code... Code: [Select] <?php session_start(); if(@$_SESSION['ls']!=="loggedin" ) { header('Location: login.php'); die (" "); } if($_GET['via']=="pre_pass") { $prepass=$_POST['currentpassword']; $newpass=$_POST['newpass']; $renewpass=$_POST['renewpass']; /*$answer=$_POST['answer']; &newpassword=$_POST['newpassword']; */ if($prepass!=NULL && $newpass!=NULL && $renewpass!=NULL ) { if(strlen($prepass)==0 || strlen($newpass)==0 || strlen($renewpass)==0) { session_start(); $_SESSION['status']="Please fill out all the fields"; header('location:change_password.php?via=previous_password'); die(" "); } if(strlen($prepass)<6 || strlen($newpass)<6 || strlen($renewpass)<6) { session_start(); $_SESSION['status']="All fields must have atleast 6 characters"; header('location:change_password.php?via=previous_password'); die(" "); } if(strcmp($newpass, $renewpass)!=0 && strlen($prepass)>=6 && strlen($newpass)>=6 && strlen($renewpass)>=6 ) { session_start(); $_SESSION['status']="New password does not match with each other"; header('location:change_password.php?via=previous_password'); die(" "); } if(strcmp($prepass, $newpass)==0) { session_start(); $_SESSION['status']="New password and Previous Password must be different"; header('location:change_password.php?via=previous_password'); die(" "); } mysql_connect ("localhost:3306", "feadmin1","lycosanmamba" ) or die ('Error connecting database'); mysql_select_db ("fe_user_info"); $reguserpassword = stripslashes($prepass); $reguserpassword = mysql_real_escape_string($reguserpassword); $newpass = stripslashes($newpass); $newpass = mysql_real_escape_string($newpass); $sql = "select * from user_info where id='$_SESSION[id]' and password='$reguserpassword'"; $res=mysql_query($sql); $count=mysql_num_rows($res); if($count=='1') { $query= "UPDATE user_info SET password='".$newpass."' WHERE id='$_SESSION[id]'"; mysql_query($query); session_start(); $_SESSION['status']="Password Successfully Changed"; $_SESSION['mail']="positive"; include("mail/pasword_change_verify_mail.php"); header('location:change_password.php?via=previous_password'); die(" "); } if($count!='1') { session_start(); $_SESSION['status']="Password you entered does not match with our records"; header('location:change_password.php?via=previous_password'); die(" "); } } } if($_GET['via']=="sec_ques") { $answer=$_POST['answer']; $newpassword=$_POST['newpassword']; if($answer!=NULL && $newpassword!=NULL) { include('db_connectivity.php'); $sql2 = "select * from user_info where id='$_SESSION[id]' and security_answer='$answer'"; $res2=mysql_query($sql2); $count2=mysql_num_rows($res2); if(strlen($newpassword)<6) { session_start(); $_SESSION['status']="Password must have atleast 6 characters"; header('location:change_password.php?via=security_question'); die(" "); } if($count2=='1') {include('db_connectivity.php'); $newpassword = stripslashes($newpassword); $newpassword = mysql_real_escape_string($newpassword); $query= "UPDATE user_info SET password='".$newpassword."' WHERE id='$_SESSION[id]'"; mysql_query($query); session_start(); $_SESSION['status']="Password Successfully Changed"; $_SESSION['mail']="positive"; include("mail/pasword_change_verify_mail.php"); header('location:change_password.php?via=security_question'); die(" "); } else { session_start(); $_SESSION['status']="Answer to this security question is incorrect"; header('location:change_password.php?via=security_question'); die(" "); } } } ?> but when i run this code it shows me the error.. Warning: Cannot modify header information - headers already sent by (output started at C:.................................:2) in C:\...............................\verify_change_password.php on line 118 CODE BETWEEN LINE 110-120 is Code: [Select] $newpassword = mysql_real_escape_string($newpassword); $query= "UPDATE user_info SET password='".$newpassword."' WHERE id='$_SESSION[id]'"; mysql_query($query); session_start(); $_SESSION['status']="Password Successfully Changed"; $_SESSION['mail']="positive"; include("mail/pasword_change_verify_mail.php"); header('location:change_password.php?via=security_question'); die(" "); } and code of tp 5 line is : Code: [Select] <?php session_start(); if(@$_SESSION['ls']!=="loggedin" ) { header('Location: login.php'); die (" "); } Hey Everyone... First off, I am only a young web developer and i'm working on a school project and am making a text-based game online... Now what i'm having trouble with... I want a drop-down list that has a list of characters classes Clubber Mixer Sauceror Tamer And I want whatever is selected to be placed into the database along with the username/password (THIS ALL WORKS FINE JUST NOT THE DROP DOWN LIST) All help appreciated Why do i get this error when i put code for redirection on my php code :S Warning: Cannot modify header information - headers already sent by (output started at /home/dotars/public_html/shop/includes/functions.php:3) in /home/dotars/public_html/shop/includes/functions.php on line 20 This is that code on functions.php on line 20: function confirm_logged_in() { if (!logged_in()) { redirect_to("login.php"); } } function redirect_to($location = NULL) { if ($location != NULL) { header("Location: {$location}"); exit; } } And this is the code in the other php code: <?php require_once("includes/session.php"); ?> <?php require_once("includes/connection.php"); ?> <?php require_once("includes/functions.php"); ?> <?php confirm_logged_in(); ?> <!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=utf-8" /> <title>Untitled Document</title> </head> <body> <center> Text... </center> </body> </html> And confirm_logged_in() function is: So I have a login box in my header, which worked when i hosted it locally, but now everytime i try to login i get Cannot modify header information - headers already sent (output started at /home/content/06/7711706/html/index.php:15) in /home/content/06/7711706/html/includes/header.php on line 102 and 103 Which is the setcookie bit, not sure what i'm doing wrong though. Any idea what i'm doing wrong? Thanks Code: [Select] <?php include('variables/variables.php'); ?> <div id="header"> <?php include('includes/flash.php'); ?> <?php mysql_connect("XXXXXXXXX", "XXXXXXX", "XXXXXX") or die(mysql_error()); mysql_select_db("XXXXXXX") or die(mysql_error()); if(isset($_COOKIE['test'])) { $username = $_COOKIE['test']; $pass = $_COOKIE['pass']; $check = mysql_query("SELECT * FROM customers WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass != $info['password']) { } else { header("Location: members.php"); } } } if (isset($_POST['submit'])) { if(!$_POST['username'] | !$_POST['pass']) { die('You did not fill in a required field.'); } $check = mysql_query("SELECT * FROM customers WHERE username = '".$_POST['username']."'")or die(mysql_error()); $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That user does not exist in our database. <a href=reg.php>Click Here to Register</a>'); } while($info = mysql_fetch_array( $check )) { $_POST['pass'] = stripslashes($_POST['pass']); $info['password'] = stripslashes($info['password']); if ($_POST['pass'] != $info['password']) { die('Incorrect password, please try again.'); } else { $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(test, $_POST['username'], $hour); setcookie(pass, $_POST['pass'], $hour); header("Location: members.php"); } } } else { ?> <form action="<?php echo $_SERVER['includes/PHP_SELF']?>" method="post"> <table bgcolor="#6699FF" height="50" border="0" style="border:hidden" align="right"> <tr><td colspan=2 align="center"><h2>Login</h2></td></tr> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="40"> </td></tr> <tr><td>Password:</td><td> <input type="password" name="pass" maxlength="50"> </td></tr> <tr><td colspan="2" align="right"> <input type="submit" name="submit" value="Login"> </td></tr> </table> </form> <?php } ?></div> <body background="homebackground.jpg"> <style type="text/css"> <!-- A:link { COLOR: black; TEXT-DECORATION: none; font-weight: normal } A:visited { COLOR: black; TEXT-DECORATION: none; font-weight: normal } A:active { COLOR: green; TEXT-DECORATION: none } A:hover { COLOR: blue; TEXT-DECORATION: none; font-weight: none } --> </style> <?php include ("database.php"); //Checks if there is a login cookie if(isset($_COOKIE['ID_my_site'])) { $username = mysql_real_escape_string( $_COOKIE['ID_my_site'] ); $pass = mysql_real_escape_string( $_COOKIE['Key_my_site'] ); $check = mysql_query("SELECT * FROM users WHERE username = '$username' AND password = '$pass'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass == $info['password']) print("<meta http-equiv='Refresh' content='0;index.php' />"); } } //if the login form is submitted if (isset($_POST['submit'])) { // if form has been submitted // makes sure they filled it in if(!$_POST['username'] | !$_POST['pass']) die(' <body background="homebackground.jpg"><center><p><br><p><b> You did not fill in a required field, <a href="login.php"><b> click here to try again.</a></center></b></b> '); // checks it against the database if (!get_magic_quotes_gpc()) $_POST['email'] = addslashes($_POST['email']); $_POST['username'] = stripslashes($_POST['username']); $check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error()); //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) die(' <body background="homebackground.jpg"><center><p><br><p><b> That user does not exist in our database, <a href=add.php><b> click here to Register</a></b></b></center> '); while($info = mysql_fetch_array( $check )) { $_POST['pass'] = stripslashes($_POST['pass']); $_POST['pass'] = md5($_POST['pass']); //gives error if the password is wrong if ($_POST['pass'] != $info['password']) die(' <body background="homebackground.jpg"><center><p><br><p><b> Invalid password, <a href="login.php"><b>click here to try again.</b></b></a> '); else { // if login is ok then we add a cookie $_POST['username'] = stripslashes($_POST['username']); $_POST['password'] = stripslashes($_POST['password']); $hour = time() + 3600; setcookie("ID_my_site", $_POST['username'], $hour); setcookie("Key_my_site", $_POST['pass'], $hour); //then redirect them to the members area if ($pass == $info['password']) print "you have logged in."; print("<meta http-equiv='Refresh' content='0;index.php' />"); } } } else { // if they are not logged in ?> <?php include ("nav.php"); ?> <center> <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> <table border="0"> <tr><td colspan=2><h1> Log in</h1></td></tr> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="40"> </td></tr> <tr><td>Password:</td><td> <input type="password" name="pass" maxlength="50"> </td></tr> <tr><td colspan="2" align="right"> <input type="submit" name="submit" value="Login"> </td></tr> </table> </form> </center> <?php } ?> <HTML> <HEAD> <link rel="favicon.ico" href="***/favicon.ico"> <title> My site </title> </HEAD> <BODY> I understand the warning, but I don't get the issue on my local server, only on my live server. From what I can see in the outputted source is a space and also i'm assuming a newline, before the warning... I've traced every route in my code, no output what-so-ever. I can't believe the hosts would insert such characters. I've tried separate files within the root directory, an html and a php, neither output these characters. Eventually I commented out the inclusion of modules one by one and found that the error should be in a specific one of these... Now going through I can't find any 'echo' or 'print' statements. Everything is within functions, and this error happens before anything is called, just included. There are no erroneous spaces before or after php code tags. What else would / could produce output? (and why no issue on local server?) EDIT: There is no use of 'output buffering' either... I get an error stating that I cannot modify header information when I try to add a title to my login page. Here's <?php session_start(); require_once("includes/dbconn.php"); include("includes/htmlheader.php"); mysql_select_db(center); $user = $_POST['username']; $pass = $_POST['password']; $sql = "select username, password from users"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $isuser = $row['username']; $ispass = $row['password']; if(isset($_POST['submit'])){ if(($user==$isuser)&&($pass==$ispass)) { $_SESSION['username'] = $user; header("Location: home.php"); }else{ echo "Invalid Username or Password"; } } ?> The htmlheader.php has the title string. Help is appreciated Hello,
I have an error on multiple pages which looks much like this. If anyone can help that would be gratefully appreciated. I would also like to ask if you may give me an explanation as to why it is occurring and not just a solution. Also when I take the second header out the error disappears.
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\blog\blog_display_post.php:47) in C:\xampp\htdocs\blog\comments.php on line 49
Here is my code:
if(strlen($email) > 5){
mysqli_query($con, "INSERT INTO emails (email) VALUES ('$email')"); This script works well as far as getting the form information onto the database but for some reason the confirmation email is not being sent to the user. Could someone take a quick look at my script? Please? I've attached the included files as well. I guess I just need another set of eyes to look over this script. It would be much appreciated <?php // Created BY Adam Khoury @ www.developphp.com // let's initialize vars to be printed to page in the HTML section so our script does not return errors // they must be initialized in some server environments $errorMsg = ""; $firstname = ""; $lastname = ""; $country = ""; $state = ""; $city = ""; $zip = ""; $website = ""; $youtube = ""; $email1 = ""; $email2 = ""; $pass1 = ""; $pass2 = ""; // This code runs only if the form submit button is pressed if (isset ($_POST['firstname'])){ /* Example of cleaning variables in a loop $vars = ""; foreach ($_POST as $key => $value) { $value = stripslashes($value); $vars .= "$key = $value<br />"; } print "$vars"; exit(); */ $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $country = $_POST['country']; $state = $_POST['state']; $city = $_POST['city']; $zip = $_POST['zip']; $website = $_POST['website']; $youtube = $_POST['youtube']; $email1 = $_POST['email1']; $email2 = $_POST['email2']; $pass1 = $_POST['pass1']; $pass2 = $_POST['pass2']; $humancheck = $_POST['humancheck']; $firstname = stripslashes($firstname); $lastname = stripslashes($lastname); $state = stripslashes($state); $city = stripslashes($city); $zip = stripslashes($zip); $website = stripslashes($website); $youtube = stripslashes($youtube); $email1 = stripslashes($email1); $pass1 = stripslashes($pass1); $email2 = stripslashes($email2); $pass2 = stripslashes($pass2); $firstname = strip_tags($firstname); $lastname = strip_tags($lastname); $state = strip_tags($state); $city = strip_tags($city); $zip = strip_tags($zip); $website = strip_tags($website); $youtube = strip_tags($youtube); $email1 = strip_tags($email1); $pass1 = strip_tags($pass1); $email2 = strip_tags($email2); $pass2 = strip_tags($pass2); // Connect to database include_once "connect_to_mysql.php"; $emailCHecker = mysql_real_escape_string($email1); $emailCHecker = eregi_replace("`", "", $emailCHecker); // Database duplicate e-mail check setup for use below in the error handling if else conditionals mysql_select_db("perry100_users", $myConnection); $sql_email_check = mysql_query("SELECT email FROM myMembers WHERE email='$emailCHecker'", $myConnection); $email_check = mysql_num_rows($sql_email_check);// or die(mysql_error()); // Error handling for missing data if ((!$firstname) || (!$lastname) || (!$country) || (!$state) || (!$city) || (!$zip) || (!$email1) || (!$email2) || (!$pass1) || (!$pass2)) { $errorMsg = 'ERROR: You did not submit the following required information:<br /><br />'; if(!$firstname){ $errorMsg .= ' * First Name<br />'; } if(!$lastname){ $errorMsg .= ' * Last Name<br />'; } if(!$country){ $errorMsg .= ' * Country<br />'; } if(!$state){ $errorMsg .= ' * State or Provice<br />'; } if(!$city){ $errorMsg .= ' * City<br />'; } if(!$zip){ $errorMsg .= ' * Postal or Zip Code<br />'; } if(!$email1){ $errorMsg .= ' * Email Address<br />'; } if(!$email2){ $errorMsg .= ' * Confirm Email Address<br />'; } if(!$pass1){ $errorMsg .= ' * Login Password<br />'; } if(!$pass2){ $errorMsg .= ' * Confirm Login Password<br />'; } } else if ($email1 != $email2) { $errorMsg = 'ERROR: Your Email fields below do not match<br />'; } else if ($pass1 != $pass2) { $errorMsg = 'ERROR: Your Password fields below do not match<br />'; } else if ($humancheck != "") { $errorMsg = 'ERROR: The Human Check field must be cleared to be sure you are human<br />'; } else if ($email_check > 0){ $errorMsg = "<u>ERROR:</u><br />Your Email address is already in use inside our database. Please use another.<br />"; } else { // Error handling is ended, process the data and add member to database //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $firstname = mysql_real_escape_string($firstname); $lastname = mysql_real_escape_string($lastname); $state = mysql_real_escape_string($state); $city = mysql_real_escape_string($city); $zip = mysql_real_escape_string($zip); $website = mysql_real_escape_string($website); $youtube = mysql_real_escape_string($youtube); $email1 = mysql_real_escape_string($email1); $pass1 = mysql_real_escape_string($pass1); $firstname = eregi_replace("`", "", $firstname); $lastname = eregi_replace("`", "", $lastname); $state = eregi_replace("`", "", $state); $city = eregi_replace("`", "", $city); $zip = eregi_replace("`", "", $zip); $website = eregi_replace("`", "", $website); $youtube = eregi_replace("`", "", $youtube); $email1 = eregi_replace("`", "", $email1); $pass1 = eregi_replace("`", "", $pass1); $website = eregi_replace("http://", "", $website); $youtube = eregi_replace("http://www.youtube.com/user/", "", $youtube); // Add MD5 Hash to the password variable $db_password = md5($pass1); // Add user info into the database table for the main site table(knirv.com) $sql = mysql_query("INSERT INTO myMembers (firstname, lastname, country, state, city, zip, email, password, sign_up_date, website, youtube) VALUES('$firstname','$lastname','$country','$state','$city','$zip','$email1','$db_password', now(),'$website','$youtube')") or die (mysql_error()); $id = mysql_insert_id(); // Create directory(folder) to hold each user's files(pics, MP3s, etc.) mkdir("members/$id", 0755); //!!!!!!!!!!!!!!!!!!!!!!!!! Email User the activation link !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $myemail = "admin@knirv.com"; $emess = "First Name: $firstname\n"; $emess.= "Last Name: $lastname\n"; $emess.= "Email 1: $email1\n"; $emess.= "Email 2: $email2\n"; $emess.= "City: $city\nState: $state\nZip/Post Code:$zip\n"; $emess.= "Country: $scountry\n"; $emess.= "Phone number 1: $phone1\n"; $emess.= "Phone number 2: $phone2\n"; $emess.= "Phone number 3: $phone3\n"; $emess.= "Comments: $sendmail"; $ehead = "From: $myemail\r\n"; $subj = "Complete knirv.com registration!"; $mailsend=mail("$myemail","$subj","$emess","$ehead"); //Begin HTML Email Message $message = "Hi $firstname, Complete this step to activate your login identity at knirv.com. Click the line below to activate when ready. http://www.knirv.com/activation.php?id=$id&sequence=$db_password If the URL above is not an active link, please copy and paste it into your browser address bar Login after successful activation using your: E-mail Address: $email Password: $password See you on the site! admin@knirv.com"; //end of message unset($_GET['do']); header("Location: thank_you.php"); break; } $msgToUser = "<h2>One Last Step - Activate through Email</h2><h4>OK $firstname, one last step to verify your email identity:</h4><br /> In a moment you will be sent an Activation link to your email address.<br /><br /> <br /> <strong><font color=\"#990000\">VERY IMPORTANT:</font></strong> If you check your email with your host providers default email application, there may be issues with seeing the email contents. If this happens to you and you cannot read the message to activate, download the file and open using a text editor. If you still cannot see the activation link, contact site admin and briefly discuss the issue.<br /><br /> "; include_once 'msgToUser.php'; exit(); } // Close else after duplication checks else { // if the form is not posted with variables, place default empty variables $errorMsg = "Fields marked with an [ * ] are required"; $firstname = ""; $lastname = ""; $country = ""; $state = ""; $city = ""; $zip = ""; $website = ""; $youtube = ""; $email1 = ""; $email2 = ""; $pass1 = ""; $pass2 = ""; } ?> <!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" /> <meta name="Kinetic Network" content="Register to knirv.com" /> <meta name="Knirv Registration" content="register, www.knirv.com" /> <meta name="rating" content="General" /> <title>Register Your Account</title> <link rel="icon" href="favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> <style type="text/css"> <!-- .style26 {color: #FF0000} .style28 {font-size: 14px} .brightRed { color: #F00; } .textSize_9px { font-size: 9px; } --> </style> <link href="CSS/site_layout.css" rel="stylesheet" type="text/css" /> </head> <body> <?php include_once "header_template.php"; if ($message) echo "<p>$message</p>"; ?> <table width="950" align="center"> <tr> <td width="758"> <blockquote> <h2><br /> Create Your Account Below </h2> </blockquote> <table width="600" align="center" cellpadding="5"> <form action="register.php" method="post" enctype="multipart/form-data"> <tr> <td width="125" class="style7"><div align="center"><strong>Please Do First →</strong></div></td> <td width="447" bgcolor="#FFFFFF">Add <a href="mailto:admin@yknirv.com"><u>admin@knirv.com</u></a> to your email white list or safe sender list now, or else you might not get the activation email that is necessary for logging in successfully. </td> </tr> <tr> <td colspan="2"><font color="#FF0000"><?php print "$errorMsg"; ?></font></td> </tr> <tr> <td align="right" class="alignRt">First Name:<span class="brightRed"> *</span></td> <td><input name="firstname" type="text" class="formFields" id="firstname" value="<?php print "$firstname"; ?>" size="32" maxlength="20" /></td> </tr> <tr> <td align="right" class="alignRt">Last Name:<span class="brightRed"> *</span></td> <td><input name="lastname" type="text" class="formFields" id="lastname" value="<?php print "$lastname"; ?>" size="32" maxlength="20" /></td> </tr> <tr> <td align="right" class="alignRt">Country:<span class="brightRed"> *</span></td> <td> <select name="country" class="formFields"> <option value="<?php print "$country"; ?>"><?php print "$country"; ?></option> <option value="United States of America">United States of America</option> <option value="Afghanistan">Afghanistan</option> <option value="Albania">Albania</option> <option value="Algeria">Algeria</option> <option value="American Samoa">American Samoa</option> <option value="Andorra">Andorra</option> <option value="Angola">Angola</option> <option value="Anguilla">Anguilla</option> <option value="Antigua and Barbuda">Antigua and Barbuda</option> <option value="Argentina">Argentina</option> <option value="Armenia">Armenia</option> <option value="Aruba">Aruba</option> <option value="Australia">Australia</option> <option value="Austria">Austria</option> <option value="Azerbaijan">Azerbaijan</option> <option value="Bahamas">Bahamas</option> <option value="Bahrain">Bahrain</option> <option value="Bangladesh">Bangladesh</option> <option value="Barbados">Barbados</option> <option value="Belarus">Belarus</option> <option value="Belgium">Belgium</option> <option value="Belize">Belize</option> <option value="Benin">Benin</option> <option value="Bermuda">Bermuda</option> <option value="Bhutan">Bhutan</option> <option value="Bolivia">Bolivia</option> <option value="Bonaire">Bonaire</option> <option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option> <option value="Botswana">Botswana</option> <option value="Brazil">Brazil</option> <option value="British Indian Ocean Ter">British Indian Ocean Ter</option> <option value="Brunei">Brunei</option> <option value="Bulgaria">Bulgaria</option> <option value="Burkina Faso">Burkina Faso</option> <option value="Burundi">Burundi</option> <option value="Cambodia">Cambodia</option> <option value="Cameroon">Cameroon</option> <option value="Canada">Canada</option> <option value="Canary Islands">Canary Islands</option> <option value="Cape Verde">Cape Verde</option> <option value="Cayman Islands">Cayman Islands</option> <option value="Central African Republic">Central African Republic</option> <option value="Chad">Chad</option> <option value="Channel Islands">Channel Islands</option> <option value="Chile">Chile</option> <option value="China">China</option> <option value="Christmas Island">Christmas Island</option> <option value="Cocos Island">Cocos Island</option> <option value="Columbia">Columbia</option> <option value="Comoros">Comoros</option> <option value="Congo">Congo</option> <option value="Cook Islands">Cook Islands</option> <option value="Costa Rica">Costa Rica</option> <option value="Cote D'Ivoire">Cote D'Ivoire</option> <option value="Croatia">Croatia</option> <option value="Cuba">Cuba</option> <option value="Curacao">Curacao</option> <option value="Cyprus">Cyprus</option> <option value="Czech Republic">Czech Republic</option> <option value="Denmark">Denmark</option> <option value="Djibouti">Djibouti</option> <option value="Dominica">Dominica</option> <option value="Dominican Republic">Dominican Republic</option> <option value="East Timor">East Timor</option> <option value="Ecuador">Ecuador</option> <option value="Egypt">Egypt</option> <option value="El Salvador">El Salvador</option> <option value="Equatorial Guinea">Equatorial Guinea</option> <option value="Eritrea">Eritrea</option> <option value="Estonia">Estonia</option> <option value="Ethiopia">Ethiopia</option> <option value="Falkland Islands">Falkland Islands</option> <option value="Faroe Islands">Faroe Islands</option> <option value="Fiji">Fiji</option> <option value="Finland">Finland</option> <option value="France">France</option> <option value="French Guiana">French Guiana</option> <option value="French Polynesia">French Polynesia</option> <option value="French Southern Ter">French Southern Ter</option> <option value="Gabon">Gabon</option> <option value="Gambia">Gambia</option> <option value="Georgia">Georgia</option> <option value="Germany">Germany</option> <option value="Ghana">Ghana</option> <option value="Gibraltar">Gibraltar</option> <option value="Great Britain">Great Britain</option> <option value="Greece">Greece</option> <option value="Greenland">Greenland</option> <option value="Grenada">Grenada</option> <option value="Guadeloupe">Guadeloupe</option> <option value="Guam">Guam</option> <option value="Guatemala">Guatemala</option> <option value="Guinea">Guinea</option> <option value="Guyana">Guyana</option> <option value="Haiti">Haiti</option> <option value="Hawaii">Hawaii</option> <option value="Honduras">Honduras</option> <option value="Hong Kong">Hong Kong</option> <option value="Hungary">Hungary</option> <option value="Iceland">Iceland</option> <option value="India">India</option> <option value="Indonesia">Indonesia</option> <option value="Iran">Iran</option> <option value="Iraq">Iraq</option> <option value="Ireland">Ireland</option> <option value="Isle of Man">Isle of Man</option> <option value="Israel">Israel</option> <option value="Italy">Italy</option> <option value="Jamaica">Jamaica</option> <option value="Japan">Japan</option> <option value="Jordan">Jordan</option> <option value="Kazakhstan">Kazakhstan</option> <option value="Kenya">Kenya</option> <option value="Kiribati">Kiribati</option> <option value="Korea North">Korea North</option> <option value="Korea South">Korea South</option> <option value="Kuwait">Kuwait</option> <option value="Kyrgyzstan">Kyrgyzstan</option> <option value="Laos">Laos</option> <option value="Latvia">Latvia</option> <option value="Lebanon">Lebanon</option> <option value="Lesotho">Lesotho</option> <option value="Liberia">Liberia</option> <option value="Libya">Libya</option> <option value="Liechtenstein">Liechtenstein</option> <option value="Lithuania">Lithuania</option> <option value="Luxembourg">Luxembourg</option> <option value="Macau">Macau</option> <option value="Macedonia">Macedonia</option> <option value="Madagascar">Madagascar</option> <option value="Malaysia">Malaysia</option> <option value="Malawi">Malawi</option> <option value="Maldives">Maldives</option> <option value="Mali">Mali</option> <option value="Malta">Malta</option> <option value="Marshall Islands">Marshall Islands</option> <option value="Martinique">Martinique</option> <option value="Mauritania">Mauritania</option> <option value="Mauritius">Mauritius</option> <option value="Mayotte">Mayotte</option> <option value="Mexico">Mexico</option> <option value="Midway Islands">Midway Islands</option> <option value="Moldova">Moldova</option> <option value="Monaco">Monaco</option> <option value="Mongolia">Mongolia</option> <option value="Montserrat">Montserrat</option> <option value="Morocco">Morocco</option> <option value="Mozambique">Mozambique</option> <option value="Myanmar">Myanmar</option> <option value="Nambia">Nambia</option> <option value="Nauru">Nauru</option> <option value="Nepal">Nepal</option> <option value="Netherland Antilles">Netherland Antilles</option> <option value="Netherlands">Netherlands</option> <option value="Nevis">Nevis</option> <option value="New Caledonia">New Caledonia</option> <option value="New Zealand">New Zealand</option> <option value="Nicaragua">Nicaragua</option> <option value="Niger">Niger</option> <option value="Nigeria">Nigeria</option> <option value="Niue">Niue</option> <option value="Norfolk Island">Norfolk Island</option> <option value="Norway">Norway</option> <option value="Oman">Oman</option> <option value="Pakistan">Pakistan</option> <option value="Palau Island">Palau Island</option> <option value="Palestine">Palestine</option> <option value="Panama">Panama</option> <option value="Papua New Guinea">Papua New Guinea</option> <option value="Paraguay">Paraguay</option> <option value="Peru">Peru</option> <option value="Philippines">Philippines</option> <option value="Pitcairn Island">Pitcairn Island</option> <option value="Poland">Poland</option> <option value="Portugal">Portugal</option> <option value="Puerto Rico">Puerto Rico</option> <option value="Qatar">Qatar</option> <option value="Reunion">Reunion</option> <option value="Romania">Romania</option> <option value="Russia">Russia</option> <option value="Rwanda">Rwanda</option> <option value="St Barthelemy">St Barthelemy</option> <option value="St Eustatius">St Eustatius</option> <option value="St Helena">St Helena</option> <option value="St Kitts-Nevis">St Kitts-Nevis</option> <option value="St Lucia">St Lucia</option> <option value="St Maarten">St Maarten</option> <option value="St Pierre and Miquelon">St Pierre and Miquelon</option> <option value="St Vincent and Grenadines">St Vincent and Grenadines</option> <option value="Saipan">Saipan</option> <option value="Samoa">Samoa</option> <option value="Samoa American">Samoa American</option> <option value="San Marino">San Marino</option> <option value="Sao Tome and Principe">Sao Tome and Principe</option> <option value="Saudi Arabia">Saudi Arabia</option> <option value="Senegal">Senegal</option> <option value="Seychelles">Seychelles</option> <option value="Serbia and Montenegro">Serbia and Montenegro</option> <option value="Sierra Leone">Sierra Leone</option> <option value="Singapore">Singapore</option> <option value="Slovakia">Slovakia</option> <option value="Slovenia">Slovenia</option> <option value="Solomon Islands">Solomon Islands</option> <option value="Somalia">Somalia</option> <option value="South Africa">South Africa</option> <option value="Spain">Spain</option> <option value="Sri Lanka">Sri Lanka</option> <option value="Sudan">Sudan</option> <option value="Suriname">Suriname</option> <option value="Swaziland">Swaziland</option> <option value="Sweden">Sweden</option> <option value="Switzerland">Switzerland</option> <option value="Syria">Syria</option> <option value="Tahiti">Tahiti</option> <option value="Taiwan">Taiwan</option> <option value="Tajikistan">Tajikistan</option> <option value="Tanzania">Tanzania</option> <option value="Thailand">Thailand</option> <option value="Togo">Togo</option> <option value="Tokelau">Tokelau</option> <option value="Tonga">Tonga</option> <option value="Trinidad and Tobago">Trinidad and Tobago</option> <option value="Tunisia">Tunisia</option> <option value="Turkey">Turkey</option> <option value="Turkmenistan">Turkmenistan</option> <option value="Turks and Caicos Is">Turks and Caicos Is</option> <option value="Tuvalu">Tuvalu</option> <option value="Uganda">Uganda</option> <option value="Ukraine">Ukraine</option> <option value="United Arab Emirates">United Arab Emirates</option> <option value="United Kingdom">United Kingdom</option> <option value="United States of America">United States of America</option> <option value="Uruguay">Uruguay</option> <option value="Uzbekistan">Uzbekistan</option> <option value="Vanuatu">Vanuatu</option> <option value="Vatican City State">Vatican City State</option> <option value="Venezuela">Venezuela</option> <option value="Vietnam">Vietnam</option> <option value="Virgin Islands (Brit)">Virgin Islands Brit</option> <option value="Virgin Islands (USA)">Virgin Islands USA</option> <option value="Wake Island">Wake Island</option> <option value="Wallis and Futana Is">Wallis and Futana Is</option> <option value="Yemen">Yemen</option> <option value="Zaire">Zaire</option> <option value="Zambia">Zambia</option> <option value="Zimbabwe">Zimbabwe</option> </select> </td> </tr> <tr> <td align="right" class="alignRt">State/Province: <span class="brightRed">*</span></td> <td><input name="state" type="text" class="formFields" id="state" value="<?php print "$state"; ?>" size="32" maxlength="36" /></td> </tr> <tr> <td align="right" class="alignRt">City: <span class="brightRed">*</span></td> <td><input name="city" type="text" class="formFields" id="city" value="<?php print "$city"; ?>" size="32" maxlength="36" /></td> </tr> <tr> <td align="right" class="alignRt">Postal / Zip Code: <span class="brightRed">*</span></td> <td><input name="zip" type="text" class="formFields" id="zip" value="<?php print "$zip"; ?>" size="32" maxlength="24" /></td> </tr> <tr> <td align="right" class="alignRt">Website:</td> <td><strong>http://</strong> <input name="website" type="text" class="formFields" id="website" value="<?php print "$website"; ?>" size="40" maxlength="88" /></td> </tr> <tr> <td align="right" class="alignRt">Youtube Channel:</td> <td><strong>http://www.youtube.com/user/</strong> <input name="youtube" type="text" class="formFields" id="youtube" value="<?php print "$youtube"; ?>" size="32" maxlength="88" /></td> </tr> <tr> <td align="right" class="alignRt">Email Address: <span class="brightRed">*</span></td> <td><input name="email1" type="text" class="formFields" id="email1" value="<?php print "$email1"; ?>" size="32" maxlength="48" /></td> </tr> <tr> <td align="right" class="alignRt">Confirm Email:<span class="brightRed"> *</span></td> <td><input name="email2" type="text" class="formFields" id="email2" value="<?php print "$email2"; ?>" size="32" maxlength="48" /></td> </tr> <tr> <td align="right" class="alignRt">Create Password:<span class="brightRed"> *</span></td> <td><input name="pass1" type="password" class="formFields" id="pass1" maxlength="16" /> <span class="textSize_9px"><span class="greyColor">Alphanumeric Characters Only</span></span></td> </tr> <tr> <td align="right" class="alignRt">Confirm Password:<span class="brightRed"> *</span></td> <td><input name="pass2" type="password" class="formFields" id="pass2" maxlength="16" /> <span class="textSize_9px"><span class="greyColor">Alphanumeric Characters Only</span></span></td> </tr> <tr> <td align="right" class="alignRt"><br /> Human Check: <span class="brightRed">*</span></td> <td><br /> <input name="humancheck" type="text" class="formFields" id="humancheck" value="Please remove all of this text" size="38" maxlength="32" /> </td> </tr> <tr> <td> </td> <td><p><br /> <input type="submit" name="Submit3" value="Submit Form" /> </p></td> </tr> </form> </table> <br /> <br /></td> <td width="180" valign="top"><?php include_once "right_AD_template.php"; ?></td> </tr> </table> <?php include_once "footer_template.php"; ?> </body> </html> I am getting this error: Warning: Cannot modify header information - headers already sent by on my pvp.php script, this is it: <?PHP include('top.php'); if(!isset($_SESSION['UsersID'])) { echo "You need to be logged into view this page."; include('bottom.php'); exit; } if(isset($_POST['battleplayer'])) { $battleplayer=$_POST['battleplayer']; if($_POST['battlepick']=="username") { $Battling_Result=mysql_query("SELECT * FROM users WHERE Username='$battleplayer'"); $Battling_Rows=mysql_fetch_array($Battling_Result); $battleplayer=$Battling_Rows['ID']; } elseif($_POST['battlepick']=="id") { $Battling_Result=mysql_query("SELECT * FROM users WHERE ID='$battleplayer'"); $Battling_Rows=mysql_fetch_array($Battling_Result); } if(!empty($Battling_Rows)) { $Enemy_ID=$Battling_Rows['ID']; $Enemy_Name=$Battling_Rows['Username']; $Enemy_Level=$Battling_Rows['Level']; $Enemy_HP=$Battling_Rows['HP']; $Enemy_MHP=$Battling_Rows['Max_HP']; $Enemy_Energy=$Battling_Rows['Energy']; $Enemy_MEnergy=$Battling_Rows['Max_Energy']; $Battling_Result2=mysql_query("SELECT * FROM items WHERE Owner='$battleplayer' AND Slot='1'"); $Battling_Rows2=mysql_fetch_array($Battling_Result2); $Battling_Result3=mysql_query("SELECT * FROM items WHERE Owner='$battleplayer' AND Slot='2'"); $Battling_Rows3=mysql_fetch_array($Battling_Result3); $Battling_Result4=mysql_query("SELECT * FROM items WHERE Owner='$battleplayer' AND Slot='3'"); $Battling_Rows4=mysql_fetch_array($Battling_Result4); $Battling_Result5=mysql_query("SELECT * FROM items WHERE Owner='$battleplayer' AND Slot='4'"); $Battling_Rows5=mysql_fetch_array($Battling_Result5); $Battling_Result6=mysql_query("SELECT * FROM items WHERE Owner='$battleplayer' AND Slot='5'"); $Battling_Rows6=mysql_fetch_array($Battling_Result6); $Enemy_Attack1=$Battling_Rows2['Name']; $Enemy_Attack2=$Battling_Rows3['Name']; $Enemy_Attack3=$Battling_Rows4['Name']; $Enemy_Attack4=$Battling_Rows5['Name']; $Enemy_Attack5=$Battling_Rows6['Name']; $Enemy_Power=$Battling_Rows['Power']; $Enemy_Defense=$Battling_Rows['Defense']; $Enemy_Magic=$Battling_Rows['Magic']; $Enemy_Race=$Battling_Rows['Race']; $Enemy_Class=$Battling_Rows['Class']; $Battle_Start="No"; $User_ID=$_SESSION['UsersID']; mysql_query("DELETE from battle_info WHERE User_ID='$User_ID'"); mysql_query("INSERT into battle_info(Enemy_ID, Enemy_Name, Enemy_Level, Enemy_HP, Enemy_MHP, Enemy_Energy, Enemy_MEnergy, Enemy_Attack1, Enemy_Attack2, Enemy_Attack3, Enemy_Attack4, Enemy_Attack5, Enemy_Power, Enemy_Defense, Enemy_Magic, Enemy_Race, Enemy_Class, Battle_Start, User_ID) VALUES('$Enemy_ID', '$Enemy_Name', '$Enemy_Level', '$Enemy_HP', '$Enemy_MHP', '$Enemy_Energy', '$Enemy_MEnergy', '$Enemy_Attack1', '$Enemy_Attack2', '$Enemy_Attack3', '$Enemy_Attack4', '$Enemy_Attack5', '$Enemy_Power', '$Enemy_Defense', '$Enemy_Magic', '$Enemy_Race', '$Enemy_Class', '$Battle_Start', '$User_ID')") or die(mysql_error()); header('Location: battle.php'); } else { echo "This user does not exist.<br />"; echo "Enter the Username/ID of the person you want to battle below:"; echo "<br /><form method='POST'><input type='text' name='battleplayer'><select name='battlepick'><option value='username'>Username</option><option value='id'>ID</option></select>"; echo "<br /><input type='submit' name='Submit' id='Submit' value='Submit' onclick='this.disabled=true; this.form.submit;'>"; echo "</form>"; } } else { echo "Enter the Username/ID of the person you want to battle below:"; echo "<br /><form method='POST'><input type='text' name='battleplayer'><select name='battlepick'><option value='username'>Username</option><option value='id'>ID</option></select>"; echo "<br /><input type='submit' name='Submit' id='Submit' value='Submit' onclick='this.disabled=true; this.form.submit;'>"; echo "</form>"; } include('bottom.php'); ?> and this is my top.php script: <?PHP include('connect.php'); $ID = $_SESSION['UsersID']; $ID = mysql_real_escape_string($ID); if (!isset($_SESSION['UsersID'])) { echo " <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"> <font face='verdana'> <head> <link rel='stylesheet' type='text/css' href='style.css'> </style> </head> <title>Shadow of the Eternal - Text Based RPG</title> <body> <div id='banner'><a href='index.php'><img src='banner.png'></a></div> <div id='quicklinks'>Test</div> <div id='leftmenu'> <ul> <li>Main <ul> <li><a href='index.php'>Home</a></li> <li><a href='login.php'>Login</a></li> <li><a href='signup.php'>Sign Up</a></li> </ul> </li> </ul></div> <div id='content'> </font>"; } else { echo " <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"> <font face='verdana'> <head> <link rel='stylesheet' type='text/css' href='style.css'> </style> </head> <title>Shadow of the Eternal - Text Based RPG</title> <body> <div id='banner'><a href='index.php'><img src='banner.png'></a></div> <div id='quicklinks'>Test</div> <div id='leftmenu'> <ul> <li>CryptoWare <ul> <li><a href='http://furiousflash.com'>Furious Flash</a></li> <li><a href='http://crypto-ware.com'>CryptoWare</a></li> </ul> </li> <li>Main <ul> <li><a href='index.php'>Home</a></li> <li><a href='viewcomments.php'>News Comments</a></li> <li><a href='logout.php'>Logout</a></li> <li><a href='http://furiousflash.com/forum'>Forums</a></li> </ul> </li> </ul></div> <div id='content'> </font>"; } ?> And just in case this is my connect.php script: <?PHP mysql_connect('localhost','*****','*****'); mysql_select_db('*****'); session_start(); ?> Any idea why? <?php header('Refresh: 5; URL=http://www.miraculousmedalapostolate.com'); exit(); ?> i dont know what to do with this! i have tried using other hosting and the code was working fine... please help me, i have been stuck on this problem for 2 days now. So last night I was changing the amount of posts I wanted on my Thesis Themed Wordpress blog. I went to click the Save button within wordpress and got this message on the next page. "Warning: Cannot modify header information - headers already sent by (output started at /home/content/50/8403650/html/wp-content/themes/thesis_18/custom/custom_functions.php:2) in /home/content/50/8403650/html/wp-includes/pluggable.php on line 934" Now my nav menu doesn't show up and when I go to archives, it gives me the same warning. Can someone please help me with this? Any help would be appreciated. I've added both custom_functions.php and pluggable.php as an attachment, I don't think it has anything to do with pluggable but added just in case. Thanks for your help. Briannyc [attachment deleted by admin] I am getting this error when I use this Code: [Select] header("Location: /"); to redirect to home page.I believe there is a javascript alert which come before this is called, that gives the below error, I cannot remove the alert so is there nay other way I can go about redirecting without giving me the below error ? Code: [Select] A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by (output started at /home/dsdsd/application/core/MY_Controller.php:dsdsds) Hello, Im having a little trouble with this coding I need it to goto this page after an if statement but get this dreaded error Warning: Cannot modify header information - headers already sent by (output started at /home/fightwa1/public_html/fightlivecommentaryrd1.php:15) in /home/fightwa1/public_html/fightlivecommentaryrd1.php on line 57 there are no whitespaces before or after the start and endin <?php, as previously read about. Really struggling with this problem, if anyone can help will be much appreciated. <script type="text/javascript"> I am having a problem with my login page when I set cookies I get this error. Quote Warning: Cannot modify header information - headers already sent by (output started at /login.php:10) in /loginform.php on line 66 Warning: Cannot modify header information - headers already sent by (output started at /login.php:10) in /loginform.php on line 67 Warning: Cannot modify header information - headers already sent by (output started at /login.php:10) in /loginform.php on line 68 Warning: Cannot modify header information - headers already sent by (output started at /login.php:10) in loginform.php on line 72 I do have ob_start() at the beginning and ob_flush() and the end but i still get the error <?phpinclude('config.php');ob_start();@session_start();if (!isset($_POST['login'])) {?><form method="post" action="<?php $_SERVER['PHP_SELF'] ?>"> <fieldset> <legend>Login</legend> <table> <tr> <td>Email </td> <td><input type="text" name="email" /></td> </tr> <tr> <td>Password </td> <td><input type="password" name="password" /></td> </tr> <tr> <td><input type="submit" name="login" value="Login" /></td> </tr> <tr> <td><a href="<?=$siteurl?>/register.php">Register</a></td> </tr> </table> </fieldset></form><?php}else{ //Declare some variables $email = secure($_POST['email']); $password = secure($_POST['password']); //Check if the form is filled out if (!$email || !$password) { echo 'Please fill out the form completely'; echo '<a href="'. $siteurl .'/login.php">Go Back</a>'; } else { $user = mysql_query("SELECT * FROM `users` WHERE email = '$email'"); if (! mysql_num_rows($user)) { echo 'That user doe not exist'; } else { //Encrypt the password $encpass = sha1($password . $salt); //Find the user $superquery = mysql_query("SELECT * FROM `users` WHERE email = '$email' AND password = '$encpass'"); if (mysql_num_rows($superquery) == 1) { //If the user is found, set the cookies setcookie("username", $email, 0); setcookie("password", $encpass, 0); setcookie("is_logged_in", true, 0); //send the user to the home page header("Location: " . $siteurl . "members.php"); } else { echo 'Password was incorrect. Please try again.'; } } }}ob_flush();?>() what am i doing wrong? |