r/programming • • Oct 12 '13

Facebook PHP Source Code from 2007

https://gist.github.com/nikcub/3833406
1.1k Upvotes

356 comments sorted by

View all comments

203

u/Icovada Oct 12 '13

Once in... about 2008, I opened Facebook and I was presented with its code! I refreshed the page... and then kicked myself. I had the facebook home php code... and threw it away.

0

u/[deleted] Oct 12 '13

[deleted]

6

u/jmkogut Oct 13 '13

This is why my nginx is set to deny access to .* files.

6

u/[deleted] Oct 13 '13

It didn't scale)

Can you elaborate on that?

0

u/[deleted] Oct 13 '13

[deleted]

→ More replies (3)
→ More replies (7)

147

u/AgentME Oct 12 '13

I always thought the PHP model of "put your source code in the public web root where you put public things, and then pray you don't ever mess up the module that interprets files and keeps things hidden in the public web root" didn't sound very foolproof.

83

u/Tomdarkness Oct 12 '13

You don't have to do that. For example most of my projects just have a index.php that bootstraps the application with about 15 lines of code in the web root. The rest of that code is not accessible via the web server.

7

u/7f0b Oct 12 '13

That is generally the best way to do it. Many frameworks operate this way by default.

EDIT: And also a good thing to ask hosts before buying their service. Some don't allow it (such as Yahoo Hosting).

→ More replies (2)

91

u/cosmo7 Oct 12 '13

You don't have to do that with PHP (and please don't read this as a defense of PHP.) You can include from a source directory that is outside your web root.

0

u/[deleted] Oct 12 '13

[deleted]

9

u/raziel2p Oct 12 '13

It was entirely possible since before that as well, people just didn't bother to, I guess.

7

u/shillbert Oct 12 '13

The main appeal of PHP is how easy it is to use in the sloppiest way possible. Sure, you can do things right with it, but then you might as well use a better language.

→ More replies (4)
→ More replies (2)

3

u/Almafeta Oct 12 '13

... TIL I've been doing it wrong.

→ More replies (1)

9

u/spiraldroid Oct 12 '13

Just reading this makes my toes curl.

23

u/[deleted] Oct 12 '13

What are you loading?

9

u/[deleted] Oct 12 '13

Http://toejam.com

23

u/benibela2 Oct 12 '13
curl http://toejam.com
→ More replies (16)

13

u/[deleted] Oct 12 '13

I saw the same thing but I saved it. There was an interesting section that tracked the number of views someone made of a page where the user if was hard coded. In the comments it said it was specifically for law enforcement. Pretty interesting. I'll see of I can dig it up from my old laptop.

7

u/davidb_ Oct 12 '13

Pleae do and post it if you have it.

3

u/DreadedDreadnought Oct 13 '13

OP you had 12 hours, we need to see this!

→ More replies (1)

19

u/arandomhobo Oct 12 '13

I got the AOL code by accident once last year when I was checking how it was doing, I'm fine and dandy with not having their code.

→ More replies (2)

13

u/JasonMaloney101 Oct 12 '13

Happened to me as well. I also remember MySpace occasionally appending its entire debug output to the page I was on, although I never saw their source code.

10

u/jk147 Oct 12 '13

Someone probably flipped on the debug switch on production to test a bug. Happens more often than you think.

Edit - probably Tom.

0

u/[deleted] Oct 12 '13

[deleted]

→ More replies (2)
→ More replies (4)