podja Posted April 9, 2007 Share Posted April 9, 2007 havnt done any PHP in a while, but I've decided to start a new project. I am already getting really annoyed with this script, I cant see why it wont work! Could you take a look and give me some pointers. Heres the PHP part. (sv-includes/dologin.php) <?php if(isset($_POST['dologin'])) { $user = $_POST['dologin_user']; $pass = $_POST['dologin_pass']; include("connect.php"); $query = mysql_query("SELECT * FROM `members` WHERE `user` = '$user' AND `pass` = '$pass'"); $count = mysql_num_rows($query); if($count>0) { echo "Logged In"; } else { echo "Wrong Username or Password"; } } ?> Heres the HTML part (index.php) <form id="form1" name="form1" method="post" action="sv-includes/dologin.php"> <p>Username: <input name="dologin_user" type="text" id="dologin_user" /> </p> <p>Password: <input name="dologin_pass" type="text" id="dologin_pass" /> <input name="dologin" type="submit" id="dologin" value="Submit" /> </p> </form> Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/46265-login-not-working/ Share on other sites More sharing options...
trq Posted April 9, 2007 Share Posted April 9, 2007 What exactly does won't work mean? Link to comment https://forums.phpfreaks.com/topic/46265-login-not-working/#findComment-225011 Share on other sites More sharing options...
podja Posted April 9, 2007 Author Share Posted April 9, 2007 Sorry, I should have said. When I login with correct details, it doesnt seem to read them correctly and doesnt login. Link to comment https://forums.phpfreaks.com/topic/46265-login-not-working/#findComment-225023 Share on other sites More sharing options...
boo_lolly Posted April 9, 2007 Share Posted April 9, 2007 for starters, this: if(isset($_POST['dologin'])) { should be this: if(isset($_POST['form1'])) { Link to comment https://forums.phpfreaks.com/topic/46265-login-not-working/#findComment-225034 Share on other sites More sharing options...
per1os Posted April 9, 2007 Share Posted April 9, 2007 What boo stated is incorrect, the dologin is right. Is the password that is stored in the DB md5 hashed? if so you need to hash that password. If not that is a major security risk and should probably be hashed some way or form. <?php if(isset($_POST['dologin'])) { $user = $_POST['dologin_user']; $pass = $_POST['dologin_pass']; include("connect.php"); $query = mysql_query("SELECT * FROM `members` WHERE `user` = '$user' AND `pass` = '$pass'") OR DIE(mysql_error()); // add the or die make sure the query is right. $count = mysql_num_rows($query); if($count>0) { echo "Logged In"; } else { echo "Wrong Username or Password"; } } ?> Link to comment https://forums.phpfreaks.com/topic/46265-login-not-working/#findComment-225078 Share on other sites More sharing options...
boo_lolly Posted April 9, 2007 Share Posted April 9, 2007 What boo stated is incorrect, the dologin is right. you're right. i didn't scroll the form to the left enough to see the submit button name... Link to comment https://forums.phpfreaks.com/topic/46265-login-not-working/#findComment-225087 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.