bopritchard
Programmer
what in this file is causing the "headers already exist" message?
contents of login.php
<?
include ("config.inc.php");
$username=$_POST['username'];
$password=$_POST['password'];
mysql_connect( "$hostname", "$dbusername", "$dbpassword")
or die ("Unable to connect to server.");
mysql_select_db("$db_name")
or die ("Unable to select database.");
$sql = "SELECT *
FROM users
WHERE username='$username' and password='$password'";
$result = mysql_query($sql)
or die ("Unable to get results.");
$num = mysql_numrows($result)
or die ("You're not authorized to be here. If you feel you have recieved this
message in error, please contact the <a
href=\"mailto:bopritchard@mindspring.com\">webmaster</a>");
if ($num == 1) {
$row = mysql_fetch_row ($result);
$id=$row[0];
session_start();
$_SESSION['userid'] = 'crap';
$_SESSION['otauth'] = 'no';
print "$id";
echo "Your username is $username</p>";
}
?>
contents of config.inc.php
<?php
$dbusername = "asdfasdfasdf"; //Database Username
$dbpassword = "adfasdfsdaf"; //Database password
$db_name = "asdfasdfsadf"; //Database name
$hostname= "asdfasdfasdf";
?>
contents of login.php
<?
include ("config.inc.php");
$username=$_POST['username'];
$password=$_POST['password'];
mysql_connect( "$hostname", "$dbusername", "$dbpassword")
or die ("Unable to connect to server.");
mysql_select_db("$db_name")
or die ("Unable to select database.");
$sql = "SELECT *
FROM users
WHERE username='$username' and password='$password'";
$result = mysql_query($sql)
or die ("Unable to get results.");
$num = mysql_numrows($result)
or die ("You're not authorized to be here. If you feel you have recieved this
message in error, please contact the <a
href=\"mailto:bopritchard@mindspring.com\">webmaster</a>");
if ($num == 1) {
$row = mysql_fetch_row ($result);
$id=$row[0];
session_start();
$_SESSION['userid'] = 'crap';
$_SESSION['otauth'] = 'no';
print "$id";
echo "Your username is $username</p>";
}
?>
contents of config.inc.php
<?php
$dbusername = "asdfasdfasdf"; //Database Username
$dbpassword = "adfasdfsdaf"; //Database password
$db_name = "asdfasdfsadf"; //Database name
$hostname= "asdfasdfasdf";
?>