[PHP, OOP, MySQLi] sulakeWEB

Status
Not open for further replies.
Joined
Apr 28, 2010
Messages
2,793
Reaction score
1,179
I'm done with habbo development. This will be my last stamp on this section. I'm going to be going all-out with the jQuery for this CMS. Do more with less work is the basic motto for this system. It will be compatible with Phoenix 3.4.6 and above.

Features so far
  1. Figure Caching
  2. Dynamic Logos
  3. Dynamic Login/Register
  4. Automatic Stat Refreshing
  5. HT Social Network

Credits
  1. Predict - Some CSS

Images

Index
Makarov - [PHP, OOP, MySQLi] sulakeWEB - RaGEZONE Forums


Register
Makarov - [PHP, OOP, MySQLi] sulakeWEB - RaGEZONE Forums


Me
Makarov - [PHP, OOP, MySQLi] sulakeWEB - RaGEZONE Forums


Code Snippets

Global:
PHP:
<?php
ob_start();
session_start();
/*
 * --------------------------------------------
 * SULAKEWEB - HABBO CONTENT MANAGEMENT SYSTEM
 * PROJECT REVISION CODENAME: BLOWFIS
 * --------------------------------------------
 * COPYRIGHT 2011 COBE MAKAROV
 * --------------------------------------------
 * SYSTEM RELEASED UNDER THE GNU PUBLIC       
 * LICENSE V3. NONE OF THE DEVELOPERS ARE    
 * AFFILIATED WITH THE SERVER(S) RAN WITH THE
 * HABBO CONTENT MANAGEMENT SYSTEM SULAKEWEB
 * --------------------------------------------
 * SOFTWARE COMPATIBLE WITH THE FOLLOWING OS
 * WINDOWS XP, VISTA, 7, 8
 * MACINTOSH OSX LEOPARD, SNOW LEOPARD, LION
 * LINUX DEBIAN, UBUNTU, FEDORA
 * iOS3(S), iOS4(S), iOS5
 * ANDROID 2.2, ANDROID 2.3.X, ANDROID 3.X
 * --------------------------------------------
 * @author: Cobe Makarov
 * --------------------------------------------
 */
//error_reporting(0);
include('./inc/classes/class.bootstrap.php');

$bt = new Sulake\Bootstrap();

if(!defined('Page') || !defined('Template') || !defined('AuthReq')){
    exit;
}

if (AuthReq == true && !isset($_SESSION['id'])){
    $bt->core->Redirect('index');
}
$bt->current = Template;
$bt->tpl->AddArg('logo', '<a href=" ">'.$bt->config['name'].'</a>');
$bt->tpl->AddArg('hotel', $bt->config['name']);
$bt->tpl->AddArg('tag', $bt->config['tag']);
$bt->core->SecureFormData();
$bt->tpl->Initialize();
$bt->habbo->CheckUpdates();
?>
<html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<script type="text/javascript" src="./gallery/jquery-1.6.4.js"></script>
<script type="text/javascript" src="./inc/templates/javascript/twitter.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?php
$bt->core->SetTitle($bt->config['name'].'-'.Page);
?>
</head>
<body>
If you don't have anything constructive to say, Don't post at all!
 
Last edited:
Re: [PHP, OOP]CMSulake

Deff Not Phoenix :/

Try Brick uber And Breakz0ne's edit also Hanglider :)

Nice progress:rolleyes:
 
Re: [PHP, OOP]CMSulake

Deff Not Phoenix :/

Try Brick uber And Breakz0ne's edit also Hanglider :)

Nice progress:rolleyes:

Once I get Brick I can definitely do that.

Breakzone's uber edit wasn't too good(I did fix the emulator myself..)

And maybe Hang?

But for now I would focus on one which would probably be uber by the sound of your post.
 
Re: [PHP, OOP]CMSulake

Most is uber looll
 
Re: [PHP, OOP]CMSulake

I also want to note that the database will need to be filled with whatever other database you have. Basically the database will have everything that is needed to run the CMS, You would need to import tables such as 'achievements', 'quests', 'rooms'
 
Re: [PHP, OOP]CMSulake

Ah so much work you doing all that?:$:
 
Re: [PHP, OOP]CMSulake

Looks to me the snippet isn't very good, you're checking useless stuff IMHO.

I recommend you create a database engine, in case some day you decide to move on from MySQL to MySQLi or PDO, good luck on your learning.
 
Re: [PHP, OOP]CMSulake

Ah so much work you doing all that?:$:

I'm only doing it to make it compatible with other emulators, If I supply all of that then they'll have to change the table name/structure anyways. It's better for them to just import what they have.

By the way started a little template system.

PHP:
<?php

class Template
    {
        function Fetch($dir){          
            echo file_get_contents('./sys/templates/'.$dir.'.tpl');
        }
    }
?>

And.. how it's used
PHP:
<?php
/*
 * The PAGE is the actual page name, makes it easier if defined in each foreground page.
 * NAVI is a bool and if true it shows the navigation bar, if not it doesn't
 * AUTHREQ just checks if the user needs to be logged in to access the page.
 */
define('PAGE', 'Home');
define('NAVI', false);
define('AUTHREQ', false);
require('global.php');
$temp->Fetch('index');
include('footer.php');
?>


---------- Post added at 10:26 PM ---------- Previous post was at 10:25 PM ----------

Looks to me the snippet isn't very good, you're checking useless stuff IMHO.

I recommend you create a database engine, in case some day you decide to move on from MySQL to MySQLi or PDO, good luck on your learning.

I'm not checking anything really, those !requires actually require them and also checks if they aren't there. A person of PHP should obviously know that.

I was actually going with MySQLi but then again, stupid people don't have the requirements.
 
