Jump to content

Archived

This topic is now archived and is closed to further replies.

CircularStopSign

checking a users login information

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[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 :)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.