Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Php help

  1. #1
    Join Date
    Mar 2008
    Posts
    265
    Tokens
    0

    Default Php help

    Can any of you see a problem with this script?
    PHP Code:
    <?php

    $user_name 
    $_POST["user_name"];
    $password $_POST["password"];
    $admin $_POST["admin"];

    if( 
    $admin == 'on' ) {
        
    $admin 1;
    } else {
        
    $admin 0;
    }

    echo 
    $user_name.','.$password.','.$admin;

    //echo $user_name;

    if( $user_name == '' or $password == '' ) {
        
    header'location: create_user.html' );
    }

    $user 'temp_admin';
    $password '';
    $host 'localhost';
    $database 'security';

    $cxn mysqli_connect$host$user$password$database )
        or die( 
    'Could not connect to database' );

    $sql "insert into user ( user_name, password, admin )
            values ( '" 
    .$user_name"', '" .$password"', " .$admin" )";

    $result mysqli_query$cxn$sql );

    echo 
    "Created user ".$user_name;

    ?>
    Boston here i come

  2. #2
    Join Date
    Jul 2008
    Location
    Hastings, UK.
    Posts
    2,050
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    echo $user_name;
    echo 
    $password;
    echo 
    $admin

  3. #3
    Join Date
    Jun 2008
    Location
    Manchester
    Posts
    766
    Tokens
    0

    Default

    It would help if you told us what's going wrong.

  4. #4
    Join Date
    Mar 2008
    Posts
    265
    Tokens
    0

    Default

    Ok you can sign normal people up but when you wont to sign a admin up it doesn't work
    Boston here i come

  5. #5
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    Are you sure you are posting $_POST['admin'] as "on"?
    Lets set the stage on fire, and hollywood will be jealous.

  6. #6
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    PHP Code:
    <?php

    $user_name 
    $_POST'user_name' ];
    $password $_POST'password' ];
    $admin $_POST'admin' ];

    if( 
    $admin == 'on' )
    {

        
    $admin '1';

    }
    else
    {

        
    $admin '0';
        
    }

    echo 
    $user_name ',' $password ',' $admin;

    //echo $user_name;

    if( $user_name == '' || $password == '' )
    {

        
    header'Location: create_user.html' );
        die;
        
    }

    $user 'temp_admin';
    $password '';
    $host 'localhost';
    $database 'security';

    $cxn mysqli_connect$host$user$password$database ) or die( 'Could not connect to database' );

    $sql "INSERT INTO `user` ( `user_name`, `password`, `admin` ) VALUES ( '" $user_name "', '" $password "', '" $admin "' )";

    $result mysqli_query$cxn$sql );

    echo 
    'Created user ' $user_name;

    ?>
    That should work...if not please tell me/us the error.

  7. #7
    Join Date
    Jul 2008
    Location
    Hastings, UK.
    Posts
    2,050
    Tokens
    0

    Latest Awards:

    Default

    I hate it when people capitalize the first letter of php and leave the rest in lowercase

    Sorry, but your explanation really didn't help me, Simon's code looks like it should work, I haven't seen it, but yeah..

  8. #8
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    I hope your not basing administrator abilities on a post, fyi this could easily be spoofed.
    How could this hapen to meeeeeeeeeeeeeee?lol.

  9. #9
    Join Date
    Dec 2006
    Location
    Scotland
    Posts
    1,365
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Hypertext View Post
    I hope your not basing administrator abilities on a post, fyi this could easily be spoofed.
    Ah... Looks like he is.

  10. #10
    Join Date
    Nov 2007
    Posts
    1,253
    Tokens
    150

    Latest Awards:

    Default

    It shouldn't be a problem, as this looks like its in an admin control area... its for making users and not logging in etc...


    www.fragme.co = a project.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •