This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
res.php
56 lines (50 loc) · 1.18 KB
/
res.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
<?
$action=$_REQUEST["action"];
$key=$_REQUEST["key"];
$key=hexdec($key);
$id=$_REQUEST["id"];
$ids=$_REQUEST["ids"];
if($key%2)die("ERROR_KEY_DOES_NOT_EXIST");
session_start();
function getCaptcha($id,$single=0){
//print_r($id);
$id=(int)$id;
if(isset($_SESSION["captchas"][$id])){
if(time()-$_SESSION["captchas"][$id]["timestamp"]>5)return ($single?"OK|":"").$_SESSION["captchas"][$id]["recognized"];
else return "CAPCHA_NOT_READY";
}else return "ERROR_NO_SUCH_CAPCHA_ID";
}
function abuse($id){
if(isset($_SESSION["captchas"][$id])){
return "OK_REPORT_RECORDED";
}else return "ERROR_NO_SUCH_CAPCHA_ID";
}
if($action=="clear"){
session_destroy();
die("cleared");
}
if(empty($key)||empty($action))die("PARAMETER_MISSED");
$output=array();
switch($action){
case "get":
if(empty($id)&&empty($ids))die("PARAMETER_MISSED");
if(isset($ids)){
$ids=explode(',', $ids);
//new dBug($ids);
foreach($ids as $id){
$output[]=getCaptcha($id);
}
echo(implode("|", $output));
}else{
echo(getCaptcha($id,1));
}
break;
case "getbalance":
echo rand()/getrandmax()*100;
break;
case "reportbad":
if(empty($id))die("PARAMETER_MISSED");
echo(abuse($id));
break;
}
?>