Question

I have 2 problems. Heres my script.....

<?php

   echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">";
echo "<head>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />";
echo "<link href=\"/library/skin/tool_base.css\" type=\"text/css\" rel=\"stylesheet\" media=\"all\" />";
echo "<link href=\"/library/skin/default/tool.css\" type=\"text/css\" rel=\"stylesheet\" media=\"all\" />";
echo "<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />";
echo "<title>Etudes</title>";
echo "<script type=\"text/javascript\" language=\"JavaScript\" src=\"/library/js/headscripts.js\"></script>";
echo "</head>";
echo "<body>";

echo "<script type=\"text/javascript\" language=\"JavaScript\">";
echo "focus_path = [\"eid\"];";
echo "</script>";

echo "<form id=\"form\" method=\"post\" target='_blank' action=\"www.xxxxx.com" enctype=\"application/x-www-form-urlencoded\">";
echo "<table border=\"0\" class=\"loginform\" summary=\"layout\">";         
echo "<label for=\"eid\">User id</label>";                                      
echo "<input name=\"eid\" id=\"eid\"  type=\"text\" value=\"USERNAME\"/>";                                      
echo "<label for=\"pw\">Password</label>";

$pass1 = "0";
$pass2 = "0";
$pass3 = "0";
$pass4 = "0";

set_time_limit(0);

for($i = 0; $i < 2; $i++)
{
$pass = $pass1.$pass2.$pass3.$pass4;

echo "$pass";

echo "<input name=\"pw\" id=\"pw\"  type=\"password\" value=\"$pass\"/>";

echo "<script language=\"Javascript\" type=\"text/javascript\">";

echo "document.forms[\"form\"].submit();";

echo "</script>";

   $pass4 = $pass4 + 1; 

if($pass4 == 10)
{
    $pass3 = $pass3 + 1;
    $pass4 = 0;
}
if($pass3 == 10)
{
    $pass2 = $pass2 + 1;
    $pass3 = 0;
}
if($pass2 == 10)
{   
    $pass1 = $pass1 + 1;
    $pass2 = 0;
}
if($pass1 == 10)
{
    echo "Fail";
    break;
}
  usleep(10000000);
  flush();
  ob_flush;
}

?>                      
</table>                        
</form>                 

</table>

</body>
</html>

/////////////////////////////////////////////////////////////////

Problem 1) I have tried usleep() and sleep(), it worked a few times at first, executed the file, then delayed the time, then executed, then delayed, ect. But after the 3rd time it didnt work.

Problem 2) If i login to "www.xxx.com" without the loop, it works just fine, but when i put it in a loop, e.g(Lets say password is 0002): Login: USERNAME Password: 0000

Invalid Login!

Login: USERNAME Password: 0001

Invalid Login!

Login: USERNAME Password: 0002

Invalid Login!

..still gives me an invalid Login! Any help would be greatly appreciated :) Thank you.

Was it helpful?

Solution

Problem 1) I think you are reaching the maximum execution time, a configurable limit that a PHP imposes on scripts. PHP scripts are usually not long lived programs. They are suposed to execute quickly, one pageview, one script, so as a security measure (preventing Denial of Service attacks), scripts that live longer than, say, 60 seconds are simply aborted. Check your php.ini for that configuration value.

Problem 2) Have you commented out the "submit" part of your script and checked the output? I think that your program prints the beginning of the form only once, and then try to print the rest of it 9999 times. Furthermore, it will only work the first time, because if you submit a form, the browser will simply leave your page (and your script) and it will not be able to submit a second time.

You should use CURL for getting a response from an external site.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top