Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: Include()

  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Include()

    Hi everyone

    I'm trying to set up a basic home made CAPTCHA system to secure users registration to my site's mailing list. I created a php script to display a random image and used include() to try make it appear in a table cell. But it doesn't seem to work, and in fact i don't even know if it's possible to do it this way.

    Here is the table code, could somebody tell me what's wrong ?

    Many thanks

    Terence

    Code:
    <table align="left" width="800px" height="150">
    
    <tr>
             <td width="129">Name</td>
             <td width="275"><input name="name" type="text"  maxlength="256" /></td>
             <td width="217">Please write the text you see in the image</td>
             <td width="159"><?php include('rand.php'); ?></td>
    </tr>
    
    <tr>
    	<td>Mail:</td>
    	<td><input type="text" name="mail" /></td>
    	<td><input type="text" name="code" /></td>
    </tr>
    
    <tr>
    	<td><input type="submit" name="Submit" value="Ajouter" /></td>
    </tr>
    
    </table>
    Last edited by supertiti; 03-10-2007 at 11:35 AM.

  • #2
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,857
    Thanks
    22
    Thanked 157 Times in 148 Posts
    Impossible to tell why it's not working without seeing the code from rand.php...
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :-)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!
    ♪♪ …Need Web Hosting For My YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

  • #3
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    random image isnt the way to go, try a real captcha script
    www.hotscripts.com

  • #4
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,857
    Thanks
    22
    Thanked 157 Times in 148 Posts
    Why wouldn;t a random image with distorted text work? Sure, you may not be able to form as many permutations of letters/numbers, and it's not as eloquent a solution, but it doesn;t change the fact that bots can;t scan distorted text in images...

    As long as the images he is using contains distorted text, it should work just as well...
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :-)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!
    ♪♪ …Need Web Hosting For My YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

  • #5
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here's the script, and a link to a test folder on the website :

    PHP Code:
            <?
                $rand 
    =rand(0,4);
                print(
    'Image:<input name="image" type="text" readonly value="'.$rand.'" size="1"><br>');
                print(
    '<img src="image'.$rand.'.png"><br>');
            
    ?>
    And also the mailing2.php form

    PHP Code:
    <body>
    <form action="mailing.php" method="post" name="mailing">
      <p>
      Nom:
      <input name="nom" type="text" maxlength="256" />
      </p>
      <p>Pr&eacute;nom:

        <input name="prenom" type="text"  maxlength="256" />
        </p>
      <p>Adresse:
        <input type="text" name="adresse" />
    </p>
      <p>T&eacute;l:
        <input type="text" name="tel" />
      </p>
      <p>Mail:
        <input type="text" name="mail" />
      </p>

    <p>
    <?
    $rand 
    =rand(0,4);
    print(
    '<input type=hidden name="image" type="text" readonly value="'.$rand.'" size="1"><br>');
    print(
    '<img src="image'.$rand.'.png"><br>');
    ?>
    Ecrivez ce qu'il y a sur l'image ci-dessus:
        <input type="text" name="code" />

    </p>

      <p>
        <input type="submit" name="Submit" value="Ajouter" />
      </p>
    </form>
    </body>
    Thanks !
    Last edited by supertiti; 03-10-2007 at 12:31 PM.

  • #6
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    i didnt say it wouldnt work, i said its not the way to go, CAPTCHA is more geniuine, especially if you only have four random images, where captcha has millions of different ways of being, someone could program the bot to enter one of the four random codes from your for pictures. not a guaranteed way but will eventually get it right

  • #7
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,857
    Thanks
    22
    Thanked 157 Times in 148 Posts
    Here's the script, and a link to a test folder on the website :
    that is an HTML page....PHP won't be parsed inside an HTML file...look at the page's source, and you will see the PHP in there...so that explains why your PHP include isn't working....

    This is the CAPTCHA solution I use, you might want to take a look at it: http://www.phpclasses.org/browse/package/3193.html
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :-)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!
    ♪♪ …Need Web Hosting For My YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪


  •  

    Posting Permissions

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