phpdrip Posted July 11, 2012 Share Posted July 11, 2012 Hi Guys,I need your help.I have login code but it is with defined user name & password.I need to fetch details from DB.Currently it is showing successful login only if username= "demo" & password="demo" .I want to authenticate user from DB. Below is the code : <?php $is_ajax = $_REQUEST['is_ajax']; if(isset($is_ajax) && $is_ajax) { $username = $_REQUEST['username']; $password = $_REQUEST['password']; if($username == 'demo' && $password == 'demo') { echo "success"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/265525-want-to-authenticate-user/ Share on other sites More sharing options...
psynor Posted July 11, 2012 Share Posted July 11, 2012 You will need to create a table to hold the username and password, and the ask the database for a row where username and password matches the user input Quote Link to comment https://forums.phpfreaks.com/topic/265525-want-to-authenticate-user/#findComment-1360813 Share on other sites More sharing options...
phpdrip Posted July 11, 2012 Author Share Posted July 11, 2012 Thanks Bro for your reply! Can you guide me how I can do this? Regards Quote Link to comment https://forums.phpfreaks.com/topic/265525-want-to-authenticate-user/#findComment-1360823 Share on other sites More sharing options...
psynor Posted July 11, 2012 Share Posted July 11, 2012 You should read up on MySQL INSERT and MySQL SELECT. Also do a search for php login tutorials Quote Link to comment https://forums.phpfreaks.com/topic/265525-want-to-authenticate-user/#findComment-1360826 Share on other sites More sharing options...
phpdrip Posted July 11, 2012 Author Share Posted July 11, 2012 Bro,I had try lot & also read lots of tutorials but not yet success. Quote Link to comment https://forums.phpfreaks.com/topic/265525-want-to-authenticate-user/#findComment-1360827 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.