BrainCMS [PHP, From Scratch]

Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    "(still lacks brains)" NoBrain is offline
    MemberRank
    Sep 2011 Join Date
    United KingdomLocation
    2,658Posts

    BrainCMS [PHP, From Scratch]

    BrainCMS

    something...

    Introduction
    BrainCMS is a CMS designed to improve my PHP knowledge and is classes a CMS Base. BrainCMS is not intended for live hotel use.

    NOTE: I am still learning PHP, this is to release my Versions and see what you guys think ;)

    Features
    • MySQL Connection - 100%
    • Design - 15% (new style)
    • Login - 50%
    • Register - 0%
    • Account Submitting - 0%
    • Housekeeping - 0%
    • $_POST & $_GET Filtering - 0% (because their is none yet :P)
    • Rewrite in OOP - 0% (starting to learning OOP once I have basic knowledge of PHP)


    To-do List
    • Cleanup
    • Global.php cleanup
    • Definitions sort out
    • Template grabbing (instead of all the HTML in the one file)


    Contributors
    Jupos(nobrain)
    Nominal(Jak)

    Question
    What type of error reporting shall I use as default? E_ALL, E_STRICT, E_RECOVERABLE_ERROR or E_DEPRECATED.

    Specify if you know any more.

    Image(s)



  2. #2
    "(still lacks brains)" NoBrain is offline
    MemberRank
    Sep 2011 Join Date
    United KingdomLocation
    2,658Posts

    Re: BrainCMS [PHP, From Scratch]

    Quote Originally Posted by Roper View Post
    Looking nice dude, fancy sharing a few more snippets please? I'm intrigued!!!
    The MySQL Connection is pretty simple...

    PHP Code:
    mysql_connect($mysql_host$mysql_user$mysql_pass) or die("<center><font size=+4><bold>BrainCMS - MySQL Error</body></font></center><br /><center>Unable to connect to your MySQL Connection Information</center>");
    mysql_select_db($mysql_data) or die("<center><font size=+4><bold>BrainCMS - MySQL Error</body></font></center><br /><center>Unable to connect to database '" $mysql_data "'</center>"); 

  3. #3
    Ultra Light Beam Makarov is offline
    MemberRank
    Apr 2010 Join Date
    GothamLocation
    3,622Posts

    Re: BrainCMS [PHP, From Scratch]

    Quote Originally Posted by Jupos View Post
    The MySQL Connection is pretty simple...

    PHP Code:
    mysql_connect($mysql_host$mysql_user$mysql_pass) or die("<center><font size=+4><bold>BrainCMS - MySQL Error</body></font></center><br /><center>Unable to connect to your MySQL Connection Information</center>");
    mysql_select_db($mysql_data) or die("<center><font size=+4><bold>BrainCMS - MySQL Error</body></font></center><br /><center>Unable to connect to database '" $mysql_data "'</center>"); 
    Should have something like this for Errors
    PHP Code:
    define('Err', <center><font size=+4><bold>BrainCMS MySQL Error</body></font></center><br />); 
    Which would result in..
    PHP Code:
    mysql_connect($mysql_host$mysql_user$mysql_pass) or die(Err."<center>Unable to connect to your MySQL Connection Information</center>");
    mysql_select_db($mysql_data) or die(Err."<center>Unable to connect to database '" $mysql_data "'</center>"

  4. #4
    "(still lacks brains)" NoBrain is offline
    MemberRank
    Sep 2011 Join Date
    United KingdomLocation
    2,658Posts

    Re: BrainCMS [PHP, From Scratch]

    Quote Originally Posted by Tr0ll.™ View Post
    Should have something like this for Errors
    PHP Code:
    define('Err', <center><font size=+4><bold>BrainCMS MySQL Error</body></font></center><br />); 
    Which would result in..
    PHP Code:
    mysql_connect($mysql_host$mysql_user$mysql_pass) or die(Err."<center>Unable to connect to your MySQL Connection Information</center>");
    mysql_select_db($mysql_data) or die(Err."<center>Unable to connect to database '" $mysql_data "'</center>"
    Taking that, it looks alot cleaner. I will post an image once I've done it ;)

  5. #5
    "(still lacks brains)" NoBrain is offline
    MemberRank
    Sep 2011 Join Date
    United KingdomLocation
    2,658Posts

    Re: BrainCMS [PHP, From Scratch]

    Updated 'global.php' with Tr0ll's new MySQL Code:


  6. #6
    Live Ocottish Sverlord Joopie is offline
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,773Posts

    Re: BrainCMS [PHP, From Scratch]

    Way are you making a variable from a constant?
    It unnessesery and useless
    Posted via Mobile Device

  7. #7
    "(still lacks brains)" NoBrain is offline
    MemberRank
    Sep 2011 Join Date
    United KingdomLocation
    2,658Posts

    Re: BrainCMS [PHP, From Scratch]

    Quote Originally Posted by joopie View Post
    Way are you making a variable from a constant?
    It unnessesery and useless
    Posted via Mobile Device
    It needs cleaning up, I know.

  8. #8
    Ultra Light Beam Makarov is offline
    MemberRank
    Apr 2010 Join Date
    GothamLocation
    3,622Posts

    Re: BrainCMS [PHP, From Scratch]

    Quote Originally Posted by Jupos View Post
    Updated 'global.php' with Tr0ll's new MySQL Code:

    You don't need any of those 'variables'

  9. #9
    "(still lacks brains)" NoBrain is offline
    MemberRank
    Sep 2011 Join Date
    United KingdomLocation
    2,658Posts

    Re: BrainCMS [PHP, From Scratch]

    Quote Originally Posted by Tr0ll.™ View Post
    You don't need any of those 'variables'
    I'm cleaning it up as we speak...

    Cleaned up 'global.php':
    PHP Code:
    <?php
    /* * * * * * * * * * * * * * * * * * * * * * * * * * *
     * BrainCMS - Habbo CMS designed for BrainProject    *
     * * * * * * * * * * * * * * * * * * * * * * * * * * *
     * Copright (c) 2011, nobrain                        *
     * http://mmodev.co.uk                               *
     * * * * * * * * * * * * * * * * * * * * * * * * * * *
     * This program is free software: you can            *
     * redistribute it and/or modify                     *
     * it under the terms of the GNU General Public      *
     * License as published by                           *
     * the Free Software Foundation, either version 3    *
     * of the License, or (at your option) any later     *
     * version.                                          *
     * * * * * * * * * * * * * * * * * * * * * * * * * * */

    require_once 'includes/configuration.php';

    // Hotel Configuration Definitions (configuration.php)
    define(LINK$config['Site']['Link']);
    define(SHORTNAME$config['Hotel']['Shortname']);
    define(LONGNAME$config['Hotel']['Longname']);
    define(WEBBUILD$config['Hotel']['Webbuild']);
    define(VARS$config['Client']['Variables']);
    define(TEXTS$config['Client']['Flash_texts']);
    define(HABBO_SWF$config['Client']['Habbo_swf']);

    define(HOST$config['MySQL']['Host']);
    define(USER$config['MySQL']['User']);
    define(PASS$config['MySQL']['Pass']);
    define(DATA$config['MySQL']['Data']);

    define(ERROR_REPORTING$config['Brain']['Error_reporting']);
    define(MySQL_ERROR'<center><font size=+4><bold>BrainCMS - MySQL Error</body></font></center><br />');
            
    // Variables

    // Error reporting
    error_reporting(ERROR_REPORTING); // You can change this in the configuration

    // MySQL Connection (Credits to Tr0ll™)
    mysql_connect(HOSTUSERPASS) or die(MySQL_ERROR "<center>Unable to connect to your MySQL Connection Information</center>"); 
    mysql_select_db(DATA) or die(MySQL_ERROR "<center>Unable to connect to database '" DATA "'</center>")  

    ?>
    Last edited by NoBrain; 24-09-11 at 11:20 PM.

  10. #10
    prjRev.com Kryptos is offline
    MemberRank
    Feb 2010 Join Date
    Planet EarthLocation
    579Posts

    Re: BrainCMS [PHP, From Scratch]

    Quote Originally Posted by Jupos View Post
    I'm cleaning it up as we speak...

    Cleaned up 'global.php':
    PHP Code:
    // MySQL Connection (Credits to Tr0ll™)
    mysql_connect(HOSTUSERPASS) or die(MySQL_ERROR "<center>Unable to connect to your MySQL Connection Information</center>"); 
    mysql_select_db(DATA) or die(MySQL_ERROR "<center>Unable to connect to database '" DATA "'</center>")  
    ?> 
    ... lol
    PHP: mysql_connect - Manual

  11. #11
    Ultra Light Beam Makarov is offline
    MemberRank
    Apr 2010 Join Date
    GothamLocation
    3,622Posts

    Re: BrainCMS [PHP, From Scratch]

    Quote Originally Posted by Kryptos View Post
    He was talking about the definitions, get off your ego trip..

  12. #12
    CloudCMS Developer blackpol is offline
    MemberRank
    Aug 2006 Join Date
    The NetherlandsLocation
    232Posts

    Re: BrainCMS [PHP, From Scratch]

    Its not recommend to use constants or definitions because its slower for the server... Lots of constants can create a loading time of 1 or 2 seconds by just loading the php code

    Explanation:
    In computer programming languages like C# or C++ a constant will be replaced by his value by the compiler. Php don't have any compilers so it will be replaced by the server before running the script. So the callback from the server takes longer then just using a variable.

    So... in your case like mysql data etc. its bad to use constants because of the preformance

  13. #13
    "(still lacks brains)" NoBrain is offline
    MemberRank
    Sep 2011 Join Date
    United KingdomLocation
    2,658Posts

    Re: BrainCMS [PHP, From Scratch]

    Quote Originally Posted by blackpol View Post
    Its not recommend to use constants or definitions because its slower for the server... Lots of constants can create a loading time of 1 or 2 seconds by just loading the php code

    Explanation:
    In computer programming languages like C# or C++ a constant will be replaced by his value by the compiler. Php don't have any compilers so it will be replaced by the server before running the script. So the callback from the server takes longer then just using a variable.

    So... in your case like mysql data etc. its bad to use constants because of the preformance
    A variable will run at exactly the same speed rather than putting the data in automatically.

  14. #14
    "(still lacks brains)" NoBrain is offline
    MemberRank
    Sep 2011 Join Date
    United KingdomLocation
    2,658Posts

    Re: BrainCMS [PHP, From Scratch]

    Quote Originally Posted by Roper View Post
    Jupos, I think you should code this in OOP and create a database class - makes life much easier.
    I don't know OOP bro :(

  15. #15
    Account Upgraded | Title Enabled! Tony is offline
    MemberRank
    Feb 2011 Join Date
    349Posts

    Re: BrainCMS [PHP, From Scratch]

    Check your PM Jupos.



Page 1 of 2 12 LastLast

Advertisement