CircularStopSign Posted August 22, 2006 Share Posted August 22, 2006 i'm still working with the membership code and there isnt a checkuser.php can anyone give me a simple code to check if the username and password match, then send them to login_success.php?thanks in advance Link to comment https://forums.phpfreaks.com/topic/18349-checking-a-users-login-information/ Share on other sites More sharing options...
Corona4456 Posted August 22, 2006 Share Posted August 22, 2006 http://www.phpfreaks.com/tutorials/40/5.phpThere's a checkuser.php there Link to comment https://forums.phpfreaks.com/topic/18349-checking-a-users-login-information/#findComment-78879 Share on other sites More sharing options...
trq Posted August 22, 2006 Share Posted August 22, 2006 Just do it in your query.[code=php:0]"SELECT uname, pword FROM users WHERE uname = '{$_POST['uname']}' AND pword = '{$_POST['pword']}'";[/code]If no results are returned they failed. Link to comment https://forums.phpfreaks.com/topic/18349-checking-a-users-login-information/#findComment-78881 Share on other sites More sharing options...
SharkBait Posted August 22, 2006 Share Posted August 22, 2006 [code]<?php$password = "mypass"$username = "user123"$strqry = "SELECT * FROM users WHERE password = '{$password}' AND username = '{$username}'";$query = mysql_query($strqry) or die("MySQL Error: <br />{$strqry} <br /> ". mysql_error());$num = mysql_num_rows($query);if ($num < 1) { // Password User not found in database or do not match} else { // Password/username is valid header("Location: login_success.php"); exit();}?>[/code]Gives you the jist of it :) Link to comment https://forums.phpfreaks.com/topic/18349-checking-a-users-login-information/#findComment-78885 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.