php - create account with different account in android application -


my application has 2 login , user can login application account or facebook, ask, when login facebook, username,email , password of facebook account can stored in same table application account registration? using localhost , php database , use android studio develop app, because task if user login facebook in application, when want create new account, cannot use same email address facebook use login now. hope understand question. below login , register application account code:

login:

<?php   require_once '../includes/dboperations.php';  $response = array();   if($_server['request_method']=='post'){ if(isset($_post['username']) , isset($_post['password'])){     $db = new dboperations();       if($db->userlogin($_post['username'], $_post['password'])){         $user = $db->getuserbyusername($_post['username']);         $response['error'] = false;          $response['user_id'] = $user['user_id'];         $response['email'] = $user['email'];         $response['username'] = $user['username'];       }else{         $response['error'] = true;          $response['message'] = "invalid username or password";               }  }else{     $response['error'] = true;      $response['message'] = "required fields missing"; } }  echo json_encode($response); ?> 

register:

<?php   require_once '../includes/dboperations.php';  $response = array();   if($_server['request_method']=='post'){ if(     isset($_post['username']) ,         isset($_post['email']) ,             isset($_post['password']))     {     //operate data further       $db = new dboperations();       $result = $db->createuser(   $_post['username'],                                 $_post['password'],                                 $_post['email']                             );     if($result == 1){         $response['error'] = false;          $response['message'] = "user registered successfully";     }elseif($result == 2){         $response['error'] = true;          $response['message'] = "some error occurred please try again";               }elseif($result == 0){         $response['error'] = true;          $response['message'] = "it seems registered, please choose different email , username";                          } }else{     $response['error'] = true;      $response['message'] = "required fields missing"; } }else{ $response['error'] = true;  $response['message'] = "invalid request"; }  echo json_encode($response); 

what in such situation store emails along user data in database. along that, store username(to avoid duplication in username). if user creates new account, separate table/collection checked if such email id exists. if exists, show message reset password.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -