Файл: system/bootstrap.php
Строк: 64
<?php
ob_start();
session_start();
error_reporting(0);
header('Content-type: text/html; charset=utf-8');
define('__ROOT__', dirname(__DIR__));
define('__URL__', $_SERVER['HTTP_HOST']);
$config = require __ROOT__ . '/config.php';
date_default_timezone_set($config['timezone']);
try {
$db = new PDO(
$config['db']['dsn'],
$config['db']['username'],
$config['db']['password']
);
} catch (PDOException $e) {
trigger_error('Ошибка подключения: ' . $e->getMessage(), E_USER_ERROR);
}
spl_autoload_register(function ($name) {
$file = __ROOT__ . '/system/classes/' . $name . '.php';
if (is_file($file)) {
require $file;
}
});
$mailSMTP = new SendMailSmtpClass('robot@uspay.ru', 'aev97gr', 'mail.uspay.ru', 25, "UTF-8");
$user = new User;
$clean = new Clean;
$template = new Template(__ROOT__ . '/templates', '.tpl');
require __DIR__ . '/functions.php';
require __DIR__ . '/const.php';
require __DIR__ . '/library/password.php';
if($user->get()->automoney == 1){
$automoney_in = $db->prepare('SELECT SUM(`money`) as sum FROM `shop` WHERE `user` = ? and `status` = ?');
$automoney_in -> execute([$user->get()->user_id,1]);
$automoney_in = $automoney_in ->fetch(PDO :: FETCH_ASSOC);
if($automoney_in['sum'] > 0){
$update_us = $db->prepare('update `users` set `money` = ? where `user_id` = ?');
$update_us -> execute([$user->get()->money+$automoney_in['sum'],$user->get()->user_id]);
$update_shop = $db->prepare('update `shop` set `money` = ? where `user` = ?');
$update_shop -> execute([0,$user->get()->user_id]);
$history = $db->prepare('insert into history (money,type,user,text,time) values (?,?,?,?,?)');
$history -> execute([$automoney_in['sum'],1,$user->get()->user_id,'Вывод средств с кассы (автовывод)',time()]);
}
}
$template->set('user', $user);
$template->set('clean', $clean);
$template->set('mailSMTP', $mailSMTP);
$template->set('csrf', '<input type="hidden" name="__token__" value="'.encrypt(time()).'">');