Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 41
  1. #21
    Join Date
    Apr 2007
    Location
    england
    Posts
    536
    Tokens
    0

    Default

    So, wahts is the finished code - I've been having trouble with this.


    Selling DJ/Habbo layout, more info here.


  2. #22
    Join Date
    Apr 2006
    Location
    Leamington Spa
    Posts
    1,375
    Tokens
    72

    Latest Awards:

    Default

    Seen as it doesn't look like anyone else is going to post it:
    Commented out mysql_real_escape_string because it only works if there's a database connection going on, didn't assume there was because there aren't any connections in the file.
    PHP Code:
    <?php

    //Clean function, comment out if not wanted.

    function clean($this){
    //$this = mysql_real_escape_string($this);
    $this strip_tags($this);
    $this htmlspecialchars($thisENT_QUOTES);
    $this stripslashes($this);
    return 
    $this;
    }

    if(isset(
    $_POST['submit'])){

    //The form was sent, let's do some stuff!

    $name clean($_POST['name']);
    $password clean($_POST['password']);
    $email clean($_POST['email']);
    $age clean($_POST['age']);

       if (
    $name == "")
        {
            echo 
    "Whoops! You didn't enter a username. You need that if you want to login!";
            exit;
        }

        if (
    $password == "")
        {
            echo 
    "Whoops! You didn't enter a password. You need this to login to your account as well as security for your account!";
            exit;
        }

        if (
    $email =="")
        {
            echo 
    "Whoops! You didn't enter an email. You need this to receive news and updates for the usersystem, as well as to verify your identity.";
            exit;
        }

        if (
    $age == "")
        {
            echo 
    "Whoops! You didn't enter your age. We need this to verify you are old enough to register!";
            exit;
        }

        echo(
    "Heya, $name - Welcome to $site. The details you used to sign up are as follows:<br>
        Name: 
    $name<br />
        Email: 
    $email<br />
        Age: 
    $age<br />
        <br />
        If the details are incorrect, use the back button and try again. If they are correct, please continue to the installer.
        "
    );

    }else{

    //The form hasn't yet been sent! Display it.

      
    echo("<form action=\"register2.php\" method=\"post\">
        Username: <input type=\"text\" name\"name\"><br>
        Password: <input type=\"text\" name\"password\"><br>
        Email: <input type=\"text\" name=\"email\"><br>
        Age: <input type=\"text\" name=\"age\"><br>
        <input type=\"submit\" name=\"submit\" value=\"Submit\">
        </form>
      "
    );

    }

    die();

    ?>
    Last edited by lolwut; 21-11-2007 at 09:12 PM.
    i've been here for over 8 years and i don't know why

  3. #23
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Complete code:

    PHP Code:
    <?php

    //Clean function, comment out if not wanted.

    function clean($string)
    {

        
    $string htmlspecialchars($stringENT_QUOTES);

        if (
    get_magic_quotes_gpc())
        {

            
    $string stripslashes($string);

        }

        
    $string str_replace("\""""$string);
        
    $string htmlentities($string);

        
    /**
         *  If you want SQL injection protection uncomment the next line
         */

        // $string = mysql_real_escape_string($string);

        
    return $string;

    }

    if (
    $_GET["action"] == "submit")
    {

        
    //The form was sent, let's do some stuff!

        
    $name clean($_POST["name"]);
        
    $password clean($_POST["password"]);
        
    $email clean($_POST["email"]);
        
    $age clean($_POST["age"]);

        if (
    $name == "")
        {
            echo 
    "Whoops! You didn't enter a username. You need that if you want to login!";
            exit;
        }

        if (
    $password == "")
        {
            echo 
    "Whoops! You didn't enter a password. You need this to login to your account as well as security for your account!";
            exit;
        }

        if (
    $email == "")
        {
            echo 
    "Whoops! You didn't enter an email. You need this to receive news and updates for the usersystem, as well as to verify your identity.";
            exit;
        }

        if (
    $age == "")
        {
            echo 
    "Whoops! You didn't enter your age. We need this to verify you are old enough to register!";
            exit;
        }

        echo 
    "Heya, $name - Welcome to $site. The details you used to sign up are as follows:<br>
        Name: 
    $name<br />
        Email: 
    $email<br />
        Age: 
    $age<br />
        <br />
        If the details are incorrect, use the back button and try again. If they are correct, please continue to the installer.
        "
    ;

        exit;

    }
    //The form hasn't yet been sent! Display it.

    echo ("<form action=\"register2.php\" method=\"post\">
        Username: <input type=\"text\" name\"name\"><br>
        Password: <input type=\"text\" name\"password\"><br>
        Email: <input type=\"text\" name=\"email\"><br>
        Age: <input type=\"text\" name=\"age\"><br>
        <input type=\"submit\" name=\"submit\" value=\"Submit\">
        </form>
      "
    );

    ?>

  4. #24
    Join Date
    Apr 2007
    Location
    england
    Posts
    536
    Tokens
    0

    Default

    When I use it, I enter everything and it tells me, " Whoops! You didn't enter a username. You need that if you want to login!".


    Selling DJ/Habbo layout, more info here.


  5. #25
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?php

    //Clean function, comment out if not wanted.

    function clean($string)
    {

        
    $string htmlspecialchars($stringENT_QUOTES);

        if (
    get_magic_quotes_gpc())
        {

            
    $string stripslashes($string);

        }

        
    $string str_replace("\""""$string);
        
    $string htmlentities($string);

        
    /**
         *  If you want SQL injection protection uncomment the next line
         */

        // $string = mysql_real_escape_string($string);

        
    return $string;

    }

    if (
    $_GET["action"] == "submit")
    {

        
    //The form was sent, let's do some stuff!

        
    $name clean($_POST["name"]);
        
    $password clean($_POST["password"]);
        
    $email clean($_POST["email"]);
        
    $age clean($_POST["age"]);

        if (
    $name == "")
        {
            echo 
    "Whoops! You didn't enter a username. You need that if you want to login!";
            exit;
        }

        if (
    $password == "")
        {
            echo 
    "Whoops! You didn't enter a password. You need this to login to your account as well as security for your account!";
            exit;
        }

        if (
    $email == "")
        {
            echo 
    "Whoops! You didn't enter an email. You need this to receive news and updates for the usersystem, as well as to verify your identity.";
            exit;
        }

        if (
    $age == "")
        {
            echo 
    "Whoops! You didn't enter your age. We need this to verify you are old enough to register!";
            exit;
        }

        echo 
    "Heya, $name - Welcome to $site. The details you used to sign up are as follows:<br>
        Name: 
    $name<br />
        Email: 
    $email<br />
        Age: 
    $age<br />
        <br />
        If the details are incorrect, use the back button and try again. If they are correct, please continue to the installer.
        "
    ;

        exit;

    }
    //The form hasn't yet been sent! Display it.

    echo ("<form action=\"register2.php\" method=\"post\">
        Username: <input type=\"text\" name=\"name\"><br>
        Password: <input type=\"text\" name\"password\"><br>
        Email: <input type=\"text\" name=\"email\"><br>
        Age: <input type=\"text\" name=\"age\"><br>
        <input type=\"submit\" name=\"submit\" value=\"Submit\">
        </form>
      "
    );

    ?>

  6. #26
    Join Date
    Apr 2007
    Location
    england
    Posts
    536
    Tokens
    0

    Default

    Now, when I regsiter a new page doesn't show up, all that happens is the form comes up again.


    Selling DJ/Habbo layout, more info here.


  7. #27
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?php

    //Clean function, comment out if not wanted.

    function clean($string)
    {

        
    $string htmlspecialchars($stringENT_QUOTES);

        if (
    get_magic_quotes_gpc())
        {

            
    $string stripslashes($string);

        }

        
    $string str_replace("\""""$string);
        
    $string htmlentities($string);

        
    /**
         *  If you want SQL injection protection uncomment the next line
         */

        // $string = mysql_real_escape_string($string);

        
    return $string;

    }

    if (
    $_GET["action"] == "submit")
    {

        
    //The form was sent, let's do some stuff!

        
    $name clean($_POST["name"]);
        
    $password clean($_POST["password"]);
        
    $email clean($_POST["email"]);
        
    $age clean($_POST["age"]);

        if (
    $name == "")
        {
            echo 
    "Whoops! You didn't enter a username. You need that if you want to login!";
            exit;
        }

        if (
    $password == "")
        {
            echo 
    "Whoops! You didn't enter a password. You need this to login to your account as well as security for your account!";
            exit;
        }

        if (
    $email == "")
        {
            echo 
    "Whoops! You didn't enter an email. You need this to receive news and updates for the usersystem, as well as to verify your identity.";
            exit;
        }

        if (
    $age == "")
        {
            echo 
    "Whoops! You didn't enter your age. We need this to verify you are old enough to register!";
            exit;
        }

        echo 
    "Heya, $name - Welcome to $site. The details you used to sign up are as follows:<br>
        Name: 
    $name<br />
        Email: 
    $email<br />
        Age: 
    $age<br />
        <br />
        If the details are incorrect, use the back button and try again. If they are correct, please continue to the installer.
        "
    ;

        exit;

    }
    //The form hasn't yet been sent! Display it.

    echo ("<form action=\"?action=submit\" method=\"post\">
        Username: <input type=\"text\" name=\"name\"><br>
        Password: <input type=\"text\" name\"password\"><br>
        Email: <input type=\"text\" name=\"email\"><br>
        Age: <input type=\"text\" name=\"age\"><br>
        <input type=\"submit\" name=\"submit\" value=\"Submit\">
        </form>
      "
    );

    ?>

  8. #28
    Join Date
    Apr 2007
    Location
    england
    Posts
    536
    Tokens
    0

    Default

    Now it says "Whoops! You didn't enter a password. You need this to login to your account as well as security for your account!".


    Selling DJ/Habbo layout, more info here.


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

    Latest Awards:

    Default

    This is just plain silly. The file he has posted has NO database stuff whatsoever, so why do you need a cleaning function? If it's just displaying HTML then all you need is something like htmlentites & stripslashes :\

  10. #30
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Okay, what is the point of the register script if he isn't going to register someone?

    He is making a user system.. he is going to end up inserting it somewhere.. best to have a clean function :\

Page 3 of 5 FirstFirst 12345 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
  •