Last edited:
Re: [PHP, OOP]CMSulake

Ok well good to hear, but importing a couple tables shouldn't be to hard.
 
Re: [PHP, OOP]CMSulake

I wonder what happened to mBoard...

Anyways, good luck with your project!

I still have it, I notice now it was pretty badly coded, This CMS is also a test of me using different methods and it coming out clean and well. mBoard wasn't clean code and will be cleaned when I'm ready.

I did put the source on a github(if I can find it)

PM me if you do want the link.

---------- Post added at 12:06 AM ---------- Previous post was at 12:04 AM ----------

By the way re-wrote the template fetch function, recently realized it didn't have php syntax at all. It still needs a bit of work but for now it works as expected
 
Re: [PHP, OOP]CMSulake

The simple template system looks similar to something i've done ^^.

Also, when connecting to mysql, try do it like this:

PHP:
$link = mysql_connect('localhost', 'user', 'pass');
mysql_select_db('db', $link);

It's always good to specify which connection you're using for which database, don't know why, just a good habit :)

It's also a good idea to write a db class just as Kryptos has said, because that way you can support multi db engines and make things easier for yourself too :)

Good luck!
 
Re: [PHP, OOP]CMSulake

The simple template system looks similar to something i've done ^^.
PHP:
function Fetch($dir){          
            include('./sys/templates/'.$dir.'.tpl');
        }

I do know what you mean because I looked at your CMS before deciding to make my own. I only got the directory names from you though('sys') and such. I do give credit where credit is due.
Also, when connecting to mysql, try do it like this:

PHP:
$link = mysql_connect('localhost', 'user', 'pass');
mysql_select_db('db', $link);

It's always good to specify which connection you're using for which database, don't know why, just a good habit :)
Good Tip.
It's also a good idea to write a db class just as Kryptos has said, because that way you can support multi db engines and make things easier for yourself too :)

Good luck!
I meant to point out there already is one, but it's for foreground pages at the moment.
 
Re: [PHP, OOP]CMSulake

PHP:
function Fetch($dir){          
            include('./sys/templates/'.$dir.'.tpl');
        }
I do know what you mean because I looked at your CMS before deciding to make my own. I only got the directory names from you though('sys') and such. I do give credit where credit is due.

Good Tip.

I meant to point out there already is one, but it's for foreground pages at the moment.

Awesome:thumbup1:

Oh, and when including for your 'fetch' function, instead of doing it like this:

PHP:
include('./sys ...');

it would be better to do it as

PHP:
include('sys/ ...');

because putting a dot before the directory seperator won't work on IIS7, and a fair few hotels use it these days to host their sites.

Good luck
 
Re: [PHP, OOP]CMSulake

Thanks,

Since everyone is talking about this Database Class:

PHP:
class Database
    {
        //Secure Database Work
    
        function Query($sQuery){
            $sQuery = mysql_real_escape_string($sQuery);
            mysql_query($Query);
        }
        
        function Fetch($sQuery){
            $sQuery = mysql_real_escape_string($sQuery);
            $result = mysql_query($sQuery);
            return $result;
        }
        
        function Prefix($Emu){
            switch ($Emu)
            {
                case "holograph":
                {
                    return 'holo_';
                    break;                   
                }
                case "uber":
                {
                    return 'uber_';
                    break;
                }
                case "pheonix":
                case "phx":
                {
                    return 'phx_';
                    break;
                }
            }
        }
    }

It's just a right up, and I'm not sure if any of it works perfectly.

If you're wondering what the last function is, I was planning on having it compatible with all 3 major emulators, but that's just too much work for me..
 
Re: [PHP, OOP]CMSulake

Thanks,

Since everyone is talking about this Database Class:

PHP:
class Database
    {
        //Secure Database Work
    
        function Query($sQuery){
            $sQuery = mysql_real_escape_string($sQuery);
            mysql_query($Query);
        }
        
        function Fetch($sQuery){
            $sQuery = mysql_real_escape_string($sQuery);
            $result = mysql_query($sQuery);
            return $result;
        }
        
        function Prefix($Emu){
            switch ($Emu)
            {
                case "holograph":
                {
                    return 'holo_';
                    break;                   
                }
                case "uber":
                {
                    return 'uber_';
                    break;
                }
                case "pheonix":
                case "phx":
                {
                    return 'phx_';
                    break;
                }
            }
        }
    }
It's just a right up, and I'm not sure if any of it works perfectly.

If you're wondering what the last function is, I was planning on having it compatible with all 3 major emulators, but that's just too much work for me..

Supporting phx and uber at the same time is rather easy work because there are only some slight database changes, just make a locale file that calls to see which query it needs to run for which server, and you can get most of the queries out of other CMS's if you can't be bothered writing them up.


EDIT -

and another thing, if you do your query functions like this they will execute faster;

PHP:
function Query($str)
{
  return mysql_result(mysql_query($str), 0);
}

Something like that.

Oh, and no point real escaping your queries just before they go into the db because it will strip everything out of them, it's better to do it when things POST and GET, eg

PHP:
// execute db etc
$point = mysql_real_escape_string(stripslashes(htmlspecialchars($_POST["data"])));
$mysql->Query("UPDATE .. SET .. = '" . $point . '" WHERE ...");

You get my drift, I hope.
 
Re: [PHP, OOP]CMSulake

Supporting phx and uber at the same time is rather easy work because there are only some slight database changes, just make a locale file that calls to see which query it needs to run for which server, and you can get most of the queries out of other CMS's if you can't be bothered writing them up.

That was my plan, I may still do that actually, Holograph was really throwing me off with that plan though.
 
Status
Not open for further replies.
Back