Archive

Archive for December, 2008

Want to make fake website for fun?

December 26, 2008 ppshein Leave a comment

In these days, I got free spare time to surf websites. That’s why I was surfing here and there. Oddly, I’ve found one website support us to make fake website for fun.

  • Open the website what you want to fake (ex: http://www.google.com)
  • copy this message, javascript:document.body.contentEditable=’true’; document.designMode=’on’; void 0 into address bar (URL) and press Enter.
  • So, you can see this website as in rich-text editor.
Categories: Informations, Javascript Tags: ,

Image Captcha PHP

December 17, 2008 ppshein Leave a comment

In these days, one of my clients complaint me that he received a lot of spams from reservation form which I created without preventing spams. That’s why I need to put image captcha on it with PHP. For this, I don’t want to use complicated coding, and want to use simple way. That’s why I got suitable solutions from this website.

http://www.phpjabbers.com/captcha-image-verification-php19.html

<?php
session_start();
$text = rand(10000,99999);
$_SESSION["vercode"] = $text;
$height = 25;
$width = 65;

$image_p = imagecreate($width, $height);
$black = imagecolorallocate($image_p, 0, 0, 0);
$white = imagecolorallocate($image_p, 255, 255, 255);
$font_size = 14;

imagestring($image_p, $font_size, 5, 5, $text, $white);
imagejpeg($image_p, null, 80);
?>

Save this code in a file called captcha.php. Next we need to create our web form like register.html or reservation.html.

<form action=”submit.php” method=”post”>
Comment: <textarea name=”coment”></textarea><br>
Enter Code <img src=”captcha.php”><input type=”text” name=”vercode” /><br>
<input type=”submit” name=”Submit” value=”Submit” />
</form>

All we have to do now is to make the submit.php script which will check if the verification code you enter matches the one that has been randomly generated.

<?php
session_start();
if ($_POST["vercode"] != $_SESSION["vercode"] OR $_SESSION["vercode"]==”)  {
echo  ‘<strong>Incorrect verification code.</strong><br>’;
} else {
// add form data processing code here
echo  ‘<strong>Verification successful.</strong><br>’;
};
?>

Best Credit to : http://www.phpjabbers.com/captcha-image-verification-php19.html

Categories: php Tags: , , , ,