• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

HabboAPI : Housekeeping - OOP | PDO | REST | ROUTING | TEMPLATING

Status
Not open for further replies.
Junior Spellweaver
Joined
Jan 28, 2013
Messages
157
Reaction score
104
HabboAPI : Housekeeping - OOP | PDO | RESTFUL | MOBILE

HabboAPI
housekeeping


OOP | PDO | RESTFUL | MOBILE

Hey there!

Although I have gone under a few different names, the last project I released on here was many many years ago called Habblux Housekeeping. It had tons of unique features no other system provided and people really seemed to like it. Although I have worked on many things since that release, I haven't done anything that I was releasing to the public. I'm back with a backend system called HabboAPI which I really think will be a fantastic release.

[UPDATE] I have added the option to view a demo, checkout the details below!

MOBILE FRIENDLY
I'm putting a lot of focus into what I haven't really seen yet, mobile optimization. For the frontend I'm using Material Design by Google along with jQuery. So far I have all pages rendering perfectly depending on the screen size or the mobile device your using. Materials toast system makes alerting perfect on a mobile sized screen. The left navigation bar pulls out just by swiping or with a press of the menu button.

RESTFUL / ROUTING
I decided to build this system using the REST protocols. It supports GET, POST, PUT, DELETE, OPTIONS, PATCH, & HEAD. I got the router code from "bramus/router" on GitHub, which I did recode a bit to have it be built into the API. The router is placed into the index page, all REST calls are routed through it. If we want to move forward in this community I think we need to take advantage of all different kinds of technologies available. If we wanted to build an iOS or Android app for example, a REST API would be useful to remotely grab that data.

PAGES / TEMPLATING
I have built a simple system to set each page which allows you to define custom functions and routes. Here is an example of the login page:

PHP:
class Login_page extends Page
{
     public     $page_initialized    = false,
                  $page_name         = "login",
                  $page_vars           = [],
                  $page_disabled     = false;

     public function __construct()
     {
          if($this->page_initialized == false)
          {
               parent::__construct($this->page_name);
               
               if($this->page_exists() == true)
               {
                    $this->register_routes();
                    $this->page_initialized = true;
               }

               return true;
          }

          return false;
     }
     
     public function register_routes()
     {
           Router::mount("/content/page/" . $this->page_name, function()
          {
               Router::match("POST", "/view", function()
               {
                    die($this->display_page());
               });
               
               Router::match("POST", "/authenticate", function()
               {
                    die($this->login());
               });
          });
     }

     public function login()
     {
          $user_name    = (isset($_POST["user_name"]) && HabboAPI::is_null($_POST["user_name"]) == false) ? $_POST["user_name"] : null;
          $user_pass    = (isset($_POST["user_pass"]) && HabboAPI::is_null($_POST["user_pass"]) == false) ? $_POST["user_pass"] : null;
          $user_pin    = (isset($_POST["user_pin"]) && HabboAPI::is_null($_POST["user_pin"]) == false) ? $_POST["user_pin"] : null;
          
          if($user_name != null)
          {
               if($user_pass != null)
               {
                    if($user_pin != null)
                    {
                         return (Authenticator::login($user_name, $user_pass, $user_pin) == true) ? "valid_login" : "invalid_login";
                    }
                    else
                    {
                         return "empty_pin";
                    }
               }
               else
               {
                    return "empty_password";
               }
          }
          else
          {
               return "empty_username";
          }
          
          return "invalid_login";
     }
}

COMPLETED FEATURES
  • REST / Routing system
  • Page / Template system
  • Login system
  • Permission system
  • Various other things that I can't think of right now lol

TODO

  • Alot

DEMO
  • Link: demo currently down :(
  • Username: demo
  • Password: demo
  • Pin: 1234
  • You may see errors at anytime as I am constantly updating it...
  • ALSO, a user can only be logged in from one device at a time, so if someone else uses the login you may be kicked off!
GITHUB & CODE SNIPPETS

  • Link:



SCREENSHOTS


  • Login:
  • Login (Mobile):
  • Main / Dashboard: http://d.pr/i/1lRQN
  • Main / Dashboard (Mobile): http://d.pr/i/18mdQ
 
Last edited:
Joined
Sep 10, 2011
Messages
778
Reaction score
138
How is this overkill, when it's literally the very basics of an housekeeping system? Also, if you're using REST API methods, you should look into AngularJS to make the whole experience feel sped up, and flow better.
 
Junior Spellweaver
Joined
Jan 28, 2013
Messages
157
Reaction score
104
I would really like to use AngularJS but my javascript isn't to crazy, I'm alright with jQuery but when it comes to anything else i'm like eh LOL but I really am looking into it.



Yeah, cool. Good luck explaining to people on here how to use it and/or modify it.

Also, just one word.. overkillllllllll

That's just fine lol it's my project
 
Junior Spellweaver
Joined
Jan 28, 2013
Messages
157
Reaction score
104
That is true, it is your project. Though, as per RZ rules this has to be released when/if completed I was just stating when it comes round to that time, you're gonna get alot of annoying noobs hitting you up. Definitely if it turns out good (which it looks like it will!)

Good luck :)

