...

View Full Version : Password protecting added profiles via mySQL



Cerebralj
04-22-2013, 12:50 PM
I've made a project where you can add profiles to the site via php forms. I'm storing the info with Sequel Pro. Name and info is all fine but I can't password protect the info so other users can view it without a password.
Any ideas on how to do so? Thanks.

timgolding
05-07-2013, 05:09 PM
simplest way to password protect a page is with http password protection


if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW']))
{
if(("username" == $_SERVER['PHP_AUTH_USER']) && ("password" == ($_SERVER['PHP_AUTH_PW'])))
{
/// Log in successfull :D
main_loop();
}
else
{
//Log in not successfull. Prompt for log in
header('WWW-Authenticate: Basic Realm="Login please"');
header('HTTP/1.0 401 Unauthorized');
}
}
else
{
//Prompt for log in
header('WWW-Authenticate: Basic Realm="Login please"');
header('HTTP/1.0 401 Unauthorized');
}

function main_loop()
{
//start of main code in here
}



If thats what you a trying to do?

If you want to make you own log in system using html /php would require a bit more work. But could be useful when different users require different passwords.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum