mCMS [PHP,SQL]

Page 1 of 4 1234 LastLast
Results 1 to 15 of 48
  1. #1
    Account Upgraded | Title Enabled! Tony is offline
    MemberRank
    Feb 2011 Join Date
    349Posts

    mCMS [PHP,SQL]

    Hey, I am making a content management system for you habbo users so here is the development thread.

    Already there
    • Style
    • Configuration
    • Login
    • Register


    What's going on?
    • Housekeeping
    • Security
    • Faster
    • Client
    • Pages


    Credits:
    Code:
    Kryptos - Some Snippets
    Ry - Design
    Nominal - for compliments :)
    Tr0ll.™ - Big Help !
    Images






    Code Snippets
    PHP Code:
    <?php
    $link 
    mysqli_connect("localhost""my_user""my_password""world");

    /* check connection */
    if (mysqli_connect_errno()) {
        
    printf("Connect failed: %s\n"mysqli_connect_error());
        exit();
    }

    $hotel "mHotel";

    /* create a prepared statement */
    if ($stmt mysqli_prepare($link"SELECT Hotel FROM Home WHERE Name=?")) {

        
    /* bind parameters for markers */
        
    mysqli_stmt_bind_param($stmt"s"$swfs);

        
    /* execute query */
        
    mysqli_stmt_execute($stmt);

        
    /* bind result variables */
        
    mysqli_stmt_bind_result($stmt$ip);

        
    /* fetch value */
        
    mysqli_stmt_fetch($stmt);

        
    printf("%s is in district %s\n"$hotel$swfs);

        
    /* close statement */
        
    mysqli_stmt_close($stmt);
    }

    /* close connection */
    mysqli_close($link);
    ?>
    Last edited by Tony; 25-09-11 at 07:57 PM.


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

    Re: mCMS [PHP,SQL]

    Thread updated.

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

    Re: mCMS [PHP,SQL]

    Nice work, hopefully this will be finished!

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

    Re: mCMS [PHP,SQL]

    Rewriting the register page.

    PHP Code:
    //Input vaildation and the dbase code
    if ( $_GET["op"] == "reg" )
     {
     
    $bInputFlag false;
     foreach ( 
    $_POST as $field )
      {
      if (
    $field == "")
       {
       
    $bInputFlag false;
       }
      else
       {
       
    $bInputFlag true;
       }
      }
     
    // If we had problems with the input, exit with error
     
    if ($bInputFlag == false)
      {
      die( 
    "Problem with your registration info. "
       
    ."Please go back and try again.");
      }
     
     
    // Fields are clear, add user to database
     //  Setup query
     
    $q "INSERT INTO `dbUsers` (`username`,`password`,`email`) "
      
    ."VALUES ('".$_POST["username"]."', "
      
    ."PASSWORD('".$_POST["password"]."'), "
      
    ."'".$_POST["email"]."')";
     
    //  Run query
     
    $r mysql_query($q); 

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

    Re: mCMS [PHP,SQL]

    PHP Code:
    <?php
    //Input vaildation and the dbase code
    if ( $_GET["op"] == "reg" )
     {
         
    $bInputFlag false;
         foreach ( 
    $_POST as $field )
          {
              if (
    $field != null)
               {
                   
    $bInputFlag true;
               }
          }
     
    // If we had problems with the input, exit with error
     
    if (!$bInputFlag)
          {
            die( 
    "Problem with your registration info. Please go back and try again.");
          }
     

     
    $r mysql_query("INSERT INTO `dbUsers` (`username`,`password`,`email`) VALUES ('".$_POST["username"]."', '".$_POST["password"]."', '".$_POST["email"]."')");  
    ?>
    Clean up your code.. I hope you're using an IDE to code all of this.

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

    Re: mCMS [PHP,SQL]

    Was using Notepad++ gives me sloppy version of my code. So now I'm installing JDK now I'm going to use IDE.

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

    Re: mCMS [PHP,SQL]

    Quote Originally Posted by Tr0ll.™ View Post
    PHP Code:
    <?php
    //Input vaildation and the dbase code
    if ( $_GET["op"] == "reg" )
     {
         
    $bInputFlag false;
         foreach ( 
    $_POST as $field )
          {
              if (
    $field != null)
               {
                   
    $bInputFlag true;
               }
          }
     
    // If we had problems with the input, exit with error
     
    if (!$bInputFlag)
          {
            die( 
    "Problem with your registration info. Please go back and try again.");
          }
     

     
    $r mysql_query("INSERT INTO `dbUsers` (`username`,`password`,`email`) VALUES ('".$_POST["username"]."', '".$_POST["password"]."', '".$_POST["email"]."')");  
    ?>
    Clean up your code.. I hope you're using an IDE to code all of this.
    *cough* filtering *cough*

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

    Re: mCMS [PHP,SQL]

    Quote Originally Posted by Malik View Post
    Was using Notepad++ gives me sloppy version of my code. So now I'm installing JDK now I'm going to use IDE.
    Use Netbeans..

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

    Re: mCMS [PHP,SQL]

    I will now learned a lesson from notepad.

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

    Re: mCMS [PHP,SQL]

    Using this
    PHP Code:
     $stop 

  11. #11
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: mCMS [PHP,SQL]

    Good luck with your project, oh and I use WordPad to code everything.. (HTML, CSS, PHP, .JS) xD

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

    Re: mCMS [PHP,SQL]

    Thanks Lol, WordPad is ugly and gives bad format of code and makes looks sloppy, add me on msn malikotaku@gmail.com

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

    Re: mCMS [PHP,SQL]

    UltraEdit Wtf ;D, Btw, No mysql_real_escape string? x]

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

    Re: mCMS [PHP,SQL]

    I always use Notepad++ lol, it is the best <3 IDE's just annoy me when they correct you before you have finished writing your line :L

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

    Re: mCMS [PHP,SQL]

    PHP Code:
    public function write($p) {
        if ( 
    $p['username'] )
          
    $username mysql_real_escape_string($p['username']);
        if ( 
    $p['password'])
          
    $password mysql_real_escape_string($p['password']);
        if ( 
    $username && $password ) {
          
    $created time();
          
    $sql "INSERT INTO mDB VALUES('$username','$password','$created')";
          return 
    mysql_query($sql);
        } else {
          return 
    false;
        }




Page 1 of 4 1234 LastLast

Advertisement