校验和失败

发布于 2024-10-16 01:22:18 字数 2969 浏览 6 评论 0原文

我有这个脚本,它产生以下错误: 001 Checksum failure

这是脚本,我不知道它有什么问题,你能帮我吗?

<?php 

/*  

  Access control for TargetPay Pay per Use  
  (C) TargetMedia 2007 

  Upload this file in the protected directory and make sure  
  that .htaccess support is enabled. 

  MODIFICATIONS IN THIS CODE ARE ALLOWED BUT NOT SUPPORTED 

  Product-ID: 28717    Generated: 16-01-2011 14:57:05 

*/ 

define ("CHECKSUM", "739b54dc26"); 
define ("ERR001", "001 Checksum failure"); 
define ("ERR002", "002 Can't open .htaccess for writing. Check rights."); 
define ("ERR003", "003 I/O Error, cannot write to .htaccess. Disk full?");

list($thispage) = explode("?", 
    "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]); 

$payscreen = "http://www.targetpay.nl/send/?id=28717&rtlo=51090". 
    "&pm=".urlencode("inline=1"). 
    "&ref=".urlencode($thispage); 

header ("Content-type: text/plain"); 

if ($_GET["checksum"] != CHECKSUM) { 
    die (ERR001); 
    } 

function ip2hex ($ip) { 
    list ($a,$b,$c,$d) = explode(".", $ip); 
    return    str_pad(dechex($a),2,"0",STR_PAD_LEFT). 
            str_pad(dechex($b),2,"0",STR_PAD_LEFT). 
            str_pad(dechex($c),2,"0",STR_PAD_LEFT). 
            str_pad(dechex($d),2,"0",STR_PAD_LEFT); 
    } 

function hex2ip ($hex) { 
    return  hexdec(substr($hex,0,2)).".". 
            hexdec(substr($hex,2,2)).".". 
            hexdec(substr($hex,4,2)).".". 
            hexdec(substr($hex,6,2)); 
    } 

function parse ($whitelist, $payscreen) { 
    $here = substr($_SERVER["SCRIPT_FILENAME"], 
        strrpos ($_SERVER["SCRIPT_FILENAME"], "/") + 1); 

    $o =    "ErrorDocument 403 $payscreen\n". 
            "<Files .htaccess>\n". 
            "Order allow,deny\n". 
            "Deny from all\n". 
            "</Files>\n". 
            "<Files $here>\n". 
            "Order allow,deny\n". 
            "Allow from all\n". 
            "</Files>\n". 
            "Order deny,allow\n". 
            "Deny from all\n"; 

    if ((!$whitelist) || ($whitelist=="empty")) { 
        return $o; } 

    $iplist = explode(",", $whitelist); 
    foreach ($iplist as $hex) { 
        $ip = hex2ip ($hex); 
        if ($ip) { 
            $o .= "Allow from $ip\n"; 
            } 
        } 
    return $o; 
    } 

if ($_GET["register"]) { 
    $fp = @fopen(".htaccess", "w+"); 
    if (!$fp) { 
        die (ERR002); 
        } 
    if (!@fwrite ($fp, parse($_GET["register"],$payscreen))) { 
        die (ERR003); 
        } 
    @fclose ($fp); 
    echo "000 OK"; 
    } 

if ($_GET["reset"]) { 
    @unlink (".htaccess"); 
    $fp = @fopen(".htaccess", "w+"); 
    if (!$fp) { 
        die (ERR002); 
        } 
    if (!@fwrite ($fp, parse("",$payscreen))) { 
        die (ERR003); 
        } 
    @fclose ($fp); 
    echo "000 RESET OK"; 
    } 

if ($_GET["dump"]) { 
    echo @implode("",file(".htaccess")); 
    echo "\n-EOF-"; 
    } 
?>

非常感谢!

I've got this script and it produces the following error: 001 Checksum failure

This is the script, I don't know what's wrong with it, could you help me?

<?php 

/*  

  Access control for TargetPay Pay per Use  
  (C) TargetMedia 2007 

  Upload this file in the protected directory and make sure  
  that .htaccess support is enabled. 

  MODIFICATIONS IN THIS CODE ARE ALLOWED BUT NOT SUPPORTED 

  Product-ID: 28717    Generated: 16-01-2011 14:57:05 

*/ 

define ("CHECKSUM", "739b54dc26"); 
define ("ERR001", "001 Checksum failure"); 
define ("ERR002", "002 Can't open .htaccess for writing. Check rights."); 
define ("ERR003", "003 I/O Error, cannot write to .htaccess. Disk full?");

list($thispage) = explode("?", 
    "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]); 

$payscreen = "http://www.targetpay.nl/send/?id=28717&rtlo=51090". 
    "&pm=".urlencode("inline=1"). 
    "&ref=".urlencode($thispage); 

header ("Content-type: text/plain"); 

if ($_GET["checksum"] != CHECKSUM) { 
    die (ERR001); 
    } 

function ip2hex ($ip) { 
    list ($a,$b,$c,$d) = explode(".", $ip); 
    return    str_pad(dechex($a),2,"0",STR_PAD_LEFT). 
            str_pad(dechex($b),2,"0",STR_PAD_LEFT). 
            str_pad(dechex($c),2,"0",STR_PAD_LEFT). 
            str_pad(dechex($d),2,"0",STR_PAD_LEFT); 
    } 

function hex2ip ($hex) { 
    return  hexdec(substr($hex,0,2)).".". 
            hexdec(substr($hex,2,2)).".". 
            hexdec(substr($hex,4,2)).".". 
            hexdec(substr($hex,6,2)); 
    } 

function parse ($whitelist, $payscreen) { 
    $here = substr($_SERVER["SCRIPT_FILENAME"], 
        strrpos ($_SERVER["SCRIPT_FILENAME"], "/") + 1); 

    $o =    "ErrorDocument 403 $payscreen\n". 
            "<Files .htaccess>\n". 
            "Order allow,deny\n". 
            "Deny from all\n". 
            "</Files>\n". 
            "<Files $here>\n". 
            "Order allow,deny\n". 
            "Allow from all\n". 
            "</Files>\n". 
            "Order deny,allow\n". 
            "Deny from all\n"; 

    if ((!$whitelist) || ($whitelist=="empty")) { 
        return $o; } 

    $iplist = explode(",", $whitelist); 
    foreach ($iplist as $hex) { 
        $ip = hex2ip ($hex); 
        if ($ip) { 
            $o .= "Allow from $ip\n"; 
            } 
        } 
    return $o; 
    } 

if ($_GET["register"]) { 
    $fp = @fopen(".htaccess", "w+"); 
    if (!$fp) { 
        die (ERR002); 
        } 
    if (!@fwrite ($fp, parse($_GET["register"],$payscreen))) { 
        die (ERR003); 
        } 
    @fclose ($fp); 
    echo "000 OK"; 
    } 

if ($_GET["reset"]) { 
    @unlink (".htaccess"); 
    $fp = @fopen(".htaccess", "w+"); 
    if (!$fp) { 
        die (ERR002); 
        } 
    if (!@fwrite ($fp, parse("",$payscreen))) { 
        die (ERR003); 
        } 
    @fclose ($fp); 
    echo "000 RESET OK"; 
    } 

if ($_GET["dump"]) { 
    echo @implode("",file(".htaccess")); 
    echo "\n-EOF-"; 
    } 
?>

Many thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

多情癖 2024-10-23 01:22:18

我不认为这是一个错误。实际上

if($_GET["checksum"] != CHECKSUM) { 
    die (ERR001);
}

这个条件已经成立,所以输出没有错误。
因此,只需从最初获取数据的任何位置检查 GET 数据即可。这肯定不是程序错误。

i dont think its an error. actually

if($_GET["checksum"] != CHECKSUM) { 
    die (ERR001);
}

this condition is getting true, so the output not error.
so just check the GET data from wherever you are getting it initially.Its not a programmatic error for sure.

从﹋此江山别 2024-10-23 01:22:18

你需要通过 GET 调用脚本,至少使用这个参数:

checksum=739b54dc26

所以如果你的页面是 test.php,在本地主机上,这样调用它(当然你可以在请求字符串中添加其他参数):

http://localhost/test.php?checksum=739b54dc26

希望它有帮助

you need to invoke the script via GET with, at least, this parameter:

checksum=739b54dc26

so if your page is test.php, on localhost, call it this way (you may add other parameters to the request string of course):

http://localhost/test.php?checksum=739b54dc26

Hope it helps

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文