Jump to content

[SOLVED] Header Issue... I know I know..


virtuexru

Recommended Posts

OK So I read the sticky, but I am still stuck.. any ideas?

 

I'm logging in through index.php, before the header of index.php I have:

 

<?php

 

session_start();

 

if (isset($_POST['email']) && isset($_POST['password'])) {

 

include('login.php');

 

}

 

?>

 

This is my error:

 

Warning: Cannot modify header information - headers already sent by (output started at /**/**/public_html/config/connect.php:6) in /**/**/public_html/login.php on line 36

 

Warning: Cannot modify header information - headers already sent by (output started at /**/**/public_html/config/connect.php:6) in /**/**/public_html/login.php on line 50

 

The connect.php is this:

 

<?php

$connect = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname) or die("Unable to select database");

?> 

 

and on the login.php is:

 

setcookie ("member",$email,time()+172800,"/");
$member = $email;

/* In-case cookies are turned off, set the session */

$_SESSION['member'] = true;

/* Update login timer */

$qUpdate = "UPDATE xxx SET login = now() WHERE email='$email' AND password='$passwordencrypt' AND status='Y' ";
$rsUpdate = mysql_query($qUpdate);

if ($rsUpdate)
{
header("Location: profile.php");
}

Link to comment
Share on other sites

 

Warning: Cannot modify header information - headers already sent by (output started at /home2/virtuex7/public_html/config/connect.php:4) in /home2/virtuex7/public_html/login.php on line 33

 

Warning: Cannot modify header information - headers already sent by (output started at /home2/virtuex7/public_html/config/connect.php:4) in /home2/virtuex7/public_html/login.php on line 47

 

LINE 33:

 

setcookie ("member",$email,time()+172800,"/");

 

LINE 47:

 

header("Location: profile.php");

Link to comment
Share on other sites

ob_start(); //

 

declare on every page at the first line before the tags <META> or <HTML>..

 

this would cache headers informations..

So redirection would be possible..

 

I had the same problem with yours,,But as the forum had implied..Use "best practice" meaning code first before HTML..

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.