case 'banner':
require_once $config_abs_path."/classes/banners.php";
$id = get_numeric_only("id");
$banner=new banners();
$banner->addHit($id);
break;
require_once $config_abs_path."/classes/users.php";
$email=users::getEmail($id='2');
class banners {
// used in files which don't run the common() function from util.php but need auth information
function checkAuth() {
require_once $config_abs_path."/classes/auth.php");
global $is_admin, $logged_in, $crt_usr;
$auth=new auth();
$logged_in = $auth->loggedIn();
$is_admin = $auth->adminLoggedIn();
if(!$logged_in && !$is_admin)
$logged_in = $auth->checkCookieLogin();
// vars for user account navbar
if($logged_in) $crt_usr = $auth->crtUserId();
}
function addHit($id=0) {
global $db,$config_abs_path;
if(!$id) $id=$this->id;
$res_del=$db->query('update '.TABLE_BANNERS.' set `clicks` = `clicks`+1 where `id`="'.$id.'"');
require_once $config_abs_path."/classes/users.php";
$email=users::getEmail($id);
$email=$db->query("insert into `class_click` set `email` = '$email'");
return 1;
}
}
public function __construct($id=0)
{
global $db;
$this->path="../images/baners/";
if($id) {
$this->id=$id;
$this->array=array();
$this->array=$db->fetchAssoc('select * from '.TABLE_BANNERS.' where `id`='.$id);
}
}
function getId() {
return $this->id;
}
require_once $config_abs_path."/classes/users.php";
$email=users::getNEmail($id);
return 1;
global $logged_in, $crt_usr;
$usr = new users();
$user = $usr->getUser($crt_usr);
$smarty->assign("user",$user);
ну или вот так
$auth = new auth();
$last_login=$auth->getLoginBefore($logged_in);
$total_views = listings::getViewed($crt_usr);
class users {
static function getEmail($id='') {
global $db;
if(!$id) return;
$email=$db->fetchRow('select email from '.TABLE_USERS.' where id="'.$id.'"');
return $email;
}
class banners {
function addHit($id=0) {
global $db,$config_abs_path;
if(!$id) $id=$this->id;
$res_del=$db->query('update '.TABLE_BANNERS.' set `clicks` = `clicks`+1 where `id`="'.$id.'"');
require_once $config_abs_path."/classes/users.php";
$email=users::getNEmail($id);
return 1;
}
}
function getNEmail($id) {
global $db;
$email=users::getEmail($id);
$db->query("insert into `class_click` set `email` = '$email'");
}
global $is_admin, $logged_in, $crt_usr;
$auth=new auth();
$logged_in = $auth->loggedIn();
$is_admin = $auth->adminLoggedIn();
if(!$logged_in && !$is_admin)
$logged_in = $auth->checkCookieLogin();
// vars for user account navbar
if($logged_in) $crt_usr = $auth->crtUserId();
}
function addHit($id=0) {
global $db;
if(!$id) $id=$this->id;
$res_del=$db->query('update '.TABLE_BANNERS.' set `clicks` = `clicks`+1 where `id`="'.$id.'"');
require_once "users.php";
$email=users::getEmail($id);
//$email=escape($str);
//var_dump('INSERT INTO `class_click`(`email`) VALUES ('. $email .')');
$res_insert=$db->query("insert into `class_click` set `email` = '$email'");
return 1;
}
function addHit($id=0) {
global $db;
if(!$id) $id=$this->id;
$res_del=$db->query('update '.TABLE_BANNERS.' set `clicks` = `clicks`+1 where `id`="'.$id.'"');
require_once "users.php";
$email=users::getEmail($id);
$res_insert=$db->query('INSERT INTO `class_click`(`email`) VALUES ('. $email .')');
return 1;
}
[09-Nov-2019 22:59:22 Europe/Berlin] PHP Warning: require_once(/classes/users.php): failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/test/classes/banners.php on line 50
[09-Nov-2019 22:59:22 Europe/Berlin] PHP Fatal error: require_once(): Failed opening required '/classes/users.php' (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/test/classes/banners.php on line 50
function addHit($id=0) {
global $db;
if(!$id) $id=$this->id;
$res_del=$db->query('update '.TABLE_BANNERS.' set `clicks` = `clicks`+1 where `id`="'.$id.'"');
require_once "/classes/users.php";
$email=users::getEmail($id);
$res_insert=$db->query('INSERT INTO `class_click`(`email`) VALUES ('.$email.')');
return 1;
}
function addHit($id=0) {
global $db;
if(!$id) $id=$this->id;
$res_del=$db->query('update '.TABLE_BANNERS.' set `clicks` = `clicks`+1 where `id`="'.$id.'"');
global $config_abs_path;
require_once $config_abs_path."/class/users.php";
$email = users::getEmail();
$res_insert = $db->query('INSERT INTO `class_click`(`email`) VALUES ('. $email .')');
return 1;
}