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

$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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.