configuration file
Posted: Thu Aug 28, 2003 7:46 am
i want to include my config.php which has all the variables in it.
i've tried require() and include(). but i get header errors when i try to use them (actions.php):
okay, when i access it the first time (for loggin in), it works fine. then when i try to log out, it won't work. i get:
line 9 is:
line 42 is:
in the config.php:
any ideas? since if i include the variables in the actions.php, it'll create a huge mess.
-Nay
i've tried require() and include(). but i get header errors when i try to use them (actions.php):
Code: Select all
<?
session_start();
if ($username == "") {
header("Location: index.html"); }
else {
require("config.php");
$id = $_GET['id'];
if ($id == "login")
{
$username = $_POST['username'];
$password = $_POST['password'];
$password = md5($password);
$c = mysql_connect("$host", "$user", "$pass");
$db = mysql_select_db("$db", "$c");
$q = "SELECT * FROM 'users' WHERE username = '$username' AND password = '$password'";
$r = mysql_query("$q", "$c");
$rws = mysql_num_rows($r);
if ($rws == "0")
{
echo "Login Incorrect! Please go back and try again";
}
else
{
session_register("username");
header("Location: admincp.php");
}
}
elseif ($id == "logout")
{
session_unregister("username");
session_unset();
header("Location: index.html");
}
} // end else
?>Code: Select all
Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site95/fst/var/www/html/nlogger/config.php:9) in /home/virtual/site95/fst/var/www/html/nlogger/actions.php on line 42Code: Select all
require("config.php");Code: Select all
header("Location: index.html");Code: Select all
$host = "localhost";
$user = "memememe";
$pass = "blablablablabla";
$db = "sinsrevival_com";
// the mysql variables
$dir_name = "/home/virtual/site21/fst/var/www/html/uploads";
$url_name = "http://www.sinsrevival.com/uploads";-Nay