PHP Code:
Warning: Cannot modify header information - headers already sent by (output started at /home/honorsqu/public_html/sg1/cms/header.inc.php:58) in /home/honorsqu/public_html/sg1/cms/login.php on line 22
any one know how to fix this error?
i looked in header.inc.php and login.php and i cant seam to fine the error on thoes lines. but whan u refresh the page it says your loged in... any one know how to fix it??
header.inc.php
PHP Code:
<?php
session_start();
// set your infomation.
$dbhost='localhost';
$dbusername='***';
$dbuserpass='***';
$dbname='***';
// connect to the mysql database server.
mysql_connect ($dbhost, $dbusername, $dbuserpass);
if (!mysql_select_db($dbname)) die(mysql_error());
$limit_time = time() - 300;
$query2 = "DELETE FROM peep_online WHERE UNIX_TIMESTAMP(activity) <= $limit_time";
mysql_query($query2) or die(mysql_error());
$query = "SELECT COUNT(ip_address) as numrows FROM peep_online WHERE ip_address = '".$_SERVER['REMOTE_ADDR']."'";
$result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$numrows = $row['numrows'];
if($numrows == 0) {
if (!session_is_registered('s_username')){
$query1 = "INSERT INTO peep_online (activity,member,ip_address,refurl,user_agent) VALUES (now(),'n','{$_SERVER['REMOTE_ADDR']}','{$_SERVER['HTTP_REFERER']}','{$_SERVER['HTTP_USER_AGENT']}')";
mysql_query($query1)or die("Failed to insert for an unregistered user");
}else{
$query1 = "INSERT INTO peep_online(activity,member,ip_address,refurl,user_agent) VALUES (now(),'y','{$_SERVER['REMOTE_ADDR']}','{$_SERVER['HTTP_REFERER']}','{$_SERVER['HTTP_USER_AGENT']}')";
mysql_query($query1)or die("Failed to insert for a registered user");
}
}
$query = "SELECT COUNT(id) AS numrows FROM stats WHERE ip='".$_SERVER["REMOTE_ADDR"]."'";
$result = mysql_query($query) or die('Error, query failed');
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$numrows = $row['numrows'];
if ($numrows == 0)
{
mysql_query("INSERT INTO stats(ip)VALUES ('".$_SERVER["REMOTE_ADDR"]."')") or die('Error, query 3 failed');
}
$query1 = "UPDATE stats SET hits=hits+1 WHERE ip = '".$_SERVER['REMOTE_ADDR']."'";
mysql_query($query1) or die('Error, query 1 failed');
//rest of code below after
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Stargate Squad</title>
</head>
<body>
<table align="center" style="border: 1px solid #000000;" width="770" height="100%" bgcolor="#275F81" border="0" cellspacing="10" cellpadding="0">
<tr>
<td>
<table align="center" width="750" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="banner.jpg" width="750" height="150" /></td>
</tr>
</table>
<table align="center" width="750" style="border-left: 1px solid #000000;border-right: 1px solid #000000" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25" align="left" width="174" background="header.jpg" style="border-right:1px solid #000000;border-bottom:1px solid #000000;"> Navigation </td>
<td height="25" align="center" width="400" background="header.jpg" style="border-right:1px solid #000000;border-bottom:1px solid #000000;">News</td>
<td height="25" align="left" width="174" background="header.jpg" style="border-bottom:1px solid #000000;"> Polls </td>
</tr>
</table>
login.php:
PHP Code:
<?php include ('header.inc.php'); ?>
<?php include ('navigation.inc.php'); ?>
<?php include ('user.inc.php'); ?>
<?php include ('affiliate.inc.php'); ?>
<?php include ('stats.inc.php'); ?>
<?php
if ($_POST['username']) {
//did they supply a password and username
$username=$_POST['username'];
$password=$_POST['password'];
if ($password==NULL) {
echo "A password was not supplied";
}else{
$query = mysql_query("SELECT username,password FROM users WHERE username = '$username'") or die(mysql_error());
$data = mysql_fetch_array($query);
if($data['password'] != $password) {
echo "The supplied login is incorrect";
}else{
$query = mysql_query("SELECT username,password FROM users WHERE username = '$username'") or die(mysql_error());
$row = mysql_fetch_array($query);
$_SESSION["s_username"] = $row['username'];
header("header.inc.php");
}
}
}
?>
<td width="400" valign="top" align="left">
<table width="400" bgcolor="#2B5C86" border="0" cellspacing="0" cellpadding="0" style="border-left: 1px solid #000000;border-right: 1px solid #000000;border-bottom: 1px solid #000000;">
<tr>
<td align="center">
<table width="370" align="center" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><h1>Login</h1></td>
</tr>
<tr>
<form action="login.php" method="POST">
<td>
<table>
<tr>
<td>Username:</td><td align="right"><input type="text" size="15" maxlength="25" name="username"></td>
</tr>
<tr>
<td>Password:</td><td align="right"><input type="password" size="15" maxlength="25" name="password"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<a href="forgot.php">forgot your password or username?</a></td>
</tr>
</table>
</td>
<?php include ('other.inc.php'); ?>
<?php include ('footer.inc.php'); ?>
can some one plezz help me...
AIM: toofasttokill
MSN:
Keawepoo@msn.com
Xfire: acesg1
e-mail:
SG1@hawaii.rr.com
THX!