Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function pu_login(){
- $username = $_REQUEST['username'];
- $password = $_REQUEST['password'];
- $customer_id = $_REQUEST['customer_id'];
- $curl = curl_init();
- curl_setopt_array($curl, array(
- CURLOPT_URL => "http://212.235.34.9/tzviCohenSite/WebService.asmx/erpSite_getIsUserExist",
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_ENCODING => "",
- CURLOPT_MAXREDIRS => 10,
- CURLOPT_TIMEOUT => 30,
- CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
- CURLOPT_CUSTOMREQUEST => "POST",
- CURLOPT_POSTFIELDS => "UserName=$username&Password=$password&CustomerId=$customer_id&cmpId=1",
- CURLOPT_HTTPHEADER => array(
- "cache-control: no-cache",
- "content-type: application/x-www-form-urlencoded;charset=\"utf-8\""
- ),
- ));
- $response = curl_exec($curl);
- $err = curl_error($curl);
- curl_close($curl);
- $xml = simplexml_load_string($response);
- /*
- $to = 'eyal@pushtook.co.il';
- $subject = 'צבי כהן';
- $body = '<html>';
- $body.= '<body dir="ltr">';
- $body.= '<div>';
- $body.= 'response: '. $response;
- $body.= '</div>';
- $body.= '<div>';
- $body.= 'xml: '.$xml;
- $body.= '</div>';
- $body.= '</body>';
- $body.= '</html>';
- $headers = array('Content-Type: text/html; charset=UTF-8');
- wp_mail( $to, '=?utf-8?B?'.base64_encode($subject).'?=', $body, $headers );
- */
- if ($err) {
- echo json_encode("false");
- die();
- } else {
- if((string)$xml == "1") {
- echo json_encode("true");
- die();
- }elseif ((string)$xml == "9") {
- echo json_encode("blocked");
- die();
- }
- else {
- echo json_encode("false2");
- die();
- }
- }
- }
- add_action( 'wp_ajax_pu_login', 'pu_login' );
- add_action( 'wp_ajax_nopriv_pu_login', 'pu_login' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement