All right. But now I'm getting this:
Warning: Cannot modify header information - headers already sent by (output started at C:\Websites\chandlerhilldesign\admin\index.php:22) in C:\Websites\chandlerhilldesign\admin\index.php on line 38
/admin/index.php:
<?php
function CheckPassword ($password){
if ( $password == "thepassword" ){
// Good password
return 1;
}else{
// Bad password !
return 0;
}
}
function Welcome(){
include $_SERVER['DOCUMENT_ROOT']."/admin/admin.php";
}
function GoAway(){
include $_SERVER['DOCUMENT_ROOT']."/admin/retry.php";
}
?>
<?php
if ( isset($_COOKIE["AdminPassword"]) ){
// Ok, there's a cookie, is it the good one ?
$good = CheckPassword($_COOKIE["AdminPassword"]);
if ($good){
Welcome();
}else{
GoAway();
}
}elseif ( $_POST["password"] != "" ){
// The "password" input field has some content, let's check it
$good = CheckPassword($_POST["password"]);
if ($good){
setcookie("AdminPassword",$_POST["password"],time()+60*60*24);
Welcome();
}else{
GoAway();
}
}else{
// No cookie or password field right now, so let's send the HTML form
include $_SERVER['DOCUMENT_ROOT']."/admin/password.php";
}
?>
</div>
</div>
<?php
include $_SERVER['DOCUMENT_ROOT']."/inc/r.php";
include $_SERVER['DOCUMENT_ROOT']."/inc/foot.php";
?>
:queasy: :queasy: :queasy: