Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Permission Class
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / M-BiTsy / M-BiTsy Support

2020-08-16 11:19:37
Planning on cleaning my code & formatting. going to spend as much time doing that next week as i can and ive had some ideas about the classes and models so ill post odd one if its of any interest to anyone else

here is my starting point for permissions class - to install make Permissions.php and include it in functions.php if you have any suggestions feel free as i go through code this will be extended

<?php
class Permissions
{
   public static function hasPermission($id, $permission)
   {
       global $site_config, $CURUSER;
       if ($id == $CURUSER['id'] && $permission == 1) {
           return true;
       } else {
           return false;
       }
   }
}



You pass curuser id or user id as first var then 2nd var is permission - this will be extended to check bigger() smaller() siteconfig()  (i have session available for permissions)

lets see if curuser id is loggedin permission
if (Permissions::hasPermission($CURUSER['id'], $site_config["MEMBERSONLY"])) {
   echo "<br>Success<br>";
}
2020-08-16 11:39:26
with sessions
if (Permissions::hasPermission($_SESSION['id'], $_SESSION["LOGGEDIN"])) {


or object
if (Permissions::hasPermission($user->id, $user->loggedin)) {
2020-08-16 13:29:53
Maybe better to place in user class and pass session array so I can use that

If user->perm(viewuser)

Or User->loggedin()

Function loggedin {
if session[loggedin == true
Return  true
}

Just trying to find the cleanest way to change from global to oop
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 9
  • Members: 0
  • Guests online: 9
  • Comments: 3
  • Messages: 1,728