HEX
Server: Apache/2.4.6 (CentOS) mpm-itk/2.4.7-04 mod_fcgid/2.3.9 PHP/5.4.16
System: Linux dvm.vladweb.ru 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: region-gk.ru (1016)
PHP: 7.3.33
Disabled: NONE
Upload Files
File: //home/bk/efi/eficenter.ru/consultant/class/add_new_user.php
<?php
 class AddNewUser{ public $user_id = null; public $user_name = null; public function __construct($name){ $user_ip = $this->getIp(); $this->user_name = $name; if(!class_exists(Mysql)){ require 'mysql.php'; } $this->user_id = $this->addUser($user_ip); } private function addUser($user_ip){ $mysql = Mysql::getInstance(); $reg_time = time(); $this->user_name = $mysql->quote($this->user_name); $sql = "INSERT INTO ok_users(user_ip, user_name, user_date) VALUES('{$user_ip}', {$this->user_name}, '{$reg_time}')"; if($mysql->exec($sql) == 0){ die('Error!!!'); }else{ $this->user_id = $mysql->lastInsertId(); $_SESSION['ok_user_id'] = $this->user_id; $_SESSION['ok_user_name'] = $this->user_name; $id_in_cookie = $this->user_id.'$'.$reg_time; setcookie('ok_user_id', $id_in_cookie, time()+60*60*24*30); return $this->user_id; } } public function getIp(){ require 'ip.php'; return UserIP::getIP(); } public function getUserId(){ return $this->user_id; } } ?>