eaglelegend Posted May 25, 2008 Share Posted May 25, 2008 This is right isnt it?? if(isset($_POST['username']) && isset($_POST['password'])) { $username = @strip_tags(stripslashes($_POST))); $password = @strip_tags(stripslashes(md5($_POST))); Because it says the "=" is unexpected... Quote Link to comment https://forums.phpfreaks.com/topic/107148-login-unexpected/ Share on other sites More sharing options...
eaglelegend Posted May 25, 2008 Author Share Posted May 25, 2008 OK, I have corrected it just, but I am now having trouble logging members in :/ <?php include("header.php"); if(isset($_POST['username']) && isset($_POST['password'])) { $username == @strip_tags(stripslashes($_POST)); $password == @strip_tags(stripslashes(md5($_POST))); $ip = getenv(‘REMOTE_ADDR’); } if($username && $password) { $check = mysql_num_rows(mysql_query("SELECT * FROM `members` WHERE `username`='$username' AND `password`='$password'")); if($check == 1) { $_SESSION['ELv2'] = $username; if(session_register('ELv2')){ $_SESSION['ELv2'] = mysql_query("UPDATE members SET lastlogin='$lastlogindate' WHERE username='$username' LIMIT 1"); Header("Location: index.php"); } else { print "Cant set cookie"; } } else { print "Sorry, username/password mismatch!"; } } else { ?> <h2>Login</h2><p> <form action="login.php" method="post"> Username<br> <input type="text" name="username" class="text_box" size="20" title="Please enter the Username you registered here with." alt="Please enter the Username you registered here with."><p> Password<br> <input type="password" name="password" class="text_box" size="20" title="Please enter the Password you registered here with." alt="Please enter the Password you registered here with."><p> <input type="hidden" name="ip" value="set"> <input type="submit" class="text_box" value=" Login " title="Click here to log in." alt="Click here to log in."></form> <?php } include("footer.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/107148-login-unexpected/#findComment-549349 Share on other sites More sharing options...
sasa Posted May 25, 2008 Share Posted May 25, 2008 change if(isset($_POST['username']) && isset($_POST['password'])) { $username = @strip_tags(stripslashes($_POST))); $password = @strip_tags(stripslashes(md5($_POST))); to if(isset($_POST['username']) && isset($_POST['password'])) { $username = @strip_tags(stripslashes($_POST['username']))); $password = @strip_tags(stripslashes(md5($_POST['password']))); Quote Link to comment https://forums.phpfreaks.com/topic/107148-login-unexpected/#findComment-549356 Share on other sites More sharing options...
eaglelegend Posted May 25, 2008 Author Share Posted May 25, 2008 im sorry sasa, that didnt help :/ Quote Link to comment https://forums.phpfreaks.com/topic/107148-login-unexpected/#findComment-549360 Share on other sites More sharing options...
sasa Posted May 25, 2008 Share Posted May 25, 2008 1st for setup variable values you must use one = not two (==) two == is for compare 2st remove @ in front of function and enable error reporting 3 in query "UPDATE members SET lastlogin='$lastlogindate' WHERE username='$username' LIMIT 1" you dont setup variable $lastlogindate are you have some new error Quote Link to comment https://forums.phpfreaks.com/topic/107148-login-unexpected/#findComment-549364 Share on other sites More sharing options...
eaglelegend Posted May 25, 2008 Author Share Posted May 25, 2008 thanks!, that seems to work, now how do I get the IP address updated and sent to the user? $_SERVER['REMOTE_ADDR']; Quote Link to comment https://forums.phpfreaks.com/topic/107148-login-unexpected/#findComment-549366 Share on other sites More sharing options...
eaglelegend Posted May 25, 2008 Author Share Posted May 25, 2008 anyone know? ??? Quote Link to comment https://forums.phpfreaks.com/topic/107148-login-unexpected/#findComment-549390 Share on other sites More sharing options...
eaglelegend Posted May 25, 2008 Author Share Posted May 25, 2008 ??? Quote Link to comment https://forums.phpfreaks.com/topic/107148-login-unexpected/#findComment-549401 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.