/
watch4watchAuto.php
241 lines (212 loc) · 6.97 KB
/
watch4watchAuto.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
<?php
include 'header.php';
$username = $_SESSION['username'];
if(isset($_GET['f'])){
$f = $_GET["f"];
if($f == 'lk')
{
?>
<script type="text/javascript">
setTimeout("alert('Thank you for linking your account, you may now start subbing.')",500);
</script>
<?php
}
if($f == 'ona')
{
$query = "update user set auto2 = 'on' where username='$username'";
mysql_query($query);
}
if($f == 'offa')
{
$query = "update user set auto2 = 'off' where username='$username'";
mysql_query($query);
}
}
$query = "select credits5, HourlyWatches, date5, accountType, youtubeUserName, auto2 from user where username='$username'";
$result = mysql_query($query);
$row = mysql_fetch_array( $result );
$credits = $row['credits5'];
$accountType = $row['accountType'];
$myYoutubeUserName = $row['youtubeUserName'];
$auto = $row['auto2'];
if($accountType == 'Premium')
{
$gainPoints = 2;
}
else
{
$gainPoints = 1;
}
echo "<div style='position:absolute; margin-top:62px;margin-left:10px;'><img src='images/watch4watch.png'></div>
<div style='position:absolute; margin-top:62px;margin-left:390px;'><img src='images/howItWorks5.png'></div>
<div style='position:absolute; margin-top:62px;margin-left:710px;'><img src='images/remember5.png'></div>
<div id='credits' style='font-family:Arial;font-size:20px;font-weight:strong;position:absolute; margin-top:122px;margin-left:70px;'>You have $credits points</div>";
if (isset($_POST['video']))
{
$video = $_POST['video'];
$query = "update user set video = '$video' where username='$username'";
mysql_query($query);
?>
<script type='text/javascript'>
setTimeout("alert('Successfuly updated your default video.')",1000);
</script>
<?php
}
?>
<?
if(!mysql_num_rows(mysql_query("SELECT youtubeUserName FROM user where credits5 > 0 and username != '$username' order by Rand() limit 1"))){
?>
<div style='width:1060px;position:absolute; top:400px;margin-left:-70px;'><div style='margin-left:auto;margin-right:auto;color:black;font-weight:blod;font-family:arial;font-size:20px;'>
There are no user videos to watch.<br>
</div></div>
<?php
exit;
}
$result = mysql_query( "SELECT userid FROM user where credits5 > 0 and username != '$username' and video != '' order by Rand() limit 1" )
or die("SELECT Error: ".mysql_error());
while ($get_info = mysql_fetch_row($result)){
foreach ($get_info as $field){
}
$useridGot=$field;
$query = "select video from user where userid='$useridGot'";
$result = mysql_query($query);
$row = mysql_fetch_array( $result );
$video = $row['video'];
}
?>
<div style='margin-left:-45px;width:1060px;position:absolute; top:350px;'><div style='margin-left:auto;margin-right:auto;'>
<div style="width:120px;position:absolute;margin-left:-50px;margin-top:-80px;">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3211239174124719";
/* EazySubs2 */
google_ad_slot = "8552476946";
google_ad_width = 120;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<div style="width:120px;position:absolute;margin-left:986px;margin-top:-80px;">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3211239174124719";
/* EazySubs2 */
google_ad_slot = "8552476946";
google_ad_width = 120;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<img style='position:relative;' src='images/points4viewsBack.png'>
<a href='view4view.php'><div style='position:absolute; margin-top:-580px;margin-left:705px;'><img border='0' src='images/next.png'></div></a>
<div id='timer' style='font-family:Arial;font-size:20px;font-weight:strong;position:absolute; margin-top:-565px;margin-left:140px;'>You will be credited in 5 seconds</div>
<div style='font-family:Arial;font-size:20px;font-weight:strong;position:absolute; margin-top:-500px;margin-left:450px;'><a href="
<?php if($auto == 'off')
{
echo'watch4watchAuto.php?f=ona">Turn auto-watch on';
}
else
{
echo'watch4watchAuto.php?f=offa">Turn auto-watch off';
}
?>
</a><br/><br/>
<a href="
<?php if($_SERVER['PHP_SELF'] == '/watch4watch.php')
{
echo'watch4watchAuto.php">Turn auto-play on';
}
else
{
echo'watch4watch.php">Turn auto-play off';
}
?>
</a></div>
<div style='margin-top:-400px;'><script type="text/javascript"><!--
google_ad_client = "ca-pub-3211239174124719";
/* EazySubs */
google_ad_slot = "7790294266";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<div style='font-family:Arial;width:1000px;font-size:17px;font-weight:strong;position:absolute; margin-top:50px;margin-left:30px;'>
<h2>Nothing is happening:</h1>
<h4>Disable any popup-blocker in order to make this page work properly.</h3>
<h4>Currently does not work in Internet Explorer.</h3>
<h4>Google Chrome is recomended for best experience.</h3>
</div>
<script type="text/javascript">
time = 5;
gainPoints = <?php echo $gainPoints ?>;
auto = '<?php echo $auto; ?>';
useridGot = '<?php echo $useridGot; ?>'
if(PopupBlocked()) {
alert('Please disable your popup-blocker.');
}
else {
MyWindow2 = window.open("http://www.youtube.com/watch?v=<?php echo $video; ?>","mywindows","status=1,width=670,height=580");
timer();
}
function timer()
{
if(time > 1)
{
time--;
document.getElementById('timer').innerHTML = 'You will be credited in ' + time + ' seconds';
setTimeout("timer()",1000);
}
else
{
MyWindow2.close();
var dataString = 'uid='+ useridGot;
$.ajax({
type: "POST",
url: "watch.php",
data: dataString,
success: function(data){
if(data == "successful")
{
document.getElementById('timer').innerHTML = 'You have been credited a point';
var creditsHTML = document.getElementById('credits').innerHTML;
creditsHTML = creditsHTML.replace('You have','');
creditsHTML = creditsHTML.replace('points','');
var credits = creditsHTML;
credits = parseFloat(credits) + parseFloat(gainPoints);
document.getElementById('credits').innerHTML = 'You have ' + credits + ' points';
}
else
{
document.getElementById('timer').innerHTML = "An error has occured";
alert(data);
}
}
});
if(auto == 'on')
{
setTimeout("window.location = 'watch4watchAuto.php'",1000);
}
}
}
function PopupBlocked() {
var PUtest = window.open(null,"","width=100,height=100");
try { PUtest.close(); return false; }
catch(e) { return true; }
}
</script>
<div style='position:relative; margin-top:-350px;'>
<a href='defaultvideo.php' style='color:black; font-size:20px; font-weight:bold;'>Update Your Default Video</a>
</div>
<style type="text/css">
.subBox{
background-image:url('images/subBackground.png');
width:171px;
height:171px;
}
</style>
</body>