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!


Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2008
    Location
    England
    Posts
    46
    Tokens
    0

    Default PHP script won't display HTML.

    Proberly a noobish error, but it's 3:20AM and I can't find it and it's really annoying me.
    Code:
    <?php
    include("config.php");
     if(isset($_POST['submit'])) {
        $username = addslashes($_POST['username']);
        $email = addslashes($_POST['email']);
        $password1 = $_POST['password1'];
        $password2 = $_POST['password2'];
        if(empty($username) ||
           empty($email) ||
           empty($password1) ||
           empty($password2)) { 
            die("You missed out a field!");
    
        } else {
    
            if($password1 != $password2) { 
    
                die("Your passwords did not match.");
    
            } else {
     
                $junk = array('¬','`','!','\"','£','$','%','^','&','*','(',')','_','-','+','=','[',']','{','}',';',':','@','\'','#','~','<','>',',','.','/','?','\\','|',' ');
     
                $new_un = str_replace($junk,"",$username);
     
                if($new_un < $username) {
     
                    die("Your username contained invalid characters.");
     
                } else {
     
                    $pw_len = strlen($password1);
     
                    if($pw_len < 6) {
     
                        die("Your password is too short. It needs to be 6 or more characters.");
     
                    } else {
     
                        $istaken = mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `username`='" . $username . "'"));
     
                        if($istaken >= 1) {
     
                            die("That username is already being used.");
     
                        } else {
    
                        $istaken = mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `email`='" . $email . "'"));
     
                        if($istaken >= 1) {
     
                            die("That email is already being used.");
     
                        } else {
     
                            $password = md5($password1);
     
                            $create = mysql_query("
                            INSERT INTO `users` (
                            `id`,
                            `username`,
                            `password`,
                            `email`,
                            ) VALUES (
                            NULL,
                            '" . $username . "',
                            '" . $password . "',
                            '" . $email . "'
                            );
                            ");
     
                            if(!$create) {
     
                                die("There was a problem creating the user.");
     
                            } else {
     
                                die("You were registered successfully. Click <a href='login.php'>here</a> to login.");
     
                            }
     
                        }
     
                    }
     
                }
     
            }
     
        }
     
    } 
    
    ?>
    <form id="register" method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
     
    Username:<br />
    <input type="text" name="username" /><br /><br />
    
    Email:<br />
    <input type="text" name="email" /><br /><br />
     
    Password:<br />
    <input type="password1" name="password1" /><br /><br />
     
    Confirm Password:<br />
    <input type="password2" name="password2" /><br /><br />
     
    <input type="submit" name="submit" value="Register" />
    
    </form>
    <?php
    
    }
    
    ?>
    It's a register script by the way. Incase you didn't know :/

    Money sent via Paypal. Lowest payout $2.

  2. #2
    Join Date
    Oct 2008
    Location
    England
    Posts
    46
    Tokens
    0

    Default

    I cant my posts yet; but I've fixed the error.

    Money sent via Paypal. Lowest payout $2.

Posting Permissions

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