Jump to content

[SOLVED] QUERY HELP


Canman2005

Recommended Posts

Hi all

 

I have this very simple login script

 

// check login form has been POSTED
if(isset($_POST['userlogin']))
{
// check login details
$total_query = "SELECT COUNT(*) as Num FROM `logins` WHERE username = '".$_POST['username']."' AND password = '".$_POST['password']."'";
$total_results = mysql_result(mysql_query($total_query),0);

//check if user exists then login
if($total_results == 1)
{
//query the database for full details
$sql = "SELECT * FROM `logins` WHERE username = '".$_POST['username']."' AND password = '".$_POST['password']."'";
$query = @mysql_query($sql,$connection) or die(mysql_error());
while ($row = mysql_fetch_array($query))
{
//create sessions
session_register('loggedin'); //to confirm that the user has signed in
$_SESSION['loggedin'] = 'testingsystem'; //create code to confirm user has logged in
}
print "<meta http-equiv=\"refresh\" content=\"0;URL=main.php\">";
exit();
}
else
{
// wrong username and password
print "<script>alert('Incorrect username\password combination.');</script>";
print "<meta http-equiv=\"refresh\" content=\"0;URL=index.php\">";
}
}

 

The problem is that I need to check the username and password are case sensetive, is there anyway I can do that?

 

Thanks in advance

 

Ed

 

Link to comment
https://forums.phpfreaks.com/topic/116843-solved-query-help/
Share on other sites

Archived

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

×
×
  • Create New...

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.