User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,543 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,319 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 467 | Replies: 1
Reply
Join Date: Oct 2007
Posts: 3
Reputation: timbredemeyer is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
timbredemeyer timbredemeyer is offline Offline
Newbie Poster

desperate for password protection

  #1  
Oct 14th, 2007
I am desperate for some password protection that accesses a database for user name and password. i have searched all over the web and cannot find one that actualy works. i need to redirect to a users personal internal page on my website after the password checks out as well. any help would be greatly appreciated. thank you in advance.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2006
Posts: 32
Reputation: StatiX is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 2
StatiX's Avatar
StatiX StatiX is offline Offline
Light Poster

Re: desperate for password protection

  #2  
Oct 14th, 2007
just make an html form that accepts two vars..user and pass then your code should look something like this

$sql = "SELECT * FROM `users` WHERE "user" = $_POST['user'] AND `pass`=$_POST['pass']";

$query= mysql_query($sql);
if(mysql_num_rows($query) => 1) {   //there is a user with that name and pass
//user authenticated .. proceed
echo "Welcome user!";
} else {
//user login failed do something else
echo "User name and password mismatch";
}


Of course you would not want to use the code above without first cleansing the two variables using some sort of filter. mysql_real_escape_string() , rtrim(), and md5() need to be implemented on the two variables if the pass is encrypted in the db
Always do what you wish you could..
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 5:01 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC