Live data from Hacker News

4chan source code leaked (2010)

pastebin.com

81–90 of 114 posts

Re: 4chan source code leaked (2010)

#81
post #5
post #3

It seems that it's too terrible to be the true code. "if($_COOKIE['4chan_auser']", "extract($_POST); extract($_GET); extract($_COOKIE);"

> It seems that it's too terrible to be the true code. 1. It's written in PHP. Finding a good PHP developer is nigh impossible (there are exceptions, like always). 2. I expected worse, to be honest.

>Finding a good PHP developer is nigh impossible

Yep. Worked as a sysadmin in a company who had a product in PHP before. That was not fun. The bug count grew with each release in my time there.

Re: 4chan source code leaked (2010)

#82
post #77
post #59

Earlier quoted context omitted.

I know hating on PHP is en vogue but you could probably write the same ugly code with another language too.

Not possible. Other languages have features to prevent this.

I highly doubt you have anything else to add because I'm sure you're just another person jumping on the "hate php" bandwagon - but go on, entertain me.

Please elaborate.

Re: 4chan source code leaked (2010)

#83
post #9

Earlier quoted context omitted.

this makes it even more likely that it's the real code. Let's face it, no one is expecting a shining example of software design and architectural brilliance here

The original 4chan code was in Japanese and moot used Babelfish to try figure out what did what. From what I remember, the original Futaba code is just as bad ( http://www.2chan.net/script/ ). It's no secret that 4chan is cobbled together with glue and string, moot has said this several times before.

The comments are in Japanese but if you know PHP you should be able to understand it without the comments anyway. It's a single file of less than 1K lines and written in a rather straightforward style. It's also extremely easy to setup - just edit the config parameters at the top and drop it on a webserver, and it's ready to use. Not even a database is needed.

I don't think it's "bad"; it's damn simple and works well for what it is, and contains no unnecessary complexity. No dependencies on some other huge framework, multilayered overengineering, or excessive generality. The same can't be said of the many other clones of it that were attempting to be "better designed" rewrites.

As for "maintainability" or all that other software engineering stuff: this board script doesn't really need to be maintained, because it works, and if anything needs to be changed, it's so simple that the changes can be made easily. Along the same ideas as http://suckless.org/philosophy

Re: 4chan source code leaked (2010)

#84

I think this just goes to show that you can have a lot of popularity even if your code is just sorta glued together. Don't they get a few million users? I'd say it's definitely nothing to scoff at. It makes me wonder how many big profile websites might look like this or worse.

Having worked at a couple, I think I wouldn't be too far off to say all of them. I still remember a week into the first job fresh-from-college me marching into the VPs office to tell him the source code was terrible and they were only still running due to luck. It was not well received (or right)

I almost did the same thing. But then calmed down and said maybe I have no idea what I'm talking about. I was right. I had no idea what I was talking about.

Re: 4chan source code leaked (2010)

#86
post #67

Ask HN: Would you rather have a beautiful source code with 1000 pageviews/month or an ugly source code with millions of pageviews/month?

If my business relies on it, option 1, because ugly code tends to be less maintainable and a business should not depend on magic numbers and "LOLOLO...".

If it is for personal satisfaction, option 2. I guess I don't need to explain this one.

Re: 4chan source code leaked (2010)

#87
post #9

Earlier quoted context omitted.

this makes it even more likely that it's the real code. Let's face it, no one is expecting a shining example of software design and architectural brilliance here

The original 4chan code was in Japanese and moot used Babelfish to try figure out what did what. From what I remember, the original Futaba code is just as bad ( http://www.2chan.net/script/ ). It's no secret that 4chan is cobbled together with glue and string, moot has said this several times before.

It's kind of surprising though. I wonder what the results of a 4chan re-write by 4chan users would look like. Or even splitting out some functions for re-writing.

Re: 4chan source code leaked (2010)

#88
post #12

if ($sectrip != "") { $salt = "LOLLOLOLOLOLOLOLOLOLOLOLOLOLOLOL"; #this is ONLY used if the host doesn't have openssl #I don't know a better way to get random data

a few lines down:

  system("openssl rand 448 > '".SALTFILE."'",$err);
                if ($err === 0) {
                    chmod(SALTFILE,0400);
                    $salt = file_get_contents(SALTFILE);
                }

Re: 4chan source code leaked (2010)

#89
post #10
post #5

Earlier quoted context omitted.

> It seems that it's too terrible to be the true code. 1. It's written in PHP. Finding a good PHP developer is nigh impossible (there are exceptions, like always). 2. I expected worse, to be honest.

In my experience great PHP developers tend to find a way out from developing anything in PHP.

Luckily, Javascript is always allowed in PHP projects and it can do a lot more today than it could a decade ago. Also, using it will often lead to having NodeJS on the server even if it's just for compiling assets initially.

And NodeJS is bad ass rock star tech: http://www.youtube.com/watch?v=bzkRVzciAZg

Re: 4chan source code leaked (2010)

#90
post #56
post #44

Earlier quoted context omitted.

How do you "steal" a cookie?

Get on the same WiFi as your target, open up Wireshark and grab their HTTP communications. To make this easier, there was/is a tool called Firesheep that can be used to hijack session cookies. The popularity of Firesheep caused many sites to enable HTTPS by default (e.g. Facebook did so).

If you need to be on the same WiFi as your target I really don't see the big problem, realistically speaking.
Post reply on HN