I got a news system but any1 can post in it atm i got the news dir password protected but that means you have to enter the username and password to even look at the news and i cant be arsed moving the display.php out of the dir into the main folder so i wanted to find a code that i can protect certain files/pages with like post.php edit.php and delete.php.
can ne1 help find a code or a tut for this i looked but i didnt find it maybe i wasnt looking hard enough.
Password Protected Page
Started by FK69, Jul 29 2005 11:29 PM
2 replies to this topic
#1
Posted 29 July 2005 - 11:29 PM
#2
Posted 30 July 2005 - 01:43 PM
add this line on the page where you write the news:
then add this line at the top of the php page that adds the news:
That should work. It would be helpful if you posted the actual code tho
password: <input type="password" name="pass"><br>
then add this line at the top of the php page that adds the news:
if($_POST['pass'] != "Your password here"){
echo '<meta http-equiv="refresh" content="3; URL=../index.php">';
die("Password is invalid. Redirecting back to index.php");
}
That should work. It would be helpful if you posted the actual code tho
#3
Posted 30 July 2005 - 04:42 PM
It would actually be easier to use http authentification. That way you don't have to login constantly. Just do a tutorial search for it, and you should find loads of tutorials on how to do it.
You can also check php.net for the header function (it has a few bits about authentification i believe).
You can also check php.net for the header function (it has a few bits about authentification i believe).
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
