Tnxx for this release maybe an good layout for an RP?
Printable View
Tnxx for this release maybe an good layout for an RP?
Jamal:
Don't think it's a layout that you'd use for roleplay hotels but anyway good luck!
Actually it is better off for a rp.
Going to update it tomorrow with the latest version. It now has cached avatars.
The skin itself , it's more suitable for a rp
Update 13:
Spoiler:
https://mega.co.nz/#!x1JhWAxD!EERvuQ...EeNQxIUvZHKKfI
Have you already tried RainTPL for your template system ?
I use it for personal purpose, it's lightweight ( compared to the famous
Smarty and others ) but powerful and easy to use.
I used it on earlier projects. I wanted to create my own engine now.:thumbup1:
Busy on new theme!
Spoiler:
Hey.
I want to give you some tips with your code.
The grabData() method is pretty inefficient. I would store the result which is given in a private attribute, so it doesn't have to run the query everytime grabData is called.PHP Code:class User{
public function database($h, $u, $p, $db){
$this->conn = new mysqli($h,$u,$p,$db); // So i don't have to use global.
}
public function grabData($k) {
$q = $this->conn->query("SELECT * FROM users WHERE username = '$this->session'");
$r = mysqli_fetch_assoc($q);
return $r[$k];
}
}
Another tip is, that you use dependency injection with the database. The method database() will create an mysqli instance everytime when you use the User object.
I would pass the Database as a parameter so the database() method looks a bit like this.
And if you want to call this function, you simply do this:PHP Code:class User{
/* ... */
public function database(MySQLi $connection)
{
this->conn = $connection;
}
I would put the $connection variable in the core file, so you only use one instance of it.PHP Code:$connection = new MySQLi('bla','bla','bla','bla');
$user = new User('blabla');
$user->database($connection);
I've rewritten the User class with minor adjustments:
I didnt't test anything so forgive me if I made any mistakes.PHP Code:class User {
private $row = null;
public function __construct($session) {
$this->session = $session;
}
public function database($connection){
$this->conn = $connection; // Dependency Injection, maybe put this in the constructor
}
public function grabData($k) {
if (is_null($this->row)){
$q = $this->conn->query("SELECT * FROM users WHERE username = '$this->session'");
$this->row = mysqli_fetch_assoc($q);
}
return $this->row[$k];
}
// Call RefreshRow() if something has been updated in the database
public function RefreshRow()
{
$q = $this->conn->query("SELECT * FROM users WHERE username = '$this->session'");
$this->row = mysqli_fetch_assoc($q);
}
}
Hope I could help!
It looks really good. Keep up the good work!
Verzonden vanaf mijn iPhone met behulp van Tapatalk
I got a white client, how do i fix it? Plz reply fast!
$q = $this->conn->query("SELECT * FROM users WHERE username = '$this->session'");
This is where prepared statements are for...
Also, I hate the style (no offence) but it looks TOO small in my opinion and really messy. I don't know much about your PHP but like above: that's what prepared statements are for..
Won't use it as I use my own custom CMS but still good attempt.