Go Back   Novahq.net Forum > Computers > Web design and Programming
FAQ Community Calendar Today's Posts Search

Web design and Programming Discuss website creation and other programming topics.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-10-2006, 09:25 PM
Ace-BH- is offline Ace-BH-
Registered User

Join Date: Feb 2004
Posts: 17

Send a message via AIM to Ace-BH-
CMS Login

PHP Code:
WarningCannot modify header information headers already sent by (output started at /home/honorsqu/public_html/sg1/cms/header.inc.php:58in /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($resultMYSQL_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($resultMYSQL_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;">&nbsp;Navigation&nbsp;</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;">&nbsp;Polls&nbsp;</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!
Reply With Quote
  #2  
Old 02-10-2006, 09:30 PM
DevilDog#1 is offline DevilDog#1

Join Date: Jul 2002
Posts: 7,040

Looks like

PHP Code:
    header("header.inc.php"); 
is causing issue.

Try moving it up
__________________








Quote:
If I don't do that doesn't mean I can't - DD#1

Last edited by DevilDog#1; 02-10-2006 at 09:36 PM.
Reply With Quote
  #3  
Old 02-10-2006, 10:08 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,921

You cannot output ANY html before sending headers like: cookies, sessions, or using the header() function. In your code you include header.inc.php which has html in it, and then you try and use header() after including that in the login code.

You can either move the html out of the header.inc.php file and put it in a seperate file and include it after you use the header() function

Or you can try putting this at the top of login.php, and any file where you want to use html before sending your headers

PHP Code:
If(function_exists("ini_set")) {
 @
ini_set("output_buffering","On");

or you can ask your host to set output_buffering to on in php.ini
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #4  
Old 02-13-2006, 08:03 PM
Ace-BH- is offline Ace-BH-
Registered User

Join Date: Feb 2004
Posts: 17

Send a message via AIM to Ace-BH-
ok, can u put that into a file? like show me what it shud look like? or give me the line #... plezz thx!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
looking for a CMS / blog site thing :/ Steve Web design and Programming 15 04-21-2006 03:25 PM
reconnet via a CMS Ace-BH- Web design and Programming 0 02-15-2006 11:33 AM
login help tommeh phphq.Net Forums 1 03-21-2005 09:46 PM
Can't login JoJo Tech Support 0 04-21-2003 04:24 AM
login name XenoMorpH Feedback / Novahq.net Support 2 09-12-2002 05:12 AM


All times are GMT -5. The time now is 12:16 AM.




Powered by vBulletin®