...

View Full Version : Include()



supertiti
03-10-2007, 10:31 AM
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



<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>

chump2877
03-10-2007, 10:39 AM
Impossible to tell why it's not working without seeing the code from rand.php...

rafiki
03-10-2007, 10:54 AM
random image isnt the way to go, try a real captcha script
www.hotscripts.com

chump2877
03-10-2007, 11:03 AM
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...

supertiti
03-10-2007, 11:16 AM
Here's the script, and a link to a test folder on the website (http://nothings.chronicles.free.fr/test/Bienvenue.html) :



<?
$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



<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 !

rafiki
03-10-2007, 11:21 AM
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

chump2877
03-10-2007, 12:35 PM
Here's the script, and a link to a test folder on the website (http://nothings.chronicles.free.fr/test/Bienvenue.html) :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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum