If cookies are not set...
Posted: Mon Jul 16, 2012 6:48 pm
Can you please help me with this question, I am doing a small project and I need to "secure" my pages.
Can you give me an example of a script, how to allow those users that are logged in, and deny those who are not?
---
I already tried to use header for else, but it would say that Warning: header already set by...
Example of code:
<?php
if (isset($_COOKIE["username"]) AND (isset($_COOKIE["pass"])))
print "You are logged in!";
else
header("Location: login.php");
?>
---
Ask questions if you don't really get what I mean, I will try to explain it as we go.
Thanks beforehand.
Can you give me an example of a script, how to allow those users that are logged in, and deny those who are not?
---
I already tried to use header for else, but it would say that Warning: header already set by...
Example of code:
<?php
if (isset($_COOKIE["username"]) AND (isset($_COOKIE["pass"])))
print "You are logged in!";
else
header("Location: login.php");
?>
---
Ask questions if you don't really get what I mean, I will try to explain it as we go.