Facebook Perl source code from 2005

zdkaster1 pts0 comments

Facebook Perl source code from 2005.

When browsing around thefacebook.com in 2005 the server spit out some server-side source code rather than running it. I believe this was for their old graph feature that let you visualize the graph between all your friends. The filename is `mygraph.svgz` and contains some gems such as a commented out "zuck" database username.

After they confirmed this isn't eligible for a bounty (heh), Facebook gave me permission to post it. · GitHub

/" data-turbo-transient="true" />

Skip to content

-->

Search Gists

Search Gists

Sign in

Sign up

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

Instantly share code, notes, and snippets.

philfreo/gist:7257723

Created<br>October 31, 2013 21:44

Show Gist options

Download ZIP

Star

170<br>(170)

You must be signed in to star a gist

Fork

39<br>(39)

You must be signed in to fork a gist

Embed

Select an option

Embed<br>Embed this gist in your website.

Share<br>Copy sharable link for this gist.

Clone via HTTPS<br>Clone using the web URL.

No results found

Learn more about clone URLs

Clone this repository at &lt;script src=&quot;https://gist.github.com/philfreo/7257723.js&quot;&gt;&lt;/script&gt;

" readonly="readonly" data-autoselect="true" data-target="primer-text-field.inputElement " aria-describedby="validation-195372a7-1bcb-4452-8209-a6c363585021" class="form-control FormControl-monospace FormControl-input FormControl-small rounded-left-0 rounded-right-0 border-right-0" type="text" name="gist-share-url-sized-down" />

Save philfreo/7257723 to your computer and use it in GitHub Desktop.

Embed

Select an option

Embed<br>Embed this gist in your website.

Share<br>Copy sharable link for this gist.

Clone via HTTPS<br>Clone using the web URL.

No results found

Learn more about clone URLs

Clone this repository at &lt;script src=&quot;https://gist.github.com/philfreo/7257723.js&quot;&gt;&lt;/script&gt;

" readonly="readonly" data-autoselect="true" data-target="primer-text-field.inputElement " aria-describedby="validation-29f596f9-497c-4dfc-8e31-9dfbb5b9c114" class="form-control FormControl-monospace FormControl-input FormControl-small rounded-left-0 rounded-right-0 border-right-0" type="text" name="gist-share-url-original" />

Save philfreo/7257723 to your computer and use it in GitHub Desktop.

Download ZIP

Facebook Perl source code from 2005. When browsing around thefacebook.com in 2005 the server spit out some server-side source code rather than running it. I believe this was for their old graph feature that let you visualize the graph between all your friends. The filename is `mygraph.svgz` and contains some gems such as a commented out "zuck" d…

Raw

gistfile1.pl

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.<br>Learn more about bidirectional Unicode characters

Show hidden characters

#!/usr/bin/perl

use Mysql;

use strict;

use vars qw($school_name);

use vars qw($pass);

require "./cgi-lib.pl";

#do "./school_name.pl";

do "../password.pl";

my (%input, $text, $field);

&ReadParse(\%input);

my @rawCookies = split (/; /,$ENV{'HTTP_COOKIE'});

my %cookies;

foreach(@rawCookies){

my ($key, $val) = split (/=/,$_);

$cookies{$key} = $val;

my $id = $input{id};

my $user = $input{user};

my $code = $input{code};

my $course = 0;#$input{course};

my @node;

my @edge;

#my $db_data = Mysql->connect("69.28.179.12", "login", "mark", $pass);

my $db_data = Mysql->connect("$cookies{host}", "$cookies{db}", "mark", $pass);

my $map;

if ($ENV{'HTTP_HOST'} =~ m/^(.*)\.thefacebook\.com/) {

$map = $1;

my $cookie_host = $cookies{host};

my $cookie_db = $cookies{db};

my $sql = "SELECT * FROM school_data where map='$map'";

my $retval = $db_data->query($sql);

my %rs = $retval->fetchhash();

my $host = $rs{ip};

my $dbname = $rs{db};

#my $sql = "INSERT INTO viz (user,map,host,db) VALUES ('$user', '$map','$host', '$dbname')";

#$db_data->query($sql);

my $db = Mysql->connect($host, $dbname, "mark", $pass);

#my $db = Mysql->connect("69.28.179.11", "facebook", "mark", $pass);

my $retval; my $sql;

my %privacy;

my $num_degrees = 1;

my @already_expanded;

my %cs;

sub morph {

my ($number) = @_;

return ((((($number % 7) * 13) % 17) * 19) % 23);

sub share_course {

my ($user1, $user2) = @_;

$sql = "SELECT count(*) as count FROM course as course1, course as course2 WHERE " .

"course1.id = '$user1' AND course2.id = '$user2' AND course1.course_id = course2.course_id";

$retval = $db->query($sql);

my %rs = $retval->fetchhash();

return $rs{count};

sub is_one_degree {

my ($user1, $user2) = @_;

$sql = "SELECT count(*) as count FROM friend WHERE user1 = '$user1' AND user2 =...

gist code clone input from embed

Related Articles