Coder Profile - Show off your skills, get a coder profile.
 
 
 
code pin board New Auth Image Download Source Code
Author Details Code Information
Relish ( Mike )

Pinned 3 Codes
Posted 1 Coding Articles

Send A Message
View Coders Profile
Language PHP (Hypertext Preprocessor)
Expires Never
Length 1,769 Characters (69 Lines)
Password no password
  1. <!----- FORM PAGE ------->
  2. <?php
  3.        session_start();
  4.  
  5.        if(isset($_POST['captcha'])) {
  6.               $captcha_string = $_SESSION['captcha'];
  7.               $user_input = md5($_POST['captcha']);
  8.               if($user_input === $captcha_string) {
  9.                      echo 'Correct!';
  10.               } else {
  11.                      echo 'Wrong!';
  12.               }
  13.        }
  14. ?>
  15. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  16. <html xmlns="http://www.w3.org/1999/xhtml">
  17. <head>
  18. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  19. <title>Captcha</title>
  20. <style type="text/css">
  21.        <!--
  22.                img {
  23.                       border: 1px solid #000;
  24.                       vertical-align: top;
  25.                }
  26.  
  27.                #captcha {
  28.                       height: 18px;
  29.                       width: 48px;
  30.                       border: 1px solid #000;
  31.                       padding: 6px;
  32.                       text-align: center;
  33.                       font-weight: bold;
  34.                       text-transform: uppercase;
  35.                       font-size: 13px;
  36.                }
  37.        -->
  38. </style>
  39. </head>
  40. <body>
  41. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  42.        <img src="image.php" alt="Error" />
  43.        <input type="text" name="captcha" id="captcha" maxlength="5" />
  44.        <input type="submit" value="Submit" name="submit" />
  45. </form>
  46. </body>
  47. </html>
  48.  
  49.  
  50. <!------- CAPTCHA IMAGE ------->
  51. <?php
  52.        session_start();
  53.  
  54.        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  55.        header("Cache-Control: no-store, no-cache, must-revalidate");
  56.        header("Pragma: no-cache");
  57.        header('Content-type: image/png');
  58.  
  59.        $random_string = mt_rand(10000, 99999);
  60.  
  61.        $_SESSION['captcha'] = md5($random_string);
  62.  
  63.        $image = imagecreate(60, 30);
  64.        $image_background = imagecolorallocate($image, 255, 255, 255);
  65.        $image_text = imagecolorallocate($image, 0, 0, 0);
  66.  
  67.        imagestring($image, 5, 8, 7, $random_string, $image_text);
  68.        imagepng($image);
  69.        imagedestroy($image);
code pin board Back To Code Pin Board Post New Code
Please login to post comments.
Page 1 of 1
 
 
Latest News About Coder Profile
Coder Profile Poll
Which sounds better on your coder profiles, and makes more sense to you (think twitter, facebook, etc)?

Followers / Following
Fans / Following
Fans / Fan Of


please login to cast your vote
and see the results of this poll
Latest Coder Profile Changes
Coder Profile was last updated
3.49 Years Ago
Official Blog :: Make A Donation :: Credits :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents :: Wallpapers
Version 1.46.00
Copyright © 2007 - 2012, Scott Thompson, All Rights Reserved