View Full Version : password
Beowolf
22nd Jul 2003, 11:10 AM
I have been searching the web but it seems to be surprsingly hard to get a (good) script/tutorial for password proecting a certain page.
For my site I am using databases and forms to enter information into the database, how select users can update my content. But I want to password protect the forms page, obviously, how just not anybody can get in.
Can you point me to a good tutorial or something?
Hunter
22nd Jul 2003, 12:01 PM
can u not look at other things which use passwords?
Beowolf
22nd Jul 2003, 09:15 PM
Viewing source, you mean?
Sadly, no. My IE is being a b!tch and for some reason won't display anything when I go view -> source.
CaSCaDe
23rd Jul 2003, 04:47 AM
<?php
$dbcon = mysql_connect("localhost", "****", "****");
mysql_select_db("****", $dbcon);
$query = ("select * from users order by id desc");
$result = mysql_query($query, $dbcon);
if (!$username) {
//insert stuff here
require('login.php');
}
else {
while ($row = mysql_fetch_array($result)) {
$id = $row[0];
$user = $row[1];
$pass = $row[2];
if ($username == $user and $password == $pass) {
//admin stuff here
require('adminmain.php');
}
}
}
if ($username != $user || $password != $pass) {
require('error.php');
}
?>
lil example of some realy basic code i used on the ClanRSU admin pages its pretty old and a lil wierd, but it works :D, basicly you just confirm the user and pass on every page and if it doesnt match up you give them the errorpage, i had to do it like this cuse the securety on the server its on doesnt support the locking off a subdir
Kaligraphic
20th Sep 2003, 09:01 PM
I'd suggest just putting a md5ed user id in a cookie. once they've logged in, you can just compare the cookie to the md5 in the database. You can then use a quick if statement to change pages depending on whether the user has a valid login cookie. (set and then redirect back again.)
Kru3geR
20th Sep 2003, 09:40 PM
go to www.spoono.com and find their password protection page tutorial. Very easy yet extremely safe.
vBulletin® v3.8.0 Release Candidate 2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.