dongranding3909 2010-07-31 04:42
浏览 35

超出最大执行时间(PHP)

im getting this error, and i don't know why.

Fatal error: Maximum execution time of 30 seconds exceeded in E:\web\autoopti\thanks.php on line 65

The code I have for the PHP script is:

<?php
    $key = 129;

    $email = $_REQUEST["payer_email"];
    $first = $_REQUEST["first_name"];
    $last = $_REQUEST["last_name"];
    $acode = $_REQUEST["hash"];

    $txt = $email . "|" . $email . "|" . $first . "|" . $last . "|" . $acode;
    $outtxt = '';

    for($i=0;$i<strlen($txt);)
    {
        for($j=o;$j<strlen($key);$j++,$i++)
        {
            $outtxt .= $txt{$i} ^ $key{$j};
        }
    }

    echo "thanks";
?>

And the line the error message refers to is:

$outtxt .= $txt{$i} ^ $key{$j};

So, I'm guessing it's just taking too long for this line of code to do its work. Can somebody please help me fix this?

Thank you

  • 写回答

5条回答 默认 最新

  • douren2395 2010-07-31 04:46
    关注

    You have an infinite loop. $j starts at o (which is converted to 'o', since there is no o constant), rather than 0, and:

    $j = 'o';
    $j++;
    

    results in $j = 'p' (even though 'o' + 1 is 1...)

    It continues with $j eventually going from 'z' to 'aa'. Any non-numeric string is < any number, so the inner loop is infinite.

    I'm not really sure what the point of the script is. But it looks like you're trying to do some home-grown encryption or hashing, which is often a mistake. Look at mcrypt and hash instead.

    EDIT: My initial answer was wrong about the cause of the infinite loop.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用