Error in my PHP code.
Posted: Mon Jun 03, 2002 12:44 am
Hello, i have a slight problem in my code, and i do not know how to resolve it. Can anyone help?
Warning: Cannot add header information - headers already sent by (output started at C:\www\Apache\htdocs\inc\functions.lib.php:869) in c:\www\apache\htdocs\login.php on line 30
Warning: Cannot add header information - headers already sent by (output started at C:\www\Apache\htdocs\inc\functions.lib.php:869) in c:\www\apache\htdocs\login.php on line 31
Warning: Cannot add header information - headers already sent by (output started at C:\www\Apache\htdocs\inc\functions.lib.php:869) in c:\www\apache\htdocs\login.php on line 32
That's what i get from login.php which looks like this:
Hope this post wasn't too big...anyway, please help me you gurus!
Warning: Cannot add header information - headers already sent by (output started at C:\www\Apache\htdocs\inc\functions.lib.php:869) in c:\www\apache\htdocs\login.php on line 30
Warning: Cannot add header information - headers already sent by (output started at C:\www\Apache\htdocs\inc\functions.lib.php:869) in c:\www\apache\htdocs\login.php on line 31
Warning: Cannot add header information - headers already sent by (output started at C:\www\Apache\htdocs\inc\functions.lib.php:869) in c:\www\apache\htdocs\login.php on line 32
That's what i get from login.php which looks like this:
Code: Select all
<?php
/* login.php - written by micke andersson (root@g33k.net/system33@hackermail.net)
unavoidable information about this script...eeew.
*/
// requries.
require 'C:\www\Apache\htdocs\inc\global.inc';
require 'C:\www\Apache\htdocs\inc\counter.php';
// check if the user is already logged in.
//if(user($uid, $upass) == true) header("Location: $main_file.$PHP_ext");
if($login == "Submit")
{
// BEGIN simple error checkings.
if(empty($username)){tekerror("Please Enter a Username!");}
if(empty($pass)){tekerror("Please Enter a Password!");}
// END simple error checkings.
//db_connect();
$query = mysql_query("select id,password from users where name = '$username' and password = password('$pass')");
//$query = mysql_query("select id from users where id = $username and password = password('$pass')");
if(mysql_num_rows($query) == 1)
{
$lifetime = time() + 86400 * 356;
setcookie("uid", mysql_result($query, 0, 0), $lifetime);
setcookie("upass", mysql_result($query, 0, 1), $lifetime);
header("Location: $main_file.$PHP_ext");
exit;
}
else
{
$login = "";
header("Location: $login_file.$PHP_ext");
}
}
// let's load the initial form.
FrmLogin();
?>
and the function їb]FrmLogin();ї/b] looks like this:
function FrmLogin() {
?>
<br>
<b>DEVnet login prompt</b>
<br>
<body>
<form name="login" method="post">
<p>Username: <input type="text" name="username"></p>
<p>Passsword: <input type="password" name="pass">
<input type="submit" name="login" value="Submit">
</form>
</body>
<?
}