Here is the top part of my code from line 1 to line 39Warning: Cannot add header information - headers already sent by (output started at /var/www/thefolder/new/index.php:11) in /var/www/thefolder/new/index.php on line 32
Warning: Cannot add header information - headers already sent by (output started at /var/www/thefolder/new/index.php:11) in /var/www/thefolder/new/index.php on line 33
Warning: Cannot add header information - headers already sent by (output started at /var/www/thefolder/new/index.php:11) in /var/www/thefolder/new/index.php on line 34
Code: Select all
<?php
session_start();
include("myconfig.php");
if (empty($_SESSION['valid_user']))
{
if (isset($_COOKIE["check"]))
{
// TestCookie exists
// now we get the rest of their information
$login=$_COOKIE["valid_user"];
$email=$_COOKIE["email"];
echo "login is $login and email is $email<BR>";
mysql_connect($DBhost,$DBuser,$DBpass) or
die("Unable to connect to database");
@mysql_select_db("webthings") or die("Unable to select
database");
$sqlquery = "SELECT * From wt_users where name='$login' and email='$email'";
$result=mysql_query($sqlquery);
$num=mysql_num_rows($result);
$i=0;
while ($i < $num) {
$valid_user=mysql_result($result,$i,'name');
$valid_user=htmlspecialchars($valid_user);
$email=mysql_result($result,$i,'email');
$fast=mysql_result($result,$i,'approved');
$trusted=mysql_result($result,$i,'password');
++$i;}
session_register("valid_user", "email", "fast", "trusted");
// update cookie for time expiration
setcookie("valid_user","$valid_user",604800,"/","www.coastgames.com");
setcookie("email","$email",604800,"/","www.coastgames.com");
setcookie("check","valid_user",604800,"/","www.coastgames.com");
}
else
{
// TestCookie does NOT exist do nothing
}
}
?>