View Full Version : Basic password & username for my site.
harsh87
01-11-2008, 06:47 PM
So i have been looking for a little script (it can be big as well) for about 2 weeks now that will let me put a username and password form in my website. Linked to some data base of some sort(can be mysql, excel...anything) Doesent have to be a data base though! :confused: can be a file being read....anythign. I can make the usernames and password myself in some file on the server(the user will not have a "register now" button). So from there when a user enters the right password corrosponding with the username, he is pushed to a folderwhich has a index file with some information like progress of work, and pictures and also a paynow button. If the password is wrong, then to some error page. The stuff in orage i can do. I can create a little program to do that however the username and stuff i cant. The form will be on every page ofthe website.
Please help.
thetestingsite
01-11-2008, 06:52 PM
Take a look at the following site:
http://www.php-mysql-tutorial.com/user-authentication/index.php
Hope this helps.
harsh87
01-11-2008, 07:05 PM
Okay so i see how its done. Difficult. But i think doable. "Dhuh to me" However, where do i assign a username with a specific foldername where it can be directed to if the username and password match? I know it sounds big but for some reason i think its possible with some guidance from you. Please help.
Thx in advance.
harsh87
01-12-2008, 02:17 AM
Common some one help me out. Nothign seems to be working here!lol.
BLiZZaRD
01-12-2008, 03:47 AM
This is an older script of mine, may be of some use:
<?php
if($_POST['user']) {
if(($_POST['user'] == "Username1") && ($_POST['pass'] == "Password1")) header("Location: http://the page to go to.com");
else if(($_POST['user'] == "User2") && ($_POST['pass'] == "Password2")) header("Location: http://the page to go to .com");
else header("Location: error.htm");
} else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>php log in script</title>
</head>
<body>
<br><br>
<center>
<font size= "6">Please Log In Below</font><br><br><br>
<form action="<?=$PHP_SELF?>" method="post">
<p>Username: <input type="text" name="user"/>
Password: <input type="password" name="pass"/>
<input type= "submit" value= "Log In"/></p>
</form>
</center>
</body>
</html>
<?php } ?>
Changing the parts in red to match what you need, obviously.
You can just add more of the if/else parts for each user.. or make a global page and call that with post/get etc... Shouldn't be that hard to manipulate.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.