Alright LOL well now I feel rude answering it like that. I've made it pain free, just add a row to the housekeeping_pages table and make the .tpl file in your templates folder. Then, if you want it in the navigation just add it to the navigation table. Eventually of course I will make it so you can do all this in the panel itself.
 

pel

Skilled Illusionist
Joined
Jan 27, 2012
Messages
382
Reaction score
343
I would really like to use AngularJS but my javascript isn't to crazy, I'm alright with jQuery but when it comes to anything else i'm like eh LOL but I really am looking into it.





That's just fine lol it's my project

You can code jQuery but no vanilla JS? ... vanilla JS is ways easier than jQuery because of jQuerys functions.. o_O
and Angular.. if you dont know how to handle it just copy & paste it
 
Junior Spellweaver
Joined
Jan 28, 2013
Messages
157
Reaction score
104
You can code jQuery but no vanilla JS? ... vanilla JS is ways easier than jQuery because of jQuerys functions.. o_O
and Angular.. if you dont know how to handle it just copy & paste it

Well I've never heard of or tried vanilla JS. I'm trying to work with AngularJS, I haven't gotten very far with it right now I'm trying to workout the ui-router. If anyone is good with AngularJS and could help me out that would be fantastic.
 
Junior Spellweaver
Joined
Jan 28, 2013
Messages
157
Reaction score
104
Here's an update with 2 screenshots. It's still in the very early stages so it's not much to see but they give you an idea of how the layout will look.


 
Junior Spellweaver
Joined
Jan 28, 2013
Messages
157
Reaction score
104
It looks nice. I've been following this thread as I would like to see how it turns out

Well thanks Jonteh! Hopefully I can get it all done. I have so many ideas but then once I start working on one thing I start thinking about another feature I want then I get mad when something isn't working how I want it so I have to code it all over again. Like I've already changed the whole page system from when I originally wrote the post lol. Hopefully the current way I'm doing is better. My next issue is figuring out what I want for each page.

UPDATE: I've updated the main post with some new details
 
Last edited:
Master Summoner
Joined
Dec 1, 2013
Messages
547
Reaction score
694
I like the design it's really amazing.

I have some idea's for you:

- Maybe to use for the PIN system Google Authenticator?
- Creating an advanced users statistics system. For example registered users last 10 minutes or last week versus this week.


Good job =]
 
Junior Spellweaver
Joined
Jan 28, 2013
Messages
157
Reaction score
104
@billsonnn are u using "bramus/router" from GitHub as Router? Because i use it too, is really good yeah?
Check my project that i use here:

Haha yes! And your project looks cool but I'll be honest I'm not really sure what UIoT is but I mean the code looks nice and clean keep up the good work :)
 
Joined
Aug 10, 2011
Messages
7,399
Reaction score
3,308
I remember you. And using Habblux. Great to see you back!

Haha yes! And your project looks cool but I'll be honest I'm not really sure what UIoT is but I mean the code looks nice and clean keep up the good work :)

Ultimate Internet of Things? IDK. This guy is high on coke when he names his projects x)
 
Joined
Apr 17, 2012
Messages
508
Reaction score
77
Hello,

Nice project. I really really like the layout! I have here some tips for you to work with:

- Think about big hotels and don't display not directly much data in HTML tables without given search parameters

- Keep it simple and think about giving much information to staff like a tracking userinfo pages whit maybe moderation action log (commands used against an user, bans, cautions, mutes), latest CFHs (call for helpers)

- Payment logs (It's very nice when you can track the payment logs for an user with an different tool)

- An usefull permission system with a datatable would be a must (call it housekeeping_fuses or whatever)

AND THE MOST IMPORTANT: before working things out, ask yourself the question if its usefull and rewarding to put it in your project. An good example of how not was the Phoenix Housekeeping: a client configuration page is maybe pretty cool for noobs but not essential and don't give advantage.

I hope these tips give you an step forward and that you'll finish this. Keep up the good work!
 
Last edited:
Status
Not open for further replies.
Back
Top