File: /var/www/selfanalyse/wp-content/plugins/psychometrics/api/psy_wht_user_verify.php
<?php
/***
* @purpose : Register user for SP whitelabel
* @author Rohit Kashyap
* @since 31/07/2020 >> dd/mm/yyyy
* @version 0.1
* @copyright Copyright (C) 2020 Graposs Edutech Ltd. All rights reserved.
* @license Graposs Edutech Ltd.
*/
/***
* define header and include config
*/
header("Access-Control-Allow-Origin: *");
header('Content-Type: application/json');
include("../../../../wp-config.php");
global $wpdb;
$PSY_USERS = $wpdb->prefix . PSY_USERS;
$date = date('Y-m-d H:i:s');
$whitelabel_id = $_REQUEST['wht_id'];
$email = $_REQUEST['txtEmail'];
$mobile = $_REQUEST['ophone'];
if ($whitelabel_id != '') {
if ($mobile !="") {
$userExist = $wpdb->get_var("SELECT count(ID) FROM $PSY_USERS WHERE user_login ='$mobile'");
if($userExist > 0){
$array = array("status" => "0", "message" => "Mobile number is already registered", "ref_id" => $whitelabel_id );
} else {
$array = array("status"=>"1", "message"=> "New user", "ref_id"=>$whitelabel_id);
}
} else if ($email !="") {
$userExist = $wpdb->get_var("SELECT count(ID) FROM $PSY_USERS WHERE user_email ='$email'");
if($userExist > 0){
$array = array("status" => "0", "message" => "This email id is already registered", "ref_id" => $whitelabel_id );
} else {
$array = array("status"=>"1", "message"=> "New user", "ref_id"=>$whitelabel_id);
}
}
}
echo json_encode($array);