Go Back   RunUO - Ultima Online Emulation > Developer's Corner > Programming > Script Languages

Script Languages Perl/PHP/Python/Ruby so on and so forth.

Reply
 
Thread Tools Display Modes
Old 01-28-2007, 02:33 PM   #1 (permalink)
Forum Expert
 
Nott32's Avatar
 
Join Date: Feb 2006
Location: In front of my computer...
Age: 17
Posts: 562
Send a message via MSN to Nott32 Send a message via Yahoo to Nott32
Default Password checker thingy?

I was wondering if anyone has a script that will check passwords and usernames against a list put in the file itself.
E.G. the user goes to http://www.yoursite.com/passwordchec...ame&p=password

then if the username/password combination match it displays "1" if they dont match then it displays "0"

the info is stored in variables so like

PHP Code:
$USER1 "username";
&
PASS1 "password";

$USER2 "Nott32";
$PASS2 "bobhubert"
I need this for a application im writting up I just cant figure out how to do it on my own
__________________
Everytime a puppy gets hit by a car from me smoking I take another drag, point, and laugh.

Last edited by Nott32; 01-28-2007 at 02:40 PM.
Nott32 is offline   Reply With Quote
Old 01-29-2007, 05:46 AM   #2 (permalink)
Forum Expert
 
mordero's Avatar
 
Join Date: Nov 2003
Location: Illinois, USA
Age: 22
Posts: 2,911
Default

well first of all, you would never transmit a password through a URL, maybe its hash, but you should use POST instead and do you want this to be hardcoded into a php script or use a database or flatfile (that way you can easily add users or whatnot). Of course a database is the most flexible way to go, but a flatfile (another name for a text file), would also work.

Anywho, lets say you have the list as an array with key=username, value=password. And for your example's sake, you are passing them through GET

PHP Code:
$username $_GET['u'];
$password $_GET['p'];
//code that will grab the list of names/password and stores it in $users
$users = array( "bob" => "12234" "user" => "pass");
if ( ( isset( 
$users[$username] ) ) && ( $users[$username] == $password ) ) {
print 
"true";
} else {
print 
"false";

instead of printing true or false, you could let the script continue or give an error or whatever. Also, you are not going to want to store each password and username as individual variables but use an array like i did.

also you are going to want to check to make sure that the $_GET variables actually exist and are set before all this.
mordero is offline   Reply With Quote
Old 01-29-2007, 10:43 AM   #3 (permalink)
Forum Expert
 
Nott32's Avatar
 
Join Date: Feb 2006
Location: In front of my computer...
Age: 17
Posts: 562
Send a message via MSN to Nott32 Send a message via Yahoo to Nott32
Default

Thats close to the one I used to use lol thank you! You are a life savor once again...the site that had the source for the script I used went down and now I cant get it >_< for a new project and go figure the script was on my PC when it crashed so I didnt have a copy on my system....*Useless rambling goes on*

*Has to go to school *

!!!HOORAY FOR SHORT DAY!!!
__________________
Everytime a puppy gets hit by a car from me smoking I take another drag, point, and laugh.
Nott32 is offline   Reply With Quote
Old 01-29-2007, 03:15 PM   #4 (permalink)
Forum Expert
 
mordero's Avatar
 
Join Date: Nov 2003
Location: Illinois, USA
Age: 22
Posts: 2,911
Default

yep no problem its nice to finally have someone ask questions about php in here
mordero is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5