using a login form script that looks like this
<?php $passwords = array("name1"=>"pass1",
"name2"=>"pass2");
if ($password == $passwords[$username]){
setcookie("username", $username, time()+1200);
echo "<H2>Access granted.</H2>";
}else{
setcookie("username", "", time()-3600);
echo "<H2>Invalid user name or password: access denied.</H2>";
}
?>
Now I should point out... firefox 'view source' shows this part of the code in pink (the first bit):
<?php $passwords = array("name1"=>
Now the issue is that instead of just showing the output "Access granted." or "Invalid user name or password: access denied.", it shows this on the .php page:
"pass1", "name2"=>"pass2"); if ($password == $passwords[$username]){ setcookie("username", $username, time()+1200); echo "
Access granted.
"; }else{ setcookie("username", "", time()-3600); echo "
Invalid user name or password: access denied.
"; } ?>
which is, everything other than the pink stuff at the beginning... so I imagine something is wrong at that point. If someone could tell me how to fix that up that would be great.
The second question would be, can I change the output to actually be a whole web page instead of just "Access granted." or "Invalid user name or password: access denied."? If someone could show me what I might want to put to have the script head to a new .html file instead of spitting out that text that would be great, thanks.
Thank you in advance ( promise to say thanks after as well
Here is a screenshot to show what I mean quickly... shows the .php code and the result on the page.