Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $sql = "SELECT * FROM user WHERE username = '$username' and password='$epassword'";
- $result = mysqli_query($con,$sql);
- $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
- $active = $row['active'];
- $count = mysqli_num_rows($result);
- // If result matched myusername and mypassword, table row must be 1 row
- if($count >0) {
- //$response = "Your Login success";
- $response = return ['operation' => 'Your Login success', 'data' => $row];
- }else {
- $response= "Your Login Email or Password is invalid";
- }
- signIn(){
- //// check to confirm the username and password fields are filled
- if(this.username.value=="" ){
- let alert = this.alertCtrl.create({
- title:"ATTENTION",
- subTitle:"Username field is empty",
- buttons: ['OK']
- });
- alert.present();
- } else
- if(this.password.value==""){
- let alert = this.alertCtrl.create({
- title:"ATTENTION",
- subTitle:"Password field is empty",
- buttons: ['OK']
- });
- alert.present();
- }
- else
- {
- var headers = new Headers();
- headers.append("Accept", 'application/json');
- headers.append('Content-Type', 'application/json' );
- let options = new RequestOptions({ headers: headers });
- let data = {
- username: this.username.value,
- password: this.password.value
- };
- let loader = this.loading.create({
- content: 'Processing, please wait…',
- });
- loader.present().then(() => {
- //this.http.post('http://localhost:90/totallight/api/login.php',data,options)
- this.http.post('http://edomonitor.com/school-evaluation-api/login.php',data,options)
- .map(res => res.json())
- .subscribe(res => {
- ///resolve(res.json())
- //.then(res => res.json())
- //.then(json => console.log(json))
- console.log(data)
- loader.dismiss()
- if(res=="Your Login success"){
- //this.authService.setToken(data.token, data.id, data.name, data.email);
- /*let alert = this.alertCtrl.create({
- title:"CONGRATS",
- subTitle:(res),
- buttons: ['OK']
- });
- alert.present();*/
- }else
- {
- let alert = this.alertCtrl.create({
- title:"ERROR",
- subTitle:"Invalid username/password",
- buttons: ['OK']
- });
- alert.present();
- }
- });
- });
- }
- }
Add Comment
Please, Sign In to add comment