Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Template Name: Access Page
- * Access Page
- */
- $cookieDomain="toolsurf.com";
- $postURL="https://www.toolsurf.com";
- $api_params = array(
- 'slm_action' => 'slm_check',
- 'secret_key' => '5cd744b6bfe702.90811903',
- 'license_key' => $_POST["access_code"],
- );
- $errorMessages = json_decode(file_get_contents(__DIR__."/AuthErrorMessages.json",FILE_USE_INCLUDE_PATH),true);
- $salt="r@jKumar";
- $allowedIP=0;
- $ipBlocking=false;
- function clearCookies($cookieDomain){
- setcookie("seotools_data","",0,"/",$cookieDomain);
- setcookie("seotools_login","",0,"/",$cookieDomain);
- setcookie("seotools_user","",0,"/",$cookieDomain);
- }
- function getUserIP($trusted = array()) {
- $wan_ip = $_SERVER['REMOTE_ADDR'];
- foreach($trusted as &$t) {
- if ( filter_var($t, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE|FILTER_FLAG_NO_RES_RANGE|FILTER_FLAG_IPV4|FILTER_FLAG_IPV6) === false ) {
- $t = null;
- }
- }
- unset($t);
- $trusted = array_filter($trusted);
- if (filter_var($_SERVER['SERVER_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE|FILTER_FLAG_NO_RES_RANGE|FILTER_FLAG_IPV4|FILTER_FLAG_IPV6) !== false) {
- $trusted[] = $_SERVER['SERVER_ADDR'];
- }
- $ip_fields = array(
- 'HTTP_CLIENT_IP',
- 'HTTP_X_FORWARDED_FOR',
- 'HTTP_X_FORWARDED',
- 'HTTP_FORWARDED_FOR',
- 'HTTP_FORWARDED',
- 'HTTP_X_CLUSTER_CLIENT_IP',
- 'HTTP_CF_CONNECTING_IP',
- );
- foreach ( $ip_fields as $key ) {
- if ( array_key_exists( $key, $_SERVER ) === true ) {
- $proxy_list = explode( ',', $_SERVER[$key]);
- $proxy_list = array_reverse($proxy_list);
- $last = null;
- $lan = false;
- if(filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4|FILTER_FLAG_IPV6) !== false) {
- if ( filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE|FILTER_FLAG_IPV4|FILTER_FLAG_IPV6) === false ) {
- $last = $_SERVER['REMOTE_ADDR'];
- $lan = true;
- }
- }
- foreach ( $proxy_list as $k => &$ip ) {
- $ip = trim( $ip );
- if(is_null($last) || filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4|FILTER_FLAG_IPV6) === false) {
- break;
- }
- if ($lan && filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE|FILTER_FLAG_IPV4|FILTER_FLAG_IPV6) === false ) {
- $last = $ip;
- continue;
- }
- (in_array($last, $trusted) || $lan) && $wan_ip = $ip;
- !in_array($ip, $trusted) && $lan = false;
- if (in_array($ip, $trusted)) {
- $last = $ip;
- }
- else {
- $last = null;
- }
- }
- }
- }
- return $wan_ip;
- }
- global $wpdb;
- $currentTools=$wpdb->get_results( "SELECT value FROM ".$wpdb->prefix."ak_am_settings_tb WHERE name='tools'");
- $currentTools=json_decode($currentTools[0]->value,true);
- if($_SERVER["REQUEST_METHOD"]=="POST"){
- function hashify($input, $ky) {
- $key = html_entity_decode($ky);
- $iv = "@@@@&&&&####$$$$";
- $data = openssl_encrypt ( $input , "AES-128-CBC" , $key, 0, $iv );
- return $data;
- }
- function dehashify($crypt, $ky) {
- $key = html_entity_decode($ky);
- $iv = "@@@@&&&&####$$$$";
- $data = openssl_decrypt ( $crypt , "AES-128-CBC" , $key, 0, $iv );
- return $data;
- }
- if(!empty($_POST["access_code"])){
- $ch = curl_init ($postURL);
- curl_setopt ($ch, CURLOPT_POST, true);
- curl_setopt ($ch, CURLOPT_POSTFIELDS, $api_params);
- curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, false);
- $headers = array("Cache-Control: no-cache");
- curl_setopt ($ch, CURLOPT_HTTPHEADER, $headers);
- curl_setopt ($ch, CURLOPT_FRESH_CONNECT, TRUE);
- $res = json_decode(curl_exec($ch));
- if($res==null)
- $logError = "Server Error Occured.. Try Again in sometime..";
- else{
- $blocked=false;
- if($res->result=="success"){
- if($res->status=="active"){
- $check=$wpdb->get_results( "SELECT data FROM ".$wpdb->prefix . "ak_am_access_data WHERE user='{$_POST["access_code"]}'");
- $blockCode=false;
- if(sizeof($check)==1){
- $dt=json_decode($check[0]->data,true);
- $user["code"]=$_POST["access_code"];
- ...................................................................................
- ............................................
- ....................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement