LoadaCMS - MySQLI - Object oriented PHP

Results 1 to 13 of 13
  1. #1
    Apprentice CodeFreak is offline
    MemberRank
    Aug 2013 Join Date
    6Posts

    LoadaCMS - MySQLI - Object oriented PHP

    Loada is a powerful and open-sourced cms(content managment system)
    that is being developed and executed in
    PHP OOP(Object oriented programming), MySQLi, CSS, HTML and JavaScript. And the shortcut to all of that is LoadaCMS.


    The main developer of LoadaCMS is me Eymen Plaiterentire. However other developers can be involved in this project.
    Developers who continues on developing this project are highly appreciated. Loada has nothing to do with
    sulakes habbo swf files or emulator-servers! users are responsible for any illegal acts that breaks
    against the copyright law. Loada is being developed for educational purpose and are totally free!
    you can allways download the latest version for free, and if you are a developer that continues
    developing loada and are planning to sell it, it's all on your responsibility. The config file is powerful and you can manage stuff like defualt motto, credits, pixels and you can also turn of the register page. This will be done and released within the next moth. A language file will also be included in the configuration map, you just have to rewrite the titles to translate :) easy! this is alot easier than opening the damn page in notepad and translating everything -.- agh..

    Here are some code snippets from register/login/registeroff objects:
    PHP Code:
    class inreg{

       public function 
    Create_user(){
       
       include 
    "Configuration/Language.php";
       
       if(isset(
    $_POST['create'])){
       
       if(empty(
    $_POST['username']) or empty($_POST['password']) or empty($_POST['c_password']) or empty($_POST['email'])){
        
        echo 
    "<div class='error'>".$convert['reg_empty']."</div>";
        
       }else{
        
        include 
    "Configuration/Config.php";
        
        
    $mysqli = new mysqli($localhost,$root,$password,$database);
        
    $username $mysqli->real_escape_string(strip_tags($_POST['username']));
        
    $password $mysqli->real_escape_string(strip_tags($_POST['password']));
        
    $email $mysqli->real_escape_string(strip_tags($_POST['email']));
        
        
    $check_username $mysqli->query("SELECT * From users WHERE username='$username'");
        
    $check_email $mysqli->query("SELECT * From users WHERE mail='$email'");
        
        if(
    mysqli_num_rows($check_username) > 0){
         echo 
    "<div class='error'>".$convert['username_busy']."</div>";
        }elseif(
    mysqli_num_rows($check_email) > 0){
         echo 
    "<div class='error'>".$convert['email_busy']."</div>";
        }elseif(
    strlen($username) > 15){
         echo 
    "<div class='error'>".$convert['username_long']."</div>";
        }elseif(
    strlen($username) < 3){
          echo 
    "<div class='error'>".$convert['username_short']."</div>";
        }elseif(
    strlen($password) < 6){
         echo 
    "<div class='error'>".$convert['password_short']."</div>";
        }elseif( 
    preg_match('/\s/',$username)){
         echo 
    "<div class='error'>".$convert['username_whitespace']."</div>";
        }else{
        
          if(
    $password == $_POST['c_password']){
         
    $password $mysqli->real_escape_string(strip_tags(md5(sha1($_POST['password']))));
         
    $mysqli->query("INSERT INTO users (username,password,mail,activity_points,motto,credits,look) VALUES ('$username','$password','$email','$pixels','$motto','$credits','$look')");
         
    $mysqli->query("UPDATE users SET online='1' WHERE username='$username'");
         
    $_SESSION['user'] = $username;
         
    header("location: home.php");
         }else{
          echo 
    "<div class='error'>".$convert['password_nomatch']."</div>";
         }
        }
        
        
       }
       
       }
       }

       Public function 
    Login_user(){
       
       include 
    "Configuration/Language.php";
       
       include 
    "Configuration/Config.php";
       
       
       If(isset(
    $_POST['login'])){
       
    #Checking for empty fields
       
       
    if( empty($_POST['username']) && empty($_POST['password']) ){
        
        echo 
    "<div class='error'>".$convert['error_emptyall']."</div>";
       
       }elseif(empty(
    $_POST['username']) && $_POST['password']){
        
        echo 
    "<div class='error'>".$convert['error_emptyusername']."</div>";
        
       }elseif(empty(
    $_POST['password']) && $_POST['username']){
       
        echo 
    "<div class='error'>".$convert['error_emptypassword']."</div>";
       }else{
       
        
    $mysqli = new mysqli($localhost,$root,$password,$database);
        
        
    $username $mysqli->real_escape_string(htmlspecialchars($_POST['username']));
        
    $password $mysqli->real_escape_string(htmlspecialchars(md5(sha1($_POST['password']))));
        
        
    $catchUser $mysqli->query("SELECT * From users WHERE username='$username' AND password='$password'");
        
        if(
    mysqli_num_rows($catchUser) > 0){
        
         
    $_SESSION['user'] = $username;
         
    $mysqli->query("UPDATE users SET online='1' WHERE username='$username'");
         
    header("location: home.php");
         
         }else{
          echo 
    "<div class='error'>".$convert['error_incorrect']."</div>";
         }
       }
       
       
       }
       
       if(isset(
    $_POST['register'])){
       
        if(
    $registration == false){
        
          echo 
    "<div class='error'>".$convert['register_off']."</div>";
          
        }elseif(
    $registration == true){
        
    $_SESSION['reg'] = true;
        
    header("location: register.php");
        }
       }
        
        }


    [UPDATES] some image of design:

    index:


    Register:



    Home:

    Last edited by CodeFreak; 31-08-13 at 01:32 PM. Reason: Fixing plain text, thank you Joopie


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

    Re: LoadaCMS - MySQLI - Object oriented PHP

    Next time if you paste some code, use the "paste in plain text" option. Now it's a complete mess.

  3. #3
    Valued Member Monsma is offline
    MemberRank
    Dec 2011 Join Date
    The NetherlandsLocation
    126Posts

    Re: LoadaCMS - MySQLI - Object oriented PHP

    Why you use if($var == true) you can do if($var) if(!$var)
    Last edited by Monsma; 30-08-13 at 09:50 PM.

  4. #4
    Apprentice CodeFreak is offline
    MemberRank
    Aug 2013 Join Date
    6Posts

    Re: LoadaCMS - MySQLI - Object oriented PHP

    Quote Originally Posted by Joopie View Post
    Next time if you paste some code, use the "paste in plain text" option. Now it's a complete mess.
    Thanks mate, it's fixed now.

  5. #5
    Apprentice CodeFreak is offline
    MemberRank
    Aug 2013 Join Date
    6Posts

    Re: LoadaCMS - MySQLI - Object oriented PHP

    Quote Originally Posted by Monsma View Post
    Why you use if($var == true) you can do if($var) if(!$var)
    I dunno, i don't feel so secure about !$var. Users defines the true och false variable via config, so i just made it == true or == false. It's the same thing, dont worry :)

  6. #6
    Lurking around Clawed is offline
    MemberRank
    Jun 2012 Join Date
    RaGEZONELocation
    785Posts

    Re: LoadaCMS - MySQLI - Object oriented PHP

    You should use prepared statements, either PDO or MySQLi.

    Quote Originally Posted by Monsma View Post
    Why you use if($var == true) you can do if($var) if(!$var)
    I tend to do
    PHP Code:
    if($var != false) && if($var != true
    I don't know why just do.

  7. #7
    Lurking around Clawed is offline
    MemberRank
    Jun 2012 Join Date
    RaGEZONELocation
    785Posts
    Quote Originally Posted by Clawed View Post
    You should use prepared statements, either PDO or MySQLi.



    I tend to do
    PHP Code:
    if($var != false) && if($var != true
    I don't know why just do.
    That doesn't really makes sence mate :/
    why would you have !=false when you can do == true or == false

    Quote Originally Posted by CodeFreak View Post
    That doesn't really makes sence mate :/
    why would you have !=false when you can do == true or == false
    Thats from years back when you could do that without $var being in the script, wouldn't chuck errors.
    Last edited by vLife; 30-09-13 at 03:29 PM.

  8. #8
    Valued Member Monsma is offline
    MemberRank
    Dec 2011 Join Date
    The NetherlandsLocation
    126Posts

    Re: LoadaCMS - MySQLI - Object oriented PHP

    I think it is just the way how you like it to do
    some people use 'is_null($var);' i do '$var == null;'

  9. #9
    Apprentice CodeFreak is offline
    MemberRank
    Aug 2013 Join Date
    6Posts

    Re: LoadaCMS - MySQLI - Object oriented PHP

    Quote Originally Posted by Monsma View Post
    I think it is just the way how you like it to do
    some people use 'is_null($var);' i do '$var == null;'
    == true / false is common for every programming language. I think it's better to learn the proper way than just the "PHP way" for doing it.

  10. #10
    The one and only! Hejula is offline
    MemberRank
    Nov 2008 Join Date
    4,128Posts

    Re: LoadaCMS - MySQLI - Object oriented PHP

    Quote Originally Posted by CodeFreak View Post
    == true / false is common for every programming language. I think it's better to learn the proper way than just the "PHP way" for doing it.
    It doesn't matter how you do it.

    if($var) and if($var == true) both get the same result. There is no "proper way". It's all down to your preference.

  11. #11
    Evil Italian Overlowrd Droppy is offline
    [Internal Coder]Rank
    Feb 2012 Join Date
    /home/droppyLocation
    2,078Posts

    Re: LoadaCMS - MySQLI - Object oriented PHP

    you don't need to include the config/languages everytime a function starts... it makes me cry.
    But anyway, it looks great, I hope luck with your project.

  12. #12
    I don't even know azaidi is offline
    MemberRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    Re: LoadaCMS - MySQLI - Object oriented PHP

    Do I see 2 mysqli links there? If I do, then this project isn't worth a shit

  13. #13
    Lurking around Clawed is offline
    MemberRank
    Jun 2012 Join Date
    RaGEZONELocation
    785Posts

    Re: LoadaCMS - MySQLI - Object oriented PHP

    This is rather poorly coded, i don't see this very good at all, but anyway goodluck, you need it.

    Quote Originally Posted by azaidi View Post
    Do I see 2 mysqli links there? If I do, then this project isn't worth a shit
    Yep



Advertisement