i am trying to create a login page for iPad by using Mysql through PHP, But it is not logging in even though there is no error in page, please find the code below:
//-(IBAction)homePage: (id)sender{
NSString *post =[NSString stringWithFormat:@"username=%@&password=%@",loginName.text, password.text];
NSString *hostStr = @"http://localhost/iddb.php";
hostStr = [hostStr stringByAppendingString:post];
NSData *dataURL = [NSData dataWithContentsOfURL: [ NSURL URLWithString: hostStr ]];
NSString *serverOutput = [[NSString alloc] initWithData:dataURL encoding: NSASCIIStringEncoding];
if([serverOutput isEqualToString:@"Yes"]){{
homepage *hvc = [[homepage alloc]initWithNibName: nil bundle: nil];
hvc.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:hvc animated: YES];}
UIAlertView *alertsuccess = [[UIAlertView alloc] initWithTitle:@"success" message:@"You are authorized"
delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alertsuccess show];
} else {
UIAlertView *alertsuccess = [[UIAlertView alloc] initWithTitle:@"Fail" message:@"Invalid Access"
delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alertsuccess show];
}
PHP Code:
<?php
$username = $_GET['username'];
$password = $_GET['password'];
$check = "select username, password from login where username='$username' and password='$password'";
{
mysql_connect("localhost", "root","") or die();
mysql_select_db("dadsdb") or die (mysql_error());
}
$login = mysql_query($check) or die (mysql_error());
if (mysql_num_rows($login)==1) {
$row = mysql_fetch_assoc($login);
echo 'yes';
exit;
} else {
echo 'No';
exit;
}
?>
please can any one suggest me what went wrong
Use case sensitve results!