forked from kylemcdonald/socialroulette.net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
316 lines (262 loc) · 11.1 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
<?php
ini_set("display_errors", 1);
error_reporting(E_ALL);
require 'facebooksdk/src/facebook.php';
require 'cfg.php';
//Get Path
$path = explode('/',str_replace('?'.$_SERVER['QUERY_STRING'],'',$_SERVER['REQUEST_URI']));
array_shift($path);
// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
'appId' => Config::appId,
'secret' => Config::secret,
));
// Get User ID
$user = $facebook->getUser();
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
$loginUrl = $facebook->getLoginUrl(array('scope' => 'publish_stream, email'));
?>
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Social Roulette</title>
<meta name="description" content="Social Roulette has a 1/6 chance of deleting your account, 5/6 chance that it just posts 'you played' to your timeline.">
<meta http-equiv="Content-Type" content="text/html;">
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<link rel="stylesheet" type="text/css" href="css/theme.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<meta property="og:title" content="Social Roulette" />
<meta property="og:type" content="article" />
<meta property="og:url" content="http://socialroulette.net" />
<meta property="og:image" content="http://socialroulette.net/img/256.png" />
<style type="text/css">
#play {background: red;}
#roulette {
width: 256px;
height: 256px;
margin:0 auto;
top:0px;
position:relative;
}
#rouletteBackground{
position:absolute;
background-image: url("animation/roul1.png");
background-size:256px;
width: 256px;
height: 256px;
}
#rouletteRotater{
position:absolute;
background-image: url("animation/roul3.png");
background-size:256px;
width: 256px;
height: 256px;
}
#rouletteCrosshair{
position:absolute;
background-image: url("animation/crosshgair.png");
background-size:256px;
width: 256px;
height: 256px;
}
</style>
</head>
<body>
<div class="navbar navbar-inverse navbar-roulette">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://socialroulette.net/">
<strong>Social Roulette</strong>
</a>
<div class="nav-collapse collapse">
<ul class="nav pull-right">
<li><a href="http://twitter.com/roulettenet"><img src="./img/twitterIcon.png" class="twitterIcon">Twitter</a></li>
<li><a href="mailto:[email protected]"><img src="./img/mailIcon.png" class="contactIcon">Contact</a></li>
</ul>
</div>
</div>
</div>
</div>
<div style="padding-top: 30px; padding-bottom: 20px; text-align: center;" class="roulette-title-background row-fluid">
<div class="span4 rouletteQuoteSpan" id="appQuote"><img src="./img/quote.png" class="rouletteQuote" width="256" height="169"></div>
<?php if($user): ?>
<div class="span4">
<div id="roulette">
<div id="rouletteBackground"></div>
<div id="rouletteRotater"></div>
<div id="rouletteCrosshair"></div>
</div>
</div>
<?php else: ?>
<div class="span4" id="appIcon"><img src="./img/256_2.png" width="256" height="256"></div>
<?php endif;?>
<div class="span4" id="downloadArea" style="margin-left:0px; margin-top: 90px;">
<?php if($user): ?>
<a class="btn btn-large btn-primary" id="play" href="">Play Social Roulette Now</a>
<?php else: ?>
<a class="btn btn-large btn-primary" href="<?php echo $loginUrl?>">Sign in to play Social Roulette</a>
<?php endif;?>
<br/><br/>
<div class="fb-like" data-href="http://socialroulette.net/" data-send="false" data-layout="box_count" data-width="450" data-show-faces="false" data-font="arial"></div>
</div>
<div style="clear: both;text-shadow: 0px 1px 1px #91999d; color:black; font-size:30px; padding: 15px 55px 0px 55px; line-height: 50px" id="result">Social Roulette has a 1 in 6 chance of deleting your account.<br/>What are you afraid of?</div></div>
<div class="container center">
<div class="dlead dmargintop dmarginbottom">Testimonials</div>
<div class="justify maintext"><h4>"Social Roulette just rewrote the rules for online gaming." <small><a href="http://gawker.com/">Gawker</a></small></h4></div>
<div class="justify maintext"><h4>"*Man, if only these hackers could make up their mind." <small><a href="https://twitter.com/bruces">Bruce Sterling</a></small></h4></div>
<div class="justify maintext"><h4>"It's the most exciting thing I've done this year." <small><a href="http://daringfireball.net/">John Gruber</a></small></h4></div>
<div class="justify maintext"><h4>"I still can't tell whether I won or not." <small><a href="http://twitter.com/FaltyDL">FaltyDL</a></small></h4></div>
</div>
<hr class="roulette">
<div class="container center">
<div class="dlead dmargintop dmarginbottom">The Story</div>
<div class="justify maintext">Social Roulette has a 1 in 6 chance of deleting your account, and a 5 in 6 chance that it just posts "I played Social Roulette and survived" to your timeline.</div>
<div><img src="img/post.png" width="582" height="226" style="margin:40px 0"/></div>
<div class="justify maintext">Everyone thinks about deleting their account at some point, it's a completely normal reaction to the overwhelming nature of digital culture. Is it time to consider a new development in your life? Are you looking for the opportunity to start fresh? Or are you just seeking cheap thrills at the expense of your social network? Maybe it's time for you to play Social Roulette.</div>
</div>
<hr class="roulette">
<div class="container center">
<div class="dlead dmargintop dmarginbottom">Rules</div>
<div class="justify maintext">There are a few basic rules for playing a successful game of Social Roulette.</div>
<div class="justify maintext">
<ol>
<li>You must play with your <span class="highlighted">own account</span>.</li>
<li>You may only play <span class="highlighted">once a day</span>.</li>
</ol>
</div>
</div>
<hr class="roulette">
<div class="container center">
<div class="dlead dmargintop dmarginbottom">FAQ</div>
<div class="justify maintext"><h4>Can Social Roulette really delete my account?</h4></div>
<div class="justify maintext">Yes. While it's very difficult to "<a href="http://www.facebook.com/help/224562897555674/">permanently delete</a>" a Facebook account, we can completely remove all your posts, friends, apps, likes, photos, and games before completely deactivating it.</div>
</div>
<br/><br/>
<!-- Like Button -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!-- end like -->
</div>
<script src="javascript/jquery.min.js"></script>
<script src="javascript/bootstrap.min.js"></script>
<script src="javascript/theme.js"></script>
<script>
var returnMess = "";
var tickSnd = new Audio("animation/tick.wav"); // buffers automatically when created
tickSnd.addEventListener('ended', function() {
this.currentTime = 0;
}, false);
var rotation = 0;
var speed = 20;
var ticks = 0;
var force = 0;
var finished = false;
function finish(){
finished = true;
if(ticks <= 4){
console.log("Account is alive.");
} else {
console.log("Account is dead.");
}
$("#result").html(returnMess);
$("#play").text("Done");
if(returnMess.match(/survived/g)) {
//append post to FB button
$("<a href='' class='postToFB btn btn-primary'>Post 'I just survived Social Roulette' to Facebook</a>").insertAfter($("#result"));
}
}
function update(){
if(!finished){
force += speed;
if(speed < 2 && (tickValue > ticks || (ticks == 5 && tickValue < 5))) {
finish();
return;
};
rotation += force;
rotation = rotation % 360;
tickValue = Math.floor((rotation/360)*6);
if(tickValue > ticks || (ticks == 5 && tickValue < 5)){
rotation -= force;
rotation = rotation % 360;
if(force > 10){
force = speed*1.5;
ticks++;
ticks = ticks%6;
if(tickSnd.currentTime == 0 ){
tickSnd.play();
}
}
} else {
force = 0;
}
speed *= 0.997;
rotate(rotation);
}
function rotate( deg){
$("#rouletteRotater").css("-webkit-transform","rotate("+deg+"deg)");
$("#rouletteRotater").css("-ms-transform","rotate("+deg+"deg)");
$("#rouletteRotater").css("transform","rotate("+deg+"deg)");
}
}
$("#play").click(function() {
//do animation stuff here
$.ajax({
url: "/play.php",
success: function(data) {
obj = $.parseJSON(data);
console.log(obj);
if(obj.message === "503") {
window.location.href = "http://socialroulette.net/";
} else if (obj.message === "505") {
$("#result").html("You can only play Social Roulette once a day.");
} else if (obj.message === "506") {
window.location.href = obj.redirect;
} else {
$("#play").text("Playing...").unbind("click");
var loop = setInterval(function(){update()},30);
rotation = (obj.result + 4) * (360/6);
returnMess = obj.message;
}
}
});
$(".postToFB").live("click", function() {
$(".postToFB").text("Posting...");
$.ajax({
url: "/post.php",
data: {post: 1},
success: function(data) {
if(data === "success") {
$(".postToFB").replaceWith("<h4>Posted!</h4>");
} else {
$(".postToFB").replaceWith("<h4 class='red'>You need to play to be able to post</h4>");
}
}
});
return false;
});
return false;
});
</script>
</body>
</html>