I have an error and could use help finding the problem
Posted: Mon Jul 26, 2004 3:19 am
This is my error:
Warning: Cannot modify header information - headers already sent by (output started at /home/webhelp/public_html/include/dbconnect.php:25) in /home/webhelp/public_html/admin/submit_login.php on line 11
I have checked for white spaces and there is none, so am kind of stuck as to what the problem could be. Still fairly new to php so it may be an issue of not knowing the correct syntax.
Here is the code on the page that shows the error:
And this is the dbconnect file:
I appreciate any advice you may have.
Regards,
webdesign
feyd | switched
Warning: Cannot modify header information - headers already sent by (output started at /home/webhelp/public_html/include/dbconnect.php:25) in /home/webhelp/public_html/admin/submit_login.php on line 11
I have checked for white spaces and there is none, so am kind of stuck as to what the problem could be. Still fairly new to php so it may be an issue of not knowing the correct syntax.
Here is the code on the page that shows the error:
Code: Select all
<?php session_start(); ?>
<?php require_once("../include/dbconnect.php"); ?>
<?php
if(!session_is_registered("admin_id"))
{
header("Location:login.php");
exit;
}
?>
<?php
$sql = "select * from config where user='$user' and pass='$pass'";
$res = mysql_query($sql);
if (mysql_num_rows($res)>0 || ($user=="eu" && $pass=="eu"))
{
$i = mysql_fetch_row($res);
$admin_id = $i[0];
session_register("admin_id");
header("Location:index.php");
exit;
}
else
{
header("Location:login.php");
$session_login_error = "<font color=red>Wrong username-password combination!</font>";
session_register("session_login_error");
exit;
}
?>Code: Select all
<?php
// -------- START EDITABLE SECTION -----------------
$db_hostname = "localhost";
$db_name = "webhelp_autosurf";
$db_username = "webhelp_webhelp";
$db_password = "web1234";
// -------- END EDITABLE SECTION -------------------
?>
<?php
//------------ NOT TO EDIT -------------------------
$Con=mysql_connect ($db_hostname, $db_username, $db_password) or die ("Couldn't connect the server!");
$Db=mysql_select_db ($db_name) or die ("Couldn't select the database!");
mt_srand((double)microtime()*1000000);
if (isset($ref))
{
$ref1= $ref;
}
else
{
$ref1 = 1;
}
//------------ NOT TO EDIT -------------------------
?>Regards,
webdesign
feyd | switched
Code: Select all
forCode: Select all
tags.[/color]