How to store the value ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smartic
    New Member
    • May 2007
    • 150

    How to store the value ?

    i need to make Registration code to prevent from automated registrations in my site but im having problem with this code :
    [PHP]<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    </head>
    <body>
    <?php
    $codeID=addslas hes($_POST['Code']);

    $number=rand(1, 3);

    if($codeID=="") {
    echo "Please enter the code shown";
    }else{
    if($codeID==$Co deKEY){
    echo "Right";
    }else{
    echo "Please enter the code shown";
    }
    }

    switch($number) {
    case 1:
    $CodeKEY="a2je9 ";
    break;
    case 2:
    $CodeKEY="b1hk5 ";
    break;
    case 3:
    $CodeKEY="c2589 ";
    break;
    }
    ?>
    <?php
    echo "<br /><img src='IMGS/Code_$number.gi f' border='1'/>";
    ?>
    <br />
    <form id="form1" name="form1" method="post" action="">
    <input name="Code" type="text" id="Code" maxlength="5" />
    <input name="register" type="submit" class="btn" id="register" value="Signup"/>
    </form>
    <?php echo "Image Key :".$CodeKEY."<b r />"."Input Code:".$codeID; ?>
    </body>
    </html>[/PHP]

    any one will test this code need this images:


  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, smartic.

    What do you want your code to do? Give an example.
    What is your code doing that you don't want it to do? Give an example.
    What is your code *not* doing that it is supposed to? Give an example.

    Comment

    • smartic
      New Member
      • May 2007
      • 150

      #3
      What do you want your code to do?

      like yahoo registration



      What is your code doing that you don't want it to do?

      my posted data dosn't match with the image.

      What is your code *not* doing that it is supposed to?

      Check between what i have posted and the image.

      Comment

      • kovik
        Recognized Expert Top Contributor
        • Jun 2007
        • 1044

        #4
        You need to rethink what you are doing. What you are attempting to create is a CAPTCHA, and you are doing it in a very unorthodox and insecure manner. Any bot could simply remember the filename of the CAPTCHA image and re-enter it whenever it faces that image again.

        You should at least look into some tutorials and familiarize yourself with image manipulation and PHP's GD library.

        Comment

        • pbmods
          Recognized Expert Expert
          • Apr 2007
          • 5821

          #5
          If you want to build your own CAPTCHA, that's great. I wish you the best of luck; I know absolutely nothing about it that would make my opinion useful.

          If you just want to get it working, though, you can also use re-CAPTCHA, which is free.

          Comment

          Working...