.h File
@interface login : UIViewController
{
NSString *content;
}
-(IBAction)log:(id)sender;
-(IBAction)signup:(id)sender;
@property (retain, nonatomic) IBOutlet UITextField *UserName;
@property (retain, nonatomic) IBOutlet UITextField *Password;
@end
.m File
#import "screen2.h"
#import "Reachability.h"
@implementation login
@synthesize UserName,Password;
-(IBAction)log:(id)sender
{
Reachability *reach = [Reachability reachabilityWithHostName:@"www.google.com"];
NetworkStatus internetStatus = [reach currentReachabilityStatus];
if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN))
{
/// Create an alert if connection doesn't work
UIAlertView *myAlert = [[UIAlertView alloc]
initWithTitle:@"No Internet Connection" message:@""
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[myAlert show];
[myAlert release];
}
NSString *stringURL =[NSString stringWithFormat: @"http://www.support.iwedplanner.com/KnowledgeBowl/KnowBowl_User.aspx?UserName=%@&Password=%@",UserName.text,Password.text,nil];
NSURL *url = [NSURL URLWithString:stringURL];
content=[NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:NULL];
if([content hasPrefix:@"|Invalid UserName/Password |"])
{
UIAlertView *objAlert = [[UIAlertView alloc] initWithTitle:@"Message!" message:@"Invalid UserName/Password" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK",nil];
[objAlert setTag:1];
[objAlert show];
[objAlert release];
UserName.text=@"";
Password.text=@"";
}
else
{
screen2 *start=[[screen2 alloc]init];
[self.navigationController pushViewController:start animated:YES];
}
}
{
NSString *content;
}
-(IBAction)log:(id)sender;
-(IBAction)signup:(id)sender;
@property (retain, nonatomic) IBOutlet UITextField *UserName;
@property (retain, nonatomic) IBOutlet UITextField *Password;
@end
.m File
#import "screen2.h"
#import "Reachability.h"
@implementation login
@synthesize UserName,Password;
-(IBAction)log:(id)sender
{
Reachability *reach = [Reachability reachabilityWithHostName:@"www.google.com"];
NetworkStatus internetStatus = [reach currentReachabilityStatus];
if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN))
{
/// Create an alert if connection doesn't work
UIAlertView *myAlert = [[UIAlertView alloc]
initWithTitle:@"No Internet Connection" message:@""
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[myAlert show];
[myAlert release];
}
NSString *stringURL =[NSString stringWithFormat: @"http://www.support.iwedplanner.com/KnowledgeBowl/KnowBowl_User.aspx?UserName=%@&Password=%@",UserName.text,Password.text,nil];
NSURL *url = [NSURL URLWithString:stringURL];
content=[NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:NULL];
if([content hasPrefix:@"|Invalid UserName/Password |"])
{
UIAlertView *objAlert = [[UIAlertView alloc] initWithTitle:@"Message!" message:@"Invalid UserName/Password" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK",nil];
[objAlert setTag:1];
[objAlert show];
[objAlert release];
UserName.text=@"";
Password.text=@"";
}
else
{
screen2 *start=[[screen2 alloc]init];
[self.navigationController pushViewController:start animated:YES];
}
}
No comments:
Post a Comment