2018-03-21 11:13:03 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class User {
|
|
|
|
/* -- User info variables; used for the functions here -- */
|
|
|
|
private $Email;
|
|
|
|
private $Title;
|
|
|
|
private $UserID;
|
|
|
|
private $Avatar;
|
|
|
|
private $Gender;
|
|
|
|
private $Badges;
|
|
|
|
private $AboutMe;
|
|
|
|
private $WhatsUp;
|
|
|
|
private $Username;
|
|
|
|
private $BirthDay;
|
|
|
|
private $JoinDate;
|
|
|
|
private $PostCount;
|
|
|
|
private $UserTitle;
|
|
|
|
private $Reputation;
|
|
|
|
private $isVerified;
|
|
|
|
private $MemberLevel;
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
/* User Database Handle */
|
|
|
|
private $DB = null;
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
/* ------------------------------------------------------------------------------------------------------- */
|
|
|
|
/* ------------------------------------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
public function __construct($id) {
|
|
|
|
// Open database connection
|
|
|
|
$DM = new DatabaseModule();
|
|
|
|
$DM->createUserHandle();
|
|
|
|
$this->DB = $DM->userHandle;
|
2024-06-29 08:07:30 -05:00
|
|
|
|
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
$this->UserID = $id;
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
$this->getUser($id);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------------------------- */
|
|
|
|
/* ------------------------------------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
private function getUser($id) {
|
|
|
|
$db = $this->DB;
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
// Get username and ID from the database
|
|
|
|
$getUser = $db->prepare('SELECT * FROM ms_users WHERE id = :id');
|
|
|
|
$getUser->bindValue(':id', $id, PDO::PARAM_INT); // bind $id to the placeholder
|
|
|
|
$getUser->execute();
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
$User = $getUser->fetch(); // get the results from the query
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
$getUser->closeCursor(); // close the SELECT query from continuing its search
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
// Populate the variable(s)
|
|
|
|
$this->Username = $User['username'];
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
$this->Title = $User['title'];
|
|
|
|
$this->Email = $User['email'];
|
|
|
|
$this->Gender = $User['gender'];
|
|
|
|
$this->Badges = $User['badges'];
|
|
|
|
$this->AboutMe = $User['blurb'];
|
|
|
|
$this->WhatsUp = $User['status'];
|
|
|
|
$this->BirthDay = $User['bday'];
|
|
|
|
$this->JoinDate = $User['joindate'];
|
|
|
|
$this->PostCount = $User['posts'];
|
|
|
|
$this->Avatar = $User['avatar'];
|
|
|
|
$this->Reputation = $User['reputation'];
|
|
|
|
$this->MemberLevel = $User['mlevel'];
|
|
|
|
}
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
/* ------------------------------------------------------------------------------------------------------- */
|
|
|
|
/* ------------------------------------------------------------------------------------------------------- */
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
public function __get($what) {
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
if(property_exists($this, $what)) {
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
return $this->{$what};
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
} else {
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
return null;
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
}
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function update($what) {
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
}
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2018-03-21 11:13:03 -05:00
|
|
|
}
|
2024-06-29 08:07:30 -05:00
|
|
|
?>
|