Gå til innhold

PHP highligt test


Ueland

Anbefalte innlegg

Videoannonse
Annonse

<?PHP

 

////////////////////////////////////////

// system: VikingBoard

// version: 0.1 alpha

// author: Tor Henning Ueland

// website: www.vikingboard.com

//

////////////////////////////////////////

 

 

//================================

// USER CLASS | PARSES AND GETS THE USER INFORMATION

//================================

 

 

class user

{

var $name;

var $id;

var $auth;

var $loggedin;

var $title;

var $new_pms;

var $use_smiley;

var $use_sig;

var $use_emailer;

var $show_sig;

var $show_avatars;

var $show_smileys;

var $warnlevel;

var $show_pmpopup;

var $done_pmpopup;

 

//Session function, checking the sid

function session()

{

session_start();

if ($_COOKIE[''.global_config('cookie').''])

{

$this->session = $_COOKIE[''.global_config('cookie').''];

}

else

{

$this->session = session_id();

}

 

return $this->session;

}

 

 

//session updater

function sessupdater($t)

{

global $db;

//The session isn`t there | inserting

if ($t =='insert')

{

$db->db_query("INSERT INTO forum_sessions (sid, time, ip) VALUES ('".$this->session()."', '".forumtime()."', '".$_SERVER['REMOTE_ADDR']."')");

}

//Session exists, let`s update it

if ($t == 'update')

{

$db->db_query("UPDATE forum_sessions SET time ='".forumtime()."', ip ='".$_SERVER['REMOTE_ADDR']."' WHERE sid ='".$this->session()."'");

}

}

 

 

//The user data function, parses and gets the info about the user

function user()

{

global $db;

 

//so, now we got enough information to get some info about him/her/dragon/alien, wathever dude.

$db->db_query("SELECT s.uid, m.name, m.auth, m.title, m.new_pms, m.use_smiley, m.use_sig, m.use_emailer,

m.show_sig, m.show_avatars, m.show_smileys, m.warnlevel, m.show_pmpopup, m.done_pmpopup

FROM forum_sessions s, forum_member m

WHERE s.sid = '".$this->session()."' AND m.id = s.uid LIMIT 1");

$usr_sess = $db->db_row();

 

//Data from the logged in user..

if ($usr_sess->uid)

{

$this->name = $usr_sess->name;

$this->id = $usr_sess->uid;

$this->auth = $usr_sess->auth;

$this->loggedid = "1";

$this->title = $usr_sess->title;

$this->new_pms = $usr_sess->new_pms;

$this->use_smiley = $usr_sess->use_smiley;

$this->use_sig = $usr_sess->use_sig;

$this->use_emailer = $usr_sess->use_emailer;

$this->show_sig = $usr_sess->show_sig;

$this->show_avatars = $usr_sess->show_avatars;

$this->show_smileys = $usr_sess->show_smileys;

$this->warnlevel = $usr_sess->warnlevel;

$this->show_pmpopup = $usr_sess->show_pmpopup;

$this->done_pmpopup = $usr_sess->done_pmpopup;

}

//Default guest data

else

{

$this->name = "test";

$this->id = "0";

$this->auth = "0";

$this->loggedid = "0";

$this->title = "0";

$this->new_pms = "0";

$this->use_smiley = "0";

$this->use_sig = "0";

$this->use_emailer = "0";

$this->show_sig = "0";

$this->show_avatars = "0";

$this->show_smileys = "0";

$this->warnlevel = "0";

$this->show_pmpopup = "0";

$this->done_pmpopup = "0";

}

 

//running a sessions update

if ($db->db_rows() =="0")

{

$this->sessupdater(insert);

}

else if ($db->db_rows() !="0")

{

$this->sessupdater(update);

}

}

}

 

 

?>

Lenke til kommentar
Gjest
Dette emnet er stengt for flere svar.
  • Hvem er aktive   0 medlemmer

    • Ingen innloggede medlemmer aktive
×
×
  • Opprett ny...