Experienced Elementalist
- Joined
- Apr 25, 2012
- Messages
- 222
- Reaction score
- 35
Fixed a few buggs. Starting on the other pages now.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature currently requires accessing the site using the built-in Safari browser.
Looks pretty good so far, would love to see more PHP snippets
<?php
class User extends TableHolder {
public static function getTable ()
{
return 'users';
}
public static function getIdentifyingRow ()
{
return 'id';
}
public function __construct ($id)
{
$query = $this->prepare ('SELECT * FROM users WHERE id = :id LIMIT 1');
$query->execute (array (':id' => $id));
if ($query->rowCount () < 1)
exit ('<strong>BandzCMS Element -></strong> No user with ID '. $id);
$this->identifier = $id;
$this->data = $query->fetch (PDO::FETCH_ASSOC);
}
public function login ($password)
{
return crypt ($password, '$2y$10$'. $this->data ['salt']) == $this->data ['password'];
}
public function isBanned ()
{
$query = $this->prepare ("SELECT id FROM bans WHERE value = :id AND bantype = 'ip' LIMIT 1");
$query->execute (array (':id' => $this->identifier));
return $query->rowCount () > 0;
}
public function canHK ()
{
return $this->hasPermission ('hk_login');
}
public function hasPermission ($perm)
{
$notperm = ($perm[0] == '-' ? substr ($perm, 1, strlen ($perm)) : '-'. $perm);
$rank = new Rank ($this->data ['rank']);
$rankPerm = $rank->hasPermission ($perm);
$userPerms = explode (',', $this->data['permissions']);
if ($rankPerm && !in_array ($notperm, $userPerms))
return true;
return in_array ($perm, $userPerms);
}
public static function register ($username, $mail, $password)
{
if (static::has (['username' => $username]) || static::has (array ('mail' => $mail)))
throw new Exception ('Such a user/mail already exists.');
$salt = substr (bin2hex(openssl_random_pseudo_bytes(23)), 0, 22);
$query = static::prepare ('INSERT INTO users (username, mail, password, salt) VALUES (:username, :mail, :password, :salt)');
$query->execute (array (
':username' => $username,
':mail' => $mail,
':password' => crypt ($password, '$2y$10$'. $salt),
':salt' => $salt
));
return new User (static::getPDO ()->lastInsertId ());
}
}
I don't really like the news reactions. I think the box is way too big. Are you using multiple pages?
[B]C:\WT-NMP\WWW\habbo\application\classes\class.raintpl.php on line [B]268
@RetroMakerD Because i have a server to pay, a TCP proxy to pay, i need to pay some coders.
And because i like some income. It's not that big of deal, because i will add them all on the bottom of the page.
And oh, if you are wondering who the * i am!
I'm Nick, one of the main developers :$
how will you keep people from removing your ads, when you release the cms?@RetroMakerD Because i have a server to pay, a TCP proxy to pay, i need to pay some coders.
And because i like some income. It's not that big of deal, because i will add them all on the bottom of the page.
And oh, if you are wondering who the * i am!
I'm Nick, one of the main developers :$
how will you keep people from removing your ads, when you release the cms?
I like the design.
Just a tip:
PHP:if (! (ACCESS_LEVEL == 'ACCESS_ALL' || ACCESS_LEVEL == 'ACCESS_GUESTS' || ACCESS_LEVEL == 'ACCESS_USERS' || ACCESS_LEVEL == 'ACCESS_ADMIN'))
PHP:if (ACCESS_LEVEL != 'ACCESS_ALL' && ACCESS_LEVEL != 'ACCESS_GUESTS' && ACCESS_LEVEL != 'ACCESS_USERS' && ACCESS_LEVEL != 'ACCESS_ADMIN')
Or you could just use an in_array call there.
Isn't the first one faster as it only has to check atleast once whereas the bottom one it has to check each and every comparison.
It depends on the values. In the first example, it will check if ACCESS_LEVEL is 'ACCESS_ALL', and if it isn't, it will check the second one. So, if access level is 'ACCESS_ADMIN', it'll check the same amount as the second one. It's slightly better but you barely notice the difference.Isn't the first one faster as it only has to check atleast once whereas the bottom one it has to check each and every comparison.
$bool = (ACCESS_LEVEL == 'ACCESS_ALL' || ACCESS_LEVEL == 'ACCESS_GUESTS' || ACCESS_LEVEL == 'ACCESS_USERS' || ACCESS_LEVEL == 'ACCESS_ADMIN');
if ($bool == false)
{
//code
}
if (ACCESS_LEVEL != 'ACCESS_ALL')
{
if (ACCESS_LEVEL != 'ACCESS_GUESTS')
{
if (ACCESS_LEVEL != 'ACCESS_USERS')
{
if (ACCESS_LEVEL != 'ACCESS_ADMIN')
{
//Code
}
}
}
}
Yeah I kind of was expecting this. He and a few others (including me) starter a habbo cms. I created the template and soms other guy created the PHP. This guy just stole all of our content and claims it as his while he had done nothing so far. This is just ons big fake system. Nothing is written by him.
This was one of the guys I worked with.
I have already given proof. Look at the file dates in the ZIP.