Im working on an admin script in php for a cms:
Code: Select all
<?php
include 'dbconnect.php';
if ($_POST['login'] || $_COOKIE['kjelsaas.admin'] == 'DWASDA23FASDW') {
$userq = mysql_query("SELECT user, password FROM admin;");
while ($user = mysql_fetch_array($userq)) {
if ($_POST['uname'] == $user[0] && $_POST['passwd'] == $user[1]) {
setcookie("kjelsaas.admin", 'DWASDA23FASDW', time()+3600);
$i = 0;
$linksq = mysql_query("SELECT page, adress FROM admin_panel ORDER BY id ASC;");
while ($links = mysql_fetch_array($linksq)) {
if ($i >= 1) { echo " | "; }
echo "<a href='http://www.kjelsaas.no/test/$links[1]'>$links[0]</a>";
echo $_COOKIE['kjelsaas.admin']; //debuging
$i++;
}
}
else echo "Get lost";
}
}
else {
include 'admin.htm';
}
Code: Select all
Warning: Cannot modify header information - headers already sent by (output started at /var/www/00/14/15/kjelsaas.no/www/test/admin.php:1) in /var/www/00/14/15/kjelsaas.no/www/test/admin.php on line 8
Code: Select all
<?php
$value = 'something from somewhere';
setcookie("TestCookie", $value, time()+3600);
echo $_COOKIE['TestCookie']; // debuging
?>
Why doesnt it work?!?
EDIT: The admin.htm is just a post form (to show the password and username things).