<?php
include_once("dbconnect.php");
$name = ($_REQUEST['user']);
$pass = ($_REQUEST['password']);
$query = 'SELECT * FROM editlogin WHERE username="$name" AND password="$pass"';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
if (mysql_num_rows($result) == 1){
//successful login
print 'login success!';
}else{
// not successful
print 'login failed.';
}
?>
I use this code, and it says fail every time, even when i put in the stuff correctly. I even had it print out what the user put (temporarily) like so:
print 'Username: $name <br/>';
print 'Password: $pass <br/>';
This prints out everything correctly, exactly what i put in on the login page. I have also checked the database to make sure the data is correct, and it is.
I have made sure that it is connecting to the database correctly.
HELP!
I have tried taking out the '==1' and it still says fail.
This is a private site for my school, and the login will be a secret part anyway so I'm not too worried (at the moment) about security
include_once("dbconnect.php");
$name = ($_REQUEST['user']);
$pass = ($_REQUEST['password']);
$query = 'SELECT * FROM editlogin WHERE username="$name" AND password="$pass"';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
if (mysql_num_rows($result) == 1){
//successful login
print 'login success!';
}else{
// not successful
print 'login failed.';
}
?>
I use this code, and it says fail every time, even when i put in the stuff correctly. I even had it print out what the user put (temporarily) like so:
print 'Username: $name <br/>';
print 'Password: $pass <br/>';
This prints out everything correctly, exactly what i put in on the login page. I have also checked the database to make sure the data is correct, and it is.
I have made sure that it is connecting to the database correctly.
HELP!
I have tried taking out the '==1' and it still says fail.
This is a private site for my school, and the login will be a secret part anyway so I'm not too worried (at the moment) about security