Hall of Fame
5 Ways to show that you're l33t
Submitted by phrax on Fri, 2004-11-05 15:20. Hall of Fame | Wonky CodeSomebody sent this in yesterday, it's in German, but bad code is bad in any language. There are so many WTFs with this code I had to summarize the best WTFs for you:
list($as,$nl)=explode("0","array_slice0<br>\n");
I guess actually declaring the variables $as and $nl took too many lines of code.» 12 comments | read more
Why is my code so slow?
Submitted by phrax on Thu, 2004-10-28 15:13. Hall of Fame | Bad ArchitectureDon't you hate it when the Internet makes your PHP run slow? I do. Props to Andrew Lindeman for sending this snippet in. I trimmed it to reduce the boring.
This code checks the status of a bunch of Diablo II game servers and generates a pretty table that shows a server's status. Unfortunately the code runs really, really slow. Damn the Internet!
<style type="text/css"> <!-- ... --> </style> <p align="center" class="style1">Overall PKA Server Status</p> <table width="100%" border="0" align="center" cellspacing="0"> <tr bordercolor="#990000" bgcolor="#990000"> <td><strong>Diablo II Realms </strong></td> <td bgcolor="#FF0000"><span class="style5">Status</span></td> <td bgcolor="#660000"><strong>Diablo II Game Servers 1 </strong></td> <td bgcolor="#660000"> </td> <td bgcolor="#660000"><span class="style6">Diablo II Game Servers 2 </span></td> <td bgcolor="#660000"> </td> </tr> <tr> <td width="172">Diablo II Open Server is :</td> <td width="121"><?php if ($fp = @fsockopen("bnet.pkaclan.com","6112")) { echo "<img src=images/open.gif>"; } else { echo "<img src=images/closed.gif>"; } ?></td> ... </tr> <tr> <td>PKA Realm is :</td> <td><?php if ($fp = @fsockopen("bnet.pkaclan.com","6113")) { echo "<img src=images/open.gif>"; } else { echo "<img src=images/closed.gif>"; } ?></td> <td>D2GS PKA1.1(Soulzek):</td> <td><?php if ($fp = @fsockopen("68.56.114.98","4000")) { echo "<img src=images/open.gif>"; } else { echo "<img src=images/closed.gif>"; } ?></td> <td> </td> <td> </td> </tr> <tr> <td>PvP Realm is :</td> <td><?php if ($fp = @fsockopen("bnet.pkaclan.com","7113")) { echo "<img src=images/open.gif>"; } else { echo "<img src=images/closed.gif>"; } ?></td> <td>D2GS PvP1.09(<SPAN class=postbody>Shiznoo</SPAN>):</td> <td><?php if ($fp = @fsockopen("141.158.150.28","4000")) { echo "<img src=images/open.gif>"; } else { echo "<img src=images/closed.gif>"; } ?></td> <td> </td> <td> </td> </tr> <tr> <td>Ancestrall Recall Realm is :</td> <td><?php if ($fp = @fsockopen("bnet.pkaclan.com","8113")) { echo "<img src=images/open.gif>"; } else { echo "<img src=images/closed.gif>"; } ?></td> <td>D2GS AR1.10(Wallbot):</td> <td><?php if ($fp = @fsockopen("wow.pkaclan.com","4000")) { echo "<img src=images/open.gif>"; } else { echo "<img src=images/closed.gif>"; } ?></td> <td> </td> <td> </td> </tr> <tr> <td>Hell Unleashed Realm is : </td> <td><?php if ($fp = @fsockopen("bnet.pkaclan.com","9113")) { echo "<img src=images/open.gif>"; } else { echo "<img src=images/closed.gif>"; } ?></td> <td>D2GS HU1.10 (Gnecromancer): </td> <td><?php if ($fp = @fsockopen("24.71.57.148","4000")) { echo "<img src=images/open.gif>"; } else { echo "<img src=images/closed.gif>"; } ?></td> <td>D2GS HU1.10 (D2Classic): </td> <td><?php if ($fp = @fsockopen("69.133.108.231","4000")) { echo "<img src=images/open.gif>"; } else { echo "<img src=images/closed.gif>"; } ?></td> </tr> <tr bgcolor="#990000"> ... more of the same ...