nxsCptCheck_ajax

The NextScripts: Social Networks Auto-Poster nxsCptCheck ajax function.

Description

nxsCptCheck_ajax(); 

Usage

  1. if ( !function_exists( 'nxsCptCheck_ajax' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextscripts-social-networks-auto-poster/inc-cl/li.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = nxsCptCheck_ajax(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/inc-cl/li.php  
  1. if (!function_exists("nxsCptCheck_ajax")) { function nxsCptCheck_ajax() { global $nxs_gCookiesArr; $advSettings = array(); 
  2. if (!empty($_POST['c'])) { $seForDB = get_option('nxs_li_ctp_save'); $ser = maybe_unserialize($seForDB); $nxs_gCookiesArr = $ser['c']; $ck = $nxs_gCookiesArr; $flds = $ser['f'];  
  3. $flds['recaptcha_response_field'] = $_POST['c']; $liObj = new nxsAPI_LI(); $hdrsArr = $liObj->headers('https://www.linkedin.com/uas/login-submit', 'https://www.linkedin.com', 'POST', false); 
  4. $advSet = array('headers' => $hdrsArr, 'httpversion' => '1.1', 'timeout' => 45, 'redirection' => 0, 'cookies' => $ck, 'body' => $flds); // prr($advSet); 
  5. $rep = nxs_remote_post('https://www.linkedin.com/uas/captcha-submit', $advSet); if (is_nxs_error($rep)) { $badOut = print_r($rep, true)." - ERROR"; return $badOut; } $contents2 = $rep['body'];  
  6. if (stripos($contents2, '<span class="error">')!==false) { echo strip_tags(CutFromTo($contents2, '<span class="error">', '</span>')); die(); }  
  7. if (stripos($contents2, '<div id="global-error">')!==false) { echo CutFromTo($contents2, '<div role="alert" class="alert error">', '</div>'); die(); }  
  8. if (stripos($contents2, 'The email address or password you provided does not match our records')!==false) { echo "Invalid Login/Password"; die(); } 
  9. if (stripos($contents2, 'Hmm, ')!==false) { echo "Invalid Login/Password"; die(); }  
  10. if ($rep['response']['code']=='302' && !empty($rep['headers']['location']) && stripos($rep['headers']['location'], 'linkedin.com/uas/captcha-submit')!==false) echo "Wrong Captcha. Please try Again"; 
  11. if ($rep['response']['code']=='302' && !empty($rep['headers']['location']) && (stripos($rep['headers']['location'], 'linkedin.com/nhome')!==false || stripos($rep['headers']['location'], 'linkedin.com/home')!==false)) { echo "OK. You are In";  
  12. $hdrsArr = $liObj->headers('http://www.linkedin.com/home', 'https://www.linkedin.com'); $ck = $rep['cookies'];  
  13. $advSet = array('headers' => $hdrsArr, 'httpversion' => '1.1', 'timeout' => 45, 'redirection' => 0, 'cookies' => $ck); // prr($advSet); 
  14. $rep = nxs_remote_get('http://www.linkedin.com/profile/edit?trk=tab_pro', $advSet); if (is_nxs_error($rep)) { $badOut = print_r($rep, true)." - ERROR"; return $badOut; } $ck = $rep['cookies'];  
  15. if ($_POST['i']!='') { global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;  
  16. $options['li'][$_POST['i']]['ck'] = $ck; if (is_array($options)) update_option('NS_SNAutoPoster', $options); 
  17. }  
  18. if (!empty($_POST['s'])) { $seForDB = get_option('nxs_li_ctp_save'); $ser = maybe_unserialize($seForDB); $ck = $ser['c']; $flds = $ser['f'];  
  19. $flds['PinVerificationForm_pinParam'] = $_POST['s']; $liObj = new nxsAPI_LI(); $hdrsArr = $liObj->headers('https://www.linkedin.com/uas/login-submit', 'https://www.linkedin.com', 'POST', true); 
  20. $advSet = array('headers' => $hdrsArr, 'httpversion' => '1.1', 'timeout' => 45, 'redirection' => 0, 'cookies' => $ck, 'body' => $flds); // prr($advSet); 
  21. $rep=nxs_remote_post('https://www.linkedin.com/uas/ato-pin-challenge-submit', $advSet); if (is_nxs_error($rep)) {$badOut = print_r($rep, true)." - ERROR"; return $badOut; } $contents2 = $rep['body']; // prr($rep); 
  22.  
  23. if (stripos($contents2, 'The email address or password you provided does not match our records')!==false) { echo "Invalid Login/Password"; die(); } 
  24. if (stripos($contents2, '<div id="global-error">')!==false) { echo CutFromTo($contents2, '<div role="alert" class="alert error">', '</div>'); die(); }  
  25. if (stripos($contents2, 'Hmm, ')!==false) { echo "Invalid Login/Password"; die(); }  
  26. if ($rep['response']['code']=='302' && !empty($rep['headers']['location']) && stripos($rep['headers']['location'], 'linkedin.com/uas/ato-pin-challenge-submit')!==false) echo "Wrong Code. Please try Again"; 
  27. if ($rep['response']['code']=='302' && !empty($rep['headers']['location']) && (stripos($rep['headers']['location'], 'linkedin.com/nhome')!==false || stripos($rep['headers']['location'], 'linkedin.com/home')!==false)) echo "OK. You are In";  
  28.  
  29. $hdrsArr = $liObj->headers('http://www.linkedin.com/home', 'https://www.linkedin.com'); $ck = $rep['cookies'];  
  30. $advSet = array('headers' => $hdrsArr, 'httpversion' => '1.1', 'timeout' => 45, 'redirection' => 0, 'cookies' => $ck); // prr($advSet); 
  31. $rep = nxs_remote_get('http://www.linkedin.com/profile/edit?trk=tab_pro', $advSet); if (is_nxs_error($rep)) { $badOut = print_r($rep, true)." - ERROR"; return $badOut; } $ck = $rep['cookies'];  
  32. if ($_POST['i']!='') { global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;  
  33. $options['li'][$_POST['i']]['ck'] = $ck; if (is_array($options)) update_option('NS_SNAutoPoster', $options); 
  34. }  
  35. } die();  
  36. }}