SitePoint Sponsor

User Tag List

Page 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 54
  1. #26
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Keeping it simple:

    PHP Code:
    while ( == ) {

        echo 
    "How long can I run for?";


    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  2. #27
    Super Ninja Monkey Travis's Avatar
    Join Date
    Dec 2001
    Location
    Sioux City, Iowa
    Posts
    691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'll make sure I only try that on Tripod about 20 billion times.
    Travis Watkins - Hyperactive Coder
    My Blog: Realist Anew
    Projects: Alacarte - Gnome Menu Editor

  3. #28
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    They probably have PHP setup to timeout after a very short period

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  4. #29
    That's Right. notepad_coder's Avatar
    Join Date
    Apr 2002
    Location
    Colorado
    Posts
    835
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not just use
    PHP Code:
    while (true) {} 
    a little less coding, works the same though
    - the lid is off the maple syrup again!

  5. #30
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "True" you could do it that way, but I like 1 == 1!

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  6. #31
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm...

    What's needed is 2 scripts like Shauns which also pretend to be browsers;

    PHP Code:
    /* beavis.php */
     
    function sendToHost($host,$method,$path,$data,$useragent=0) {
        
    // Supply a default method of GET if the one passed was empty
        
    if (empty($method))
            
    $method 'GET';
        
    $method strtoupper($method);
        
    $fp fsockopen($host,80$errno$errstr30);
        if ( !
    $fp ) {
          
    $buf $errstr  " (" $errno ")<br>\n";
        }
        if (
    $method == 'GET')
            
    $path .= '?' $data;
        
    fputs($fp"$method $path HTTP/1.1\n");
        
    fputs($fp"Host: $host\n");
        
    fputs($fp"Content-type: application/x-www-form-urlencoded\n");
        
    fputs($fp"Content-length: " strlen($data) . "\n");
        if (
    $useragent)
            
    fputs($fp"User-Agent: phpMyPal v1.0 [url]http://www.phpmypal.com\n[/url]");
        
    fputs($fp"Connection: close\n\n");
        if (
    $method == 'POST')
            
    fputs($fp$data);

        while (!
    feof($fp))
            
    $buf .= fgets($fp,128);
        
    fclose($fp);
        return 
    $buf;
     }

    while ( 
    == ) {
        
    sendToHost $_SERVER['SERVER_NAME'], ""$_SERVER""$_SERVER['DOCUMENT_ROOT'] . "butthead.php""uhuhuh=uhuhuh" );

    PHP Code:
    /* butthead.php */
     
    function sendToHost($host,$method,$path,$data,$useragent=0) {
        
    // Supply a default method of GET if the one passed was empty
        
    if (empty($method))
            
    $method 'GET';
        
    $method strtoupper($method);
        
    $fp fsockopen($host,80$errno$errstr30);
        if ( !
    $fp ) {
          
    $buf $errstr  " (" $errno ")<br>\n";
        }
        if (
    $method == 'GET')
            
    $path .= '?' $data;
        
    fputs($fp"$method $path HTTP/1.1\n");
        
    fputs($fp"Host: $host\n");
        
    fputs($fp"Content-type: application/x-www-form-urlencoded\n");
        
    fputs($fp"Content-length: " strlen($data) . "\n");
        if (
    $useragent)
            
    fputs($fp"User-Agent: phpMyPal v1.0 [url]http://www.phpmypal.com\n[/url]");
        
    fputs($fp"Connection: close\n\n");
        if (
    $method == 'POST')
            
    fputs($fp$data);

        while (!
    feof($fp))
            
    $buf .= fgets($fp,128);
        
    fclose($fp);
        return 
    $buf;
     }

    while ( 
    == ) {
        
    sendToHost $_SERVER['SERVER_NAME'], ""$_SERVER""$_SERVER['DOCUMENT_ROOT'] . "beavis.php""huhuhu=huhuhu" );

    Enough already.

  7. #32
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did you try that out before you posted?

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  8. #33
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not brave enough. Instead I posted it at Hotscripts under "Server Maintenance" to see what the feedback is.

  9. #34
    SitePoint Addict EvilDoppler's Avatar
    Join Date
    Dec 2001
    Location
    Perth, Australia
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool LMAO!!!

    He he hehehe...this is like opening a can of worms (never really got that expression)....

    HarryF: I tried that locally last night and it crashed my apache (though it was running on windoze so i'm not surprised), my browser (microsoft again) and the machine basically just stopped responding.....not entirely sure what happened and/or why it did it...will try it on our internal development server here at work later today and see what happens on a linux box.

    Guess you gotta burn your fingers before you learn ???
    * Due to the last tax raise our prices has risen
    * - answers w/o thought $1 - answers w/ thought $3
    * - correct answers $10
    * - Dumb stares are still free

  10. #35
    SitePoint Addict Clete2's Avatar
    Join Date
    Mar 2002
    Location
    Columbia, South Carolina
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is a little piece of uselessness...

    (My first ever PHP script, I thought it was soooo hard back then... even though I made it by looking at Kevin's count-to-10 script, but writing in my stuff, so it's half not mine...)

    PHP Code:
    <html>
    <head>
    <center>
    <title> Counting to whatever you like</title>
    </head>
    <body>
    <link rel="stylesheet" type="text/css" href="style.css" />

    <?

    if ($num >= 10001) {
    die(
    "I thought i told you not to do anything above 10000!");
     } else {
    if (!isset(
    $num)): ?>
    <form action="<?=$PHP_SELF?>" method="Post">
    Count to (1 - 10000 only please): <input type="text" name="num"><br>
    <input type="Submit" value="Submit">
    </form>
    <?
     
    else:
      
    $count 1;
      while (
    $count <= $num) {
        echo( 
    "$count " );
        
    $count++;
      }
      
    $count--;
      
    ?> <br> <?
      
    echo "Counted to $count successfully!";
    endif;
    }

    ?>

    </center>
    </body>
    </html>
    My Blog
    My Photography Website
    Linux user #339185

  11. #36
    SitePoint Addict EvilDoppler's Avatar
    Join Date
    Dec 2001
    Location
    Perth, Australia
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    no knocking

    Hey,

    don't knock that...it's a learning curve...might be the next step up from
    PHP Code:
    <? echo "Hello World!"?>
    but it still has it's place in history..he hehehe

    not entirely sure why you made that script, except just learn loops better. I call that genuine "Uselessness"..
    * Due to the last tax raise our prices has risen
    * - answers w/o thought $1 - answers w/ thought $3
    * - correct answers $10
    * - Dumb stares are still free

  12. #37
    SitePoint Addict Clete2's Avatar
    Join Date
    Mar 2002
    Location
    Columbia, South Carolina
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: no knocking

    Originally posted by EvilDoppler
    Hey,

    don't knock that...it's a learning curve...might be the next step up from
    PHP Code:
    <? echo "Hello World!"?>
    but it still has it's place in history..he hehehe

    not entirely sure why you made that script, except just learn loops better. I call that genuine "Uselessness"..
    no ; needed on 1-line scripts...
    My Blog
    My Photography Website
    Linux user #339185

  13. #38
    SitePoint Addict EvilDoppler's Avatar
    Join Date
    Dec 2001
    Location
    Perth, Australia
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    arrggff

    no ; needed on 1-line scripts...
    geee...sorry...i guess i should consider quitting my job now

    but thanks for letting me know he heehe
    * Due to the last tax raise our prices has risen
    * - answers w/o thought $1 - answers w/ thought $3
    * - correct answers $10
    * - Dumb stares are still free

  14. #39
    SitePoint Addict Clete2's Avatar
    Join Date
    Mar 2002
    Location
    Columbia, South Carolina
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    na, it doesn't hurt to put a ;...
    My Blog
    My Photography Website
    Linux user #339185

  15. #40
    SitePoint Addict EvilDoppler's Avatar
    Join Date
    Dec 2001
    Location
    Perth, Australia
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    phew

    aaahhh phew...maybe i should keep the job then..
    * Due to the last tax raise our prices has risen
    * - answers w/o thought $1 - answers w/ thought $3
    * - correct answers $10
    * - Dumb stares are still free

  16. #41
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    my browser (microsoft again) and the machine basically just stopped responding...
    MHWUAHAHAAHAHA

    Just had another idea for the send to host function;

    PHP Code:
     function sendToHost($host,$method,$path,$data,$useragent=0) {
        
    // Supply a default method of GET if the one passed was empty
        
    if (empty($method))
            
    $method 'GET';
        
    $method strtoupper($method);
        
    $fp fsockopen($host,80$errno$errstr30);
        if ( !
    $fp ) {
          
    $buf $errstr  " (" $errno ")<br>\n";
        }
        if (
    $method == 'GET')
            
    $path .= '?' $data;
        
    fputs($fp"$method $path HTTP/1.1\n");
        
    fputs($fp"Host: $host\n");
        
    fputs($fp"Content-type: application/x-www-form-urlencoded\n");
        
    fputs($fp"Content-length: " strlen($data) . "\n");
        if (
    $useragent)
            
    fputs($fp"User-Agent: phpMyPal v1.0 <a href="http://www.phpmypal.com\n" target="_blank">[url]http://www.phpmypal.com\n[/url]</a>");
        
    fputs($fp"Connection: close\n\n");
        if (
    $method == 'POST')
            
    fputs($fp$data);

        while (!
    feof($fp))
            
    $buf .= fgets($fp,128);
        
    fclose($fp);
        return 
    $buf;
     }

    echo ( 
    "<p>" sendToHost $_SERVER['SERVER_NAME'], ""$_SERVER""$_SERVER['PHP_SELF'"mirrormirror=whoisthefairest" ) );

    $fairest = array (
         
    "You are",
         
    "Snow White is"
    );

    shuffle $fairest;

    if ( 
    $_GET['mirrormirror'] == "whoisthefairest" ) {
       echo ( 
    "<p>" $fairest[0] . " the fairest of them all");
    }
    ?> 
    What makes PHP scripts safe is their execution time limit. But with that send to host function, you "envoke" another script exactly the same way as if you had viewed it with your webpage. So it basically keeps restarting the script.

    will try it on our internal development server here at work later today and see what happens on a linux box.
    You are evil Don't think it stands a chance. As they say: the bigger the processor, the faster it crashes.

  17. #42
    SitePoint Addict EvilDoppler's Avatar
    Join Date
    Dec 2001
    Location
    Perth, Australia
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face urrggghh

    okay!!!

    the development server took just about half as long as my home machine before crashing...t'was ok i've now learned my lesson and will probably not attempt your modification in the near future.

    he hehehehehe....we can only learn from our mistakes so what matters more than screwing things up now and again ?? he hehehehe

    cheers and on with it!
    * Due to the last tax raise our prices has risen
    * - answers w/o thought $1 - answers w/ thought $3
    * - correct answers $10
    * - Dumb stares are still free

  18. #43
    SitePoint Addict EvilDoppler's Avatar
    Join Date
    Dec 2001
    Location
    Perth, Australia
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wasn't that just one brilliant excuse ?? heh ehehe

    After it smacked my home machine to pieces i wasn't really putting any money on the dev. server standing a chance on it either. It wasn't the machine itself that crashed this time though, only apache and/or php. Not sure which, my sys admin wasn't too keen on my little experiement and wouldn't allow me to go near it again so i could play with the log file. darn it!!
    * Due to the last tax raise our prices has risen
    * - answers w/o thought $1 - answers w/ thought $3
    * - correct answers $10
    * - Dumb stares are still free

  19. #44
    SitePoint Addict EvilDoppler's Avatar
    Join Date
    Dec 2001
    Location
    Perth, Australia
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question dropping out...

    The thread is dropping out of the front page..been a hype of new threads posted overnight..can't have that..
    * Due to the last tax raise our prices has risen
    * - answers w/o thought $1 - answers w/ thought $3
    * - correct answers $10
    * - Dumb stares are still free

  20. #45
    Hi there! Owen's Avatar
    Join Date
    Jan 2000
    Location
    CA
    Posts
    1,165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by notepad_coder
    Why not just use
    PHP Code:
    while (true) {} 
    a little less coding, works the same though
    PHP Code:
    while (!= 2) {} 
    is much better. it makes it so much more cryptic. Of course it isn't always true: http://www.ehumorcentral.com/Directory/Jokes/929.html

    Or how about
    PHP Code:
    while (0.11111111111111111/0.11111111111111112 == 1) {} 
    Owen

  21. #46
    SitePoint Addict EvilDoppler's Avatar
    Join Date
    Dec 2001
    Location
    Perth, Australia
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    "threading" away

    Hola folks!!

    Eventhough it's great to see soo many...uhmmm...fresh ideas coming in, we're actually not really seeing anything which could be used for something (other than the last 10 posts about running an "in-definite" loop)..

    Can't we get some more of the scripts which actually has a use somewhere (other than attempting to time-out the server) ?

    Cheers folks - sorry to sound like an old man!
    * Due to the last tax raise our prices has risen
    * - answers w/o thought $1 - answers w/ thought $3
    * - correct answers $10
    * - Dumb stares are still free

  22. #47
    That's Right. notepad_coder's Avatar
    Join Date
    Apr 2002
    Location
    Colorado
    Posts
    835
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Heres a little script I made when I first started PHP, I thought it was so cool. After about a week of using it I decided it was pretty dumb and havn't used it since.
    PHP Code:
    <?
    if ($_POST) {
        
    $n1 $_POST['numb1'];
        
    $n2 $_POST['numb2'];
        
    $a $n1 $n1;
        echo 
    $a"<br>";
        
    $a $n1 $n2;
        echo 
    $a"<br>";
        
    $a $n1 $n2;
        echo 
    $a"<br>";
        
    $a $n1 $n2;
        echo 
    $a;
    } else {
        
    ?>
        <form action="<? echo $PHP_SELF?>" method="post">
          <input type="text" name="numb1"> + - * / <input type="text" name="numb2"><br><br>
          <input type="submit" value="Do The Math">
        </form>
        <?
    }
    ?>
    Just a simple math thing.
    - the lid is off the maple syrup again!

  23. #48
    SitePoint Addict EvilDoppler's Avatar
    Join Date
    Dec 2001
    Location
    Perth, Australia
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Notey!!

    He ehehehe...

    well it's not bad for a first script...I had to tackle a forum/messageboard which at that time was "really" complicated for a youngun....

    don't even think i'd ever do another though...too boring...
    * Due to the last tax raise our prices has risen
    * - answers w/o thought $1 - answers w/ thought $3
    * - correct answers $10
    * - Dumb stares are still free

  24. #49
    That's Right. notepad_coder's Avatar
    Join Date
    Apr 2002
    Location
    Colorado
    Posts
    835
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hehe. I am very bored so I just did a page that I will probably never use again and I thought I should post it here. It's a calculator that uses JavaScript and PHP. I must say it is pretty good, for me doing it it is

    You can test it out here http://www.nathantech.com/calc.html
    PHP Code:
    <html>
      <head>
        <script language="JavaScript">
          <!--
          function addNum(num) {
            if (document.calc.way.value == "") {
              document.calc.num1.value += num;
              document.calc.num1.focus();
            } else {
              document.calc.num2.value += num;
              document.calc.num2.focus();
            } 
          }
          function c(w) {
            document.calc.way.value = "  " + w;
          }
          -->
        </script>
      </head>
      <body>
        <form name="calc" action="calc.html" method="post">
          <table cellpadding=0 cellspacing=0>
            <tr>
              <td colspan=2><input type="text" name="num1" style="width:50px" readonly></td>
              <td><input type="text" name="way" style="width:25px"></td>
              <td colspan=2><input type="text" name="num2" style="width:50px"></td>
            </tr>
            <tr></tr>
            <tr></tr>
            <tr></tr>
            <tr>
              <td><input type="button" value=" 1 " style="width:25px;height:25px;" onClick="addNum(1)"></td>
              <td><input type="button" value=" 2 " style="width:25px;height:25px;" onClick="addNum(2)"></td>
              <td><input type="button" value=" 3 " style="width:25px;height:25px;" onClick="addNum(3)"></td>
              <td rowspan=2><input type="button" value=" + " style="width:25px;height:50px;" onClick="c('+')"></td>
              <td rowspan=2><input type="button" value=" * " style="width:25px;height:50px;" onClick="c('*')"></td>
            </tr>
            <tr>
              <td><input type="button" value=" 4 " style="width:25px;height:25px;" onClick="addNum(4)"></td>
              <td><input type="button" value=" 5 " style="width:25px;height:25px;" onClick="addNum(5)"></td>
              <td><input type="button" value=" 6 " style="width:25px;height:25px;" onClick="addNum(6)"></td>

            </tr>
            <tr>
              <td><input type="button" value=" 7 " style="width:25px;height:25px;" onClick="addNum(7)"></td>
              <td><input type="button" value=" 8 " style="width:25px;height:25px;" onClick="addNum(8)"></td>
              <td><input type="button" value=" 9 " style="width:25px;height:25px;" onClick="addNum(9)"></td>
              <td rowspan=2><input type="button" value=" - " style="width:25px;height:50px;" onClick="c('-')"></td>
              <td rowspan=2><input type="button" value=" / " style="width:25px;height:50px;" onClick="c('/')"></td>
            </tr>
            <tr>
              <td colspan=2><input type="button" value=" 0 " style="width:50px;height:25px;" onClick="addNum(0)"></td>
              <td><input type="button" value=" . " style="width:25px;height:25px;" onClick="addNum('.')"></td>
            </tr>
            <tr>
              <td colspan=5><input type="submit" value=" Calculate " style="width:125px;height:25px;"></td>
            </tr>
            <?
            
    if ($_POST) {
              echo 
    str_repeat("<tr></tr>"6);
              echo 
    "<tr><td colspan=5 align=\"center\">";
              if (
    trim($_POST['way']) == "+") {
                echo 
    $_POST['num1'] + $_POST['num2'];
              } elseif (
    trim($_POST['way']) == "-") {
                echo 
    $_POST['num1'] - $_POST['num2'];
              } elseif (
    trim($_POST['way']) == "*") {
                echo 
    $_POST['num1'] * $_POST['num2'];
              } elseif (
    trim($_POST['way']) == "/") {
                echo 
    $_POST['num1'] / $_POST['num2'];
              }
              echo 
    "</td></tr>";
            }  
            
    ?>  
          </table>  
        </form>
      </body>
    </html>
    That could probably be used for something good but for now it is useless to me.
    Last edited by notepad_coder; Jun 20, 2002 at 19:31.

  25. #50
    SitePoint Addict EvilDoppler's Avatar
    Join Date
    Dec 2001
    Location
    Perth, Australia
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool WE'RE ALIVE!!

    HEY FOLKS!!

    it seems like we're back in business again. neato..

    and note, nice script...i'll try to do something useless again soon...can't have you be the only one submitting useless stuff...

    cheers n' ears
    * Due to the last tax raise our prices has risen
    * - answers w/o thought $1 - answers w/ thought $3
    * - correct answers $10
    * - Dumb stares are still free


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •