•
•
•
•
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
![]() |
•
•
Join Date: Oct 2007
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
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.
just make an html form that accepts two vars..user and pass then your code should look something like this
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
$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..
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Password protection for Website (PHP)
- need to access files that are password locked on old hard drive (Windows NT / 2000 / XP / 2003)
- Password Protection from a txt.file (HTML and CSS)
- ?Password+Protection of External HDD? (Windows NT / 2000 / XP / 2003)
- How to set up password to keep Windows from starting??? (Windows NT / 2000 / XP / 2003)
- NEED HELP!..PASSWORD LOCKOUT at LOGIN (Troubleshooting Dead Machines)
- password protection (Windows NT / 2000 / XP / 2003)
Other Threads in the PHP Forum
- Previous Thread: PHP and XML/XSL
- Next Thread: Coloring text


Linear Mode