Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class User
- {
- var $auth;
- var $user_info;
- function __construct(&$parent)
- {
- $this->parent =& $parent;
- }
- function logged_in()
- {
- if (isset($this->user_info['id']) && isset($_SESSION['username']))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- function get_info($info=false)
- {
- if (isset($info))
- {
- if (is_numeric($info))
- {
- $this->user_info['id'] = $info;
- }
- else
- {
- $this->user_info['username'] = $info;
- }
- }
- if (isset($this->user_info['id']) && is_numeric($this->user_info['id']))
- {
- $user = $this->parent->db->Execute("SELECT * FROM `" . $this->parent->config['database']['tables']['users'] . "` WHERE `id`='" . $this->user_info['id'] . "' LIMIT 1");
- }
- elseif (isset($this->user_info['username']))
- {
- $user = $this->parent->db->Execute("SELECT * FROM `" . $this->parent->config['database']['tables']['users'] . "` WHERE `username`='" . $this->user_info['username'] . "' LIMIT 1");
- }
- if ($user->RecordCount() == 0)
- {
- $this->parent->Errors->error("Could not find the requested user.");
- return false;
- }
- else
- {
- $this->user_info = $user->FetchRow();
- return true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement