Click here to Skip to main content
15,885,767 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: The world of acronyms Pin
_Erik_19-Nov-10 4:42
_Erik_19-Nov-10 4:42 
GeneralRe: The world of acronyms Pin
Jalapeno Bob19-Nov-10 5:59
professionalJalapeno Bob19-Nov-10 5:59 
GeneralRe: The world of acronyms Pin
Steve Echols19-Nov-10 6:34
Steve Echols19-Nov-10 6:34 
GeneralRe: The world of acronyms Pin
Earl Truss19-Nov-10 11:20
Earl Truss19-Nov-10 11:20 
GeneralRe: The world of acronyms Pin
Ashish Kaila19-Nov-10 6:38
Ashish Kaila19-Nov-10 6:38 
GeneralRe: The world of acronyms Pin
Adrian Cole19-Nov-10 6:45
Adrian Cole19-Nov-10 6:45 
GeneralRe: The world of acronyms Pin
Earl Truss19-Nov-10 11:19
Earl Truss19-Nov-10 11:19 
GeneralWhen the CEO becomes a developer IV PinPopular
imagiro7-Nov-10 7:41
imagiro7-Nov-10 7:41 
In this software users have virtual money (so called 'coins'). You donate (real money) to get coins or you are very active on the platform, and for these coins you can buy extra features.

Recently the CEO asked me, why some users have millons of 'coins' on there account. So I looked at the code and I found this:
<p>This will cost you 9.99 of your coins.
Please acknowledge the transaction by clicking
on "Pay"</p>
<form method="post" action="">
(more stuff)
<input type="hidden" name="amount" value="9.99">
<input type="button" value="Pay">
</form>

And the PHP looked like this:
$query = "SELECT * FROM user WHERE id = $id";
$res = mysql_query($query);
while($row = mysql_fetch_array($res))
{
  $amount = $row["amount"];
}
$amount = $amount - $_POST[amount];
$query = "UPDATE user SET amount = $amount WHERE id = $id";

I will not talk about all the other errors and flaws here, I'm just asking you: How is the math for:
4.55 -
-1,000,000 ?
GeneralRe: When the CEO becomes a developer IV Pin
Jeroen De Dauw7-Nov-10 12:28
Jeroen De Dauw7-Nov-10 12:28 
Jokemake an article please Pin
Kevin Drzycimski7-Nov-10 12:39
Kevin Drzycimski7-Nov-10 12:39 
GeneralRe: When the CEO becomes a developer IV Pin
Billy-T7-Nov-10 20:15
Billy-T7-Nov-10 20:15 
JokeRe: When the CEO becomes a developer IV Pin
_fboy_7-Nov-10 23:09
_fboy_7-Nov-10 23:09 
GeneralRe: When the CEO becomes a developer IV Pin
OriginalGriff7-Nov-10 23:38
mveOriginalGriff7-Nov-10 23:38 
GeneralWhen the CEO becomes a developer III PinPopular
imagiro5-Nov-10 0:27
imagiro5-Nov-10 0:27 
GeneralRe: When the CEO becomes a developer III Pin
Jeroen De Dauw5-Nov-10 7:29
Jeroen De Dauw5-Nov-10 7:29 
GeneralRe: When the CEO becomes a developer III Pin
imagiro6-Nov-10 4:03
imagiro6-Nov-10 4:03 
GeneralRe: When the CEO becomes a developer III Pin
richard_k6-Nov-10 13:05
richard_k6-Nov-10 13:05 
GeneralRe: When the CEO becomes a developer III Pin
imagiro7-Nov-10 7:25
imagiro7-Nov-10 7:25 
GeneralWhen the CEO becomes a developer II PinPopular
imagiro3-Nov-10 22:16
imagiro3-Nov-10 22:16 
GeneralRe: When the CEO becomes a developer II Pin
CDP18024-Nov-10 4:23
CDP18024-Nov-10 4:23 
GeneralRe: When the CEO becomes a developer II Pin
GibbleCH4-Nov-10 4:56
GibbleCH4-Nov-10 4:56 
GeneralRe: When the CEO becomes a developer II Pin
imagiro4-Nov-10 6:31
imagiro4-Nov-10 6:31 
GeneralRe: When the CEO becomes a developer II Pin
PIEBALDconsult4-Nov-10 17:15
mvePIEBALDconsult4-Nov-10 17:15 
GeneralRe: When the CEO becomes a developer II Pin
Nagy Vilmos7-Nov-10 21:54
professionalNagy Vilmos7-Nov-10 21:54 
GeneralRe: When the CEO becomes a developer II Pin
Peter_in_27807-Nov-10 23:34
professionalPeter_in_27807-Nov-10 23:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.