The PHP Master Architect



  • @ChZEROHag said:

    @spxza said:

    Hmmmm....a daemon written in PHP. That would be interesting....

    ...
    echo -n "Starting Ball Daemon..."
    $BALLD >$OUTPUT_LOG 2>&1 &
    echo "balld."

    Ok I noobed out there.  I thought that someone had actually written a "ball" daemon.  Throw something at my daemon (wall) and you'll get it right back.  Throw something too hard and you'll break (halt) my wall.



  • @ChZEROHag said:

    @spxza said:

    Hmmmm....a daemon written in PHP. That would be interesting....

    Funny you should mention that. An excerpt from the mess I am no longer having anything to do with (with its name obfuscate):

    #!/bin/sh
    BALLD=/ball/balld/balld.php
    OUTPUT_LOG=/var/log/ball/balld.out
    BALLD_PID=`ps ax |grep balld |grep php |grep -v grep | awk '{print $1}'`
    ...
                    echo -n "Starting Ball Daemon..."
                    $BALLD >$OUTPUT_LOG 2>&1 &
                    echo "balld."

    And, for kicks, here's some more:

    #!/usr/bin/php -q
    ...
    while(! $quit) {
    ...
            $client = socket_accept($socket);
            logmsg("Connection received", 1);
            $input = socket_read($client, 4096);
    
            logmsg("Received : " . $input, 2);
            if($quiet == 0)
                    echo "Received : " . $input . "\n";
    
            $command = explode($split_char, $input, 2);
            if(! $command[1]) $command[1] = "null";
    
            if( ${$command[0]})
                    eval('$output = ' . ${$command[0]} . "(" . $command[1] . ");");
            else
                    $output = $error_msg;
    
            logmsg("Sending : " . $output, 2);
            socket_write($client, $output);
    
            socket_close($client);
            logmsg("Connection closed", 2);
    }

    And if that's not enough:

    if($halt) {
            logmsg("Shutting down system...\n");
            exec("/sbin/halt");
    }

    Yes, it all runs as root...

    Dear God, Why? Yours sincerely Nick


  • @spxza said:

    Dear God,
    Why?
    Yours sincerely
    Nick

    Because:

    if you persist in regarding anything written in php and or mysql as useless and hopeless then i think you're in the wrong job. pretty much everything we've done uses those languages, if only because lots of us understand them and we can easily get stuff done that way.

    Yes he did actually say 'lots of us understand them'. Ignoring the fact that actually this is incorrect, 'us' consists of him and, uh, his previous employee.

    By the way, that really is the beginning of a sentence. The utter lack of capitalisation is part of the quote and is no doubt a sign of something or other.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.