HN user

menelaus35

23 karma
Posts2
Comments7
View on HN

Write an API for my client app which returns user's data as JSON (or render HTML page for profile);

You:

<!-- api.php -->

{

<?php

mysql_connect("host", "pass"); mysql_select_db("users");

$uid = $_GET[ "uid" ];

$res = mysql_query( "select * from users where uid = $uid" );

$ar = mysql_fetch_assoc( $res );

echo "name: " . $ar["name"] . ","; echo "location: " . $ar["location"];

?>

}

<!-- end of api.php -->

Just call it http://domain.com/api.php?uid=USER_ID

( Yeah I know you want to scream and say all the things about this code, but this is kind of code you would encounter with PHP, most of the time it's more horrifying than this one. )

People use it PHP for this reason, If you want to make same functionality in another language you need to setup an app and all the necessary things that protect you from garbage, some obvious security issues and bugs, not a single file like this. It's so easy and so wrong, it should be illegal to do this. Create a file and put it into directory and call it from your browser. You don't have to know anything about web or web servers and stuff. You just make shit by copying and pasting from internet, that's why Facebook made by PHP and now there are whole teams who are trying to protect company from PHP horrors. (They made a PHP VM, bunch of software to analyze PHP and optimize it etc. )

Just don't try to justify PHP, do not defend it. It's shit and you know it, accept it and move on.

(Note: do you remember Facebook's profile.php pages, they are still exists you can call it just like old times profile.php?id=YOUR_ID, yeah it's a shit once you get infected you're not gonna get out of it completely. Even if you can, it leaves traces on you just like profile.php URL's

How big is a billion? If you start counting and increment per second,it takes nearly 32 years (more than that) to complete. I think it's a big number for a product to sell that much. If you consider the world population, that makes it even more dramatic. Big accomplishment.

JPG Internet 12 years ago

just awesome! "maybe" helpful to some and at the same time it's satirical and funny. This just made my day :)

My Email to Paypal 12 years ago

I don't treat anyone like this but I thought maybe they take it seriously if it's written like this.( not justify it.. ) I don't think anyone at Paypal offend from this. I didn't mean it while writing actually. If it's too much, forgive me for not being native english speaker. Anyway, not allowing to paste seems not ok for a giant tech company Paypal. In my country banks have similar stupid forms and ways to "protect" people I don't think it's helping but to day I didn't complain any of them. Because I know almost nobody take it contact forms like this seriously. For this case I wanted to make it interesting, maybe it'll get to somebody there.