$count = $sth->execute(); $uid = $conn->lastInsertId(); $success = 1; $msg = "User Successfully registered"; } catch (Exception $e) { } /*if($image){ $sql="INSERT INTO `codebrew_gander`.`photos` (`id`, `user_id`, `image`, `date`, `auto_approved`, `created_on`) VALUES (DEFAULT, :user_id, :image,NOW(), 0, NOW())"; $sth=$conn->prepare($sql); $sth->bindValue("user_id",$uid); $sth->bindValue("image",$image_path); try{$sth->execute();} catch(Exception $e){} }*/ $tnt = DataClass::get_profile($phone); $data['profile'] = $tnt ? $tnt : []; /*if($count){ try{ DataClass::sendSMS($phone,$body); } catch(Exception $e){} }*/ } } // +-----------------------------------+ // + STEP 4: send json data + // +-----------------------------------+ if ($success == 1) { echo json_encode(array("success" => $success, "msg" => $msg, "verification_code" => $v_code, "status" => $phn_status, "data" => $data)); } else {
$success=$msg="0";$data=array(); // +-----------------------------------+ // + STEP 2: get data + // +-----------------------------------+ $email=$_REQUEST['email']; $password=$_REQUEST['password']; $apn_id=$_REQUEST['apn_id']?$_REQUEST['apn_id']:""; if(!($email && $password && $email!='null')){ $success="0"; $msg="Incomplete Parameters"; $data=array(); } else{ $data = DataClass::get_profile($email,$password)? DataClass::get_profile($email,$password):[]; if($data){ $success='1'; $msg="Login Successful"; /*if($apn_id) $sql="update users set apn_id=:apn_id where email=:email"; $sth=$conn->prepare($sql); $sth->bindValue('email',$email); if($apn_id) $sth->bindValue('apn_id',$apn_id); try{$sth->execute();} catch(Exception $e){} */ } else{ $success='0'; $msg="Invalid Email or Password";