-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
218 lines (192 loc) · 5.47 KB
/
Copy pathindex.php
File metadata and controls
218 lines (192 loc) · 5.47 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<link href="//fonts.googleapis.com/css?family=Lato%3A300%7COxygen%3A700" rel="stylesheet" type="text/css">
<title>I hate your device</title>
<style type="text/css">
html, body {
height: 100%;
width: 100%;
}
body {
margin: 0;
padding: 10%;
box-sizing: border-box;
background: rgb(255,151,45); /* Old browsers */
background: -moz-linear-gradient(45deg, rgba(255,151,45,1) 0%, rgba(255,66,6,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,rgba(255,151,45,1)), color-stop(100%,rgba(255,66,6,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(45deg, rgba(255,151,45,1) 0%,rgba(255,66,6,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(45deg, rgba(255,151,45,1) 0%,rgba(255,66,6,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(45deg, rgba(255,151,45,1) 0%,rgba(255,66,6,1) 100%); /* IE10+ */
background: linear-gradient(45deg, rgba(255,151,45,1) 0%,rgba(255,66,6,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff972d', endColorstr='#ff4206',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
color: #fff;
overflow: hidden;
}
#device {
font-size: 14vw;
font-family: 'Oxygen', sans-serif;
}
#pre, #post {
font-size: 4.2vw;
font-family: 'Lato', sans-serif;
}
#github {
position: absolute;
bottom: 25px;
right: 25px;
font-family: 'Lato', sans-serif;
}
#github a {
text-decoration: none;
color: #fff;
}
#github a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<?php
function get_quote($device, $arrangement, $rand) {
global $hate_pre;
global $hate_post;
if($arrangement == 'pre') {
return($hate_pre[$device][$rand]);
} else {
return($hate_post[$device][$rand]);
}
}
$agent = $_SERVER['HTTP_USER_AGENT'];
$array = array(
'Your device sucks!', 'iPod', 'iPad', 'iPhone', 'Macintosh', 'Windows Phone', 'MSIE', 'Android', 'Windows'
);
$string = '';
foreach ($array as $device) {
$match = preg_match("/$device/", $agent);
$string = $string.$match;
}
$result = str_split($string);
$key = array_search('1', $result);
$device = $array[$key];
$hate_pre = array(
'ios' => array(
'You are using an overpriced',
'Heavy patented',
'Nice SSL you got with your',
'Found your way with your',
'What about Flash on your',
),
'android' => array(
'Nice designed apps on your',
'Do you still have the latest',
'Let\'s talk about security for your'
),
'mac' => array(
'If you want to upgrade your hardware on your',
'I\'ve noticed you played much less games since you bought your',
'Were you drunk when you payed for your'
),
'windows' => array(
'When was your last BSOD with your',
'Go, grab the latest virus scanner for',
'An error has occured. Please turn off',
'Are your'
),
'ie' => array(
'How many toolbars does your',
'Still no modern standards on your',
'I hope you\'re just downloading another browser with your',
'Did you rename your'
),
'wp' => array(
'I hope you like the tiles on your',
'The huge variety of apps on your',
'Dont\'t cut off your fingers on the edges on your'
)
);
$hate_post = array(
'ios' => array(
'',
'you got there',
'#gotofail',
'though Apple Maps?',
''
),
'android' => array(
'device',
'version?',
''
),
'mac' => array(
'you\'d better buy a new one',
'',
'or are you just an idiot?'
),
'windows' => array(
'machine?',
'',
'and throw it in the trash',
'drivers up to date?'
),
'ie' => array(
'have?',
'',
'',
'to "Browser-Download-Simulator '.date('Y').'" yet?'
),
'wp' => array(
'',
'is great, isn\'t it?',
''
)
);
switch($device) {
case 'iPod':
case 'iPad':
case 'iPhone':
$os = 'ios';
break;
case 'Android':
$os = 'android';
break;
case 'MSIE':
$os = 'ie';
$device = 'IE';
break;
case 'Windows':
$os = 'windows';
break;
case 'Windows Phone':
$os = 'wp';
break;
case 'Macintosh':
$os = 'mac';
break;
}
if($device != 'Your device sucks!') {
$count = rand(0, (count($hate_pre[$os]) - 1));
$pre = get_quote($os, 'pre', $count) . ' ';
$post = get_quote($os, 'post', $count);
} else {
$pre = '';
$post = '';
}
$url = "http";
if(isset($_SERVER['HTTPS'])) {
$url .= "s";
}
$url .= "://" . $_SERVER['HTTP_HOST'] . str_replace(basename(__FILE__), "", $_SERVER['REQUEST_URI']);
echo '
<div onclick="window.open(\'https://twitter.com/intent/tweet?hashtags=IHateYourDevice&original_referer=http%3A%2F%2F' . $_SERVER['HTTP_HOST'] . '%2F&text=' . urlencode($pre . $device . ' ' . $post) . ($post == '' ? '' : ' ') . '%E2%80%93&tw_p=tweetbutton&url='. $url . '\')">
<div id="pre">'.$pre.'</div>
<div id="device">'.$device.'</div>
<div id="post">'.$post.'</div>
</div>
';
echo '<div id="github"><a href="https://github.com/82OderSo/IHateYourDevice" target="_blank">Fork on GitHub</a></div>';
?>
</body>
</html>