-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcaptcha_frame.php
197 lines (156 loc) · 5.23 KB
/
captcha_frame.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
<?php
global $user;
error_reporting(E_ERROR | E_PARSE | E_WARNING);
require_once 'config_network.php';
require_once("adodb/adodb-exceptions.inc.php");
require_once("adodb/adodb.inc.php");
require_once 'memcache_wrapper.php';
if($network_id == 0) {
$db_ip = '10.8.50.198';
$db_ip = 'CHANGEME';
//$db_user = 'CHANGEME';
$db_user='piratewars';
$db_pass='CHANGEME';
//$db_pass = 'CHANGEME';
$db_name = 'CHANGEME';
$facebook_canvas_url = 'CHANGEME';
$base_url = 'CHANGEME/pirates/fb';
$base_url_captcha = 'http://gamesecuritywords.com/pirates/fb';
$memcache_temp = new MemcacheWrapper(); //use temp for mile limits, gambing limits
$memcache_temp->addServer('10.12.198.194', 11219);
$memcache = new MemcacheWrapper();
$memcache->addServer('10.12.198.194', 11211);
}
else {
//$db_ip = '10.8.50.198';
$db_ip = 'CHANGEME';
$db_user = 'CHANGEME';
$db_pass = 'CHANGEME';
$db_name = 'CHANGEME';
$facebook_canvas_url = 'http://dev.greenrobot.com/pirates/myspace';
$base_url = $facebook_canvas_url;
$base_url_captcha = 'http://gamesecuritywords.com/pirates/myspace';
$memcache_temp = new MemcacheWrapper('mt'); //use temp for mile limits, gambing limits
$memcache_temp->addServer('10.12.198.194', 11213);
$memcache_temp->addServer('10.8.50.196', 11213);
$memcache = new MemcacheWrapper('my');
$memcache->addServer('10.12.198.194', 11211);
}
$connect= "mysql://$db_user:$db_pass@$db_ip/$db_name?persist";
$DB = NewADOConnection($connect);
function update_action2($user, $action) {
global $DB, $memcache;
if($memcache) {
$team = $memcache->set($user . ":a", $action);
$DB->Execute("update users set current_action='$action' where id = $user");
}
else {
$DB->Execute("update users set current_action='$action' where id = $user");
}
}
if ($_POST["submit"]) {
//include_once '../client/facebook.php';
//include_once 'lib.php';
//include_once 'config.php';
$user = $_REQUEST['user'];
$page = $_REQUEST['page'];
$item = $_REQUEST['item'];
require_once('recaptchalib.php');
if($network_id == 0) {
$privatekey = '6LfN1AAAAAAAANNTEhf1pqAHUKim9tlkkYZH88d5';
}
else {
//$privatekey = '6LfN1AAAAAAAANNTEhf1pqAHUKim9tlkkYZH88d5';
$privatekey = '6LeF6wIAAAAAAJZd605m48lwKLYACX2uWOGFyXbB';
}
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
echo "<center><h1>You got it!</h1>";
if($page != "") {
if($item != "") {
update_action2($user, "captcha_complete");
$url = "$facebook_canvas_url/$page" . "?item=$item";
if($network_id == 0) {
echo "<a target ='_parent' href='$facebook_canvas_url/$page?item=$item'>click here to continue!</a></center>";
}
else {
echo "<a target='top' href='http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=100506'>click here to continue!</a></center>";
}
//$facebook->redirect("$url");
}
else {
update_action2($user, "captcha_complete");
//$facebook->redirect("$facebook_canvas_url/$page");
if($network_id == 0) {
echo "<a target ='_parent' href='$facebook_canvas_url/$page'>click here to continue!</a></center>";
}
else {
echo "<a target='top' href='http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=100506'>click here to continue!</a></center>";
}
}
}
else {
update_action2($user, "captcha_complete");
if($network_id == 0) {
echo "<a target ='_parent' href='$facebook_canvas_url/index.php'>click here to continue!</a></center>";
}
else {
echo "<a target='top' href='http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=100506'>click here to continue!</a></center>";
}
//$facebook->redirect("$facebook_canvas_url/index.php");
}
# in a real application, you should send an email, create an account, etc
} else {
# set the error code so that we can display it. You could also use
die ("<center>You entered the words incorrectly, <a href='captcha_frame.php?user=$user&page=$page&item=$item'>please try again</a></center>"); //, but using the error message is
# more user friendly
$error = $resp->error;
}
}
else {
$user = $_REQUEST['fb_sig_user'];
if(empty($user)) {
$user = $_REQUEST['user'];
}
?>
<html>
<head>
</head>
<body>
<center>
<?php
/*
<form method='post' action='<?php echo $base_url_captcha; ?>/captcha_frame.php'>?>
*/
?>
<form method='post'>
<?php
global $facebook, $facebook_canvas_url;
$page = urldecode($_REQUEST['page']);
$item = $_REQUEST['item'];
require_once('recaptchalib.php');
//print_r($_REQUEST);
if($network_id == 0) {
$publickey = '6LfN1AAAAAAAAPxTPe-y3p153BvROilukfIt4sb9';
}
else {
//$publickey = '6LfN1AAAAAAAAPxTPe-y3p153BvROilukfIt4sb9';
$publickey = '6LeF6wIAAAAAAO9RIJpDkWrs7ayt08Ooo5DxOhT4';
}
// you got this from the signup page
echo recaptcha_get_html($publickey);
?>
<input type='submit' value='submit' name='submit'>
<input type='hidden' value='<?php echo $page; ?>' name='page'>
<input type='hidden' value='<?php echo $item; ?>' name='item'>
<input type='hidden' value='<?php echo $user; ?>' name='user'>
</center>
</form>
</body>
</html>
<?php
}
?>