$value) { if($header=="PAAYASMILKAPPV1") { $httpHeader=$value; } } if($httpHeader!="MakeInGtracAppV1") { die(); }*/ function check_email_address($email) { /*$pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"; if (eregi($pattern, $email)){ return true; } else { return false; }*/ return filter_var($email, FILTER_VALIDATE_EMAIL) !== false; } if($_POST) { $masterObj = new master(); $data = array(); if(empty($_POST['userId']) || empty($_POST['username']) || empty($_POST['password']) || empty($_POST['conf_password']) || empty($_POST['name']) || empty($_POST['email']) || empty($_POST['phone'])) { $arr=array ( 'status' => 0, 'message' => "Feilds are Empty. Kindly Check.", ); array_push($data,$arr); } else { $userid = addslashes($_POST['userId']); $name = addslashes($_POST['name']); $username = addslashes($_POST['username']); $password = addslashes($_POST['password']); $password_confirm = addslashes($_POST['conf_password']); $email = addslashes($_POST['email']); $phone = addslashes($_POST['phone']); if($username==''|| $password==''|| $password_confirm==''|| $phone=='') { echo "please fill the empty field.";die; } if($password_confirm!=$password) { echo "Confirm password mismatch";die; } elseif(is_numeric(trim($phone))==false) { echo "Please enter numeric value for number.";die; } elseif(strlen($phone)<10 || strlen($phone)>10) { echo "Number should be ten digits.";die; } elseif(!check_email_address($email)) { echo "It is a valid email address.";die; } else { $result = $masterObj->editsubusers($userid,$name,$username,$password,$email,$phone,'add'); //print_r($result); if($result==1) { $arr=array ( 'status' => 200, 'message' => "Subuser Updated Successfully.", ); array_push($data,$arr); } else { $arr=array ( 'status' => 400, 'message' => "User already exist.", ); array_push($data,$arr); } } } echo json_encode($data); } ?>