Jump to content

Recommended Posts

Ok so I know this is a popular error and I've experienced it many times before, but it's driving me crazy and I can't find a solution. So i thought a fresh pair of eyes might be able to shed some light on it.

 

I'm just re-writing this particular piece of code and not changing a great deal. It works fine on the old page, but not on the new one. I haven't changed anything apart from stripping it right back to the basics.

 

I have included my config file at the top of the page.

 


<?php
// Turn php errors on / off
$errors = true;

if($errors){
ini_set('display_errors',1);
error_reporting(E_ALL);
}

// Get the redirect
if(isset($_GET['redirect'])){
$redirect = htmlspecialchars($_GET['redirect']);
}

if(isset($_COOKIE['authcode']) && isset($_COOKIE['userid'])){

// Get the auth code
$authcode = htmlspecialchars($_COOKIE['authcode']);

// Get the user id
$userid = htmlspecialchars($_COOKIE['userid']);

// Check auth code and user id against the database
$sql = "SELECT * FROM staff_newT WHERE staff_id = '$userid' AND staff_authcode = '$authcode'";
$result = mysql_query($sql);
$count = mysql_num_rows($result);

if($count == 1){
echo "Both match <br /><br />";
} else {
echo "Deleted <br /><br />";
// Delete authcode cookie.
setcookie("authcode", "", time() - 3600);

} // Check if the authcode and user id exist in the database

}
?>

Edited by andrew_biggart
Link to comment
https://forums.phpfreaks.com/topic/274523-headers-aready-sent-error/
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.