Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- UserCake Version: 1.4
- http://usercake.com
- Developed by: Adam Davis
- */
- class UID {
- public $email = NULL;
- public $hash_pw = NULL;
- public $user_id = NULL;
- public $clean_username = NULL;
- public $display_username = NULL;
- public $balance = NULL;
- //Return the timestamp when the user registered
- public function signupTimeStamp()
- {
- global $db,$db_table_prefix;
- $sql = "SELECT
- SignUpDate
- FROM
- ".$db_table_prefix."Users
- WHERE
- User_ID = '".$db->sql_escape($UID->user_id)."'";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- return ($row['SignUpDate']);
- }
- //Fetch all user group information
- public function groupID()
- {
- global $db,$db_table_prefix;
- $sql = "SELECT ".$db_table_prefix."Users.Group_ID,
- ".$db_table_prefix."Groups.*
- FROM ".$db_table_prefix."Users
- INNER JOIN ".$db_table_prefix."Groups ON ".$db_table_prefix."Users.Group_ID = ".$db_table_prefix."Groups.Group_ID
- WHERE
- User_ID = '".$db->sql_escape($UID->user_id)."'";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- return($row);
- }
- //Fetch user's amount of money or balance.
- public function balance()
- {
- global $db,$db_table_prefix;
- $sql = "SELECT
- money
- FROM
- ".$db_table_prefix."Users
- WHERE
- User_ID = '".$db->sql_escape($UID->user_id)."'";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- return ($row['money']);
- }
- //Is a user member of a group
- public function isGroupMember($id)
- {
- global $db,$db_table_prefix;
- $sql = "SELECT ".$db_table_prefix."Users.Group_ID,
- ".$db_table_prefix."Groups.* FROM ".$db_table_prefix."Users
- INNER JOIN ".$db_table_prefix."Groups ON ".$db_table_prefix."Users.Group_ID = ".$db_table_prefix."Groups.Group_ID
- WHERE User_ID = '".$db->sql_escape($UID->user_id)."'
- AND
- ".$db_table_prefix."Users.Group_ID = '".$db->sql_escape($db->sql_escape($id))."'
- LIMIT 1
- ";
- if(returns_result($sql))
- return true;
- else
- return false;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement