Math CAPTCHA Script !!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Math CAPTCHA Script !!

    PHP Code:
    index.php:
    <form method="POST" action="cc.php"> 
    <img src="captcha.php"> <br>
    <input type="text" size="10" name="check"> <br> 
    <input type="submit" name="submit" value="submit"> 
    </form>

    captcha.php:
    <?php session_start(); 
    $img imagecreatefrompng('black.png'); 
    //value 1
    $numeroa rand(19);
    //value2
    $numerob rand(19);
    $numero $numeroa $numerob;
    $display $numeroa '+' $numerob;
    $_SESSION['check'] = $numero
    //The function imagecolorallocate creates a 
    //color using RGB (red,green,blue) format.
    $white imagecolorallocate($img255255255); 
    imagestring($img1083$display$white);
     
    header ("Content-type: image/png"); imagepng($img); 
    ?>
    cc.php
    <?php  
    session_start
    ();   
    //Sessions in PHP are started by using the   
    //session_start() function.    
    //Like the setcookie( ) function,   
    //the session_start function must come before any HTML,   
    //including blank lines, on the page.session_start();   
    //Check if the security code and   
    //the session value are not blank   
    //and if the input text matches the stored text  
    if(isset($_SESSION['check']) && (md5($_POST['check']) == md5($_SESSION['check']))) {   
    echo 
    'Input OK';  
    }else{   
    echo 
    'Input Wrong';          
    }
    Attached Files
    Last edited by tkreturns; 17.01.11, 15:30. Reason: changed the cc.php code

    #2
    Where is is case break? If wrote wrong code then how can we will se code error?
    LoveForum.BiZ

    Comment


      #3
      this cpatha code is useless if spammer did not use the your site forum to submit data.

      Update: cc.php:
      PHP Code:
      <?php 
      session_start
      ();  
      //Sessions in PHP are started by using the  
      //session_start() function.   
      //Like the setcookie( ) function,  
      //the session_start function must come before any HTML,  
      //including blank lines, on the page.session_start();  
      //Check if the security code and  
      //the session value are not blank  
      //and if the input text matches the stored text 
      if(isset($_SESSION['check']) && (md5($_POST['check']) == md5($_SESSION['check']))) {  
      echo 
      'Input OK'
      }else{  
      echo 
      'Input Wrong';         
      }
      Last edited by firemax; 17.01.11, 12:32. Reason: added md5

      Free Mobile Web Scripts by me: Free Youtube Downloader, Tweets Reader, Facebook Wall Posts Reader
      PHP Tutorials: How to Secure Your PHP Script (PHP SECURITY)
      Want to Develop/Edit your WAP/Web Site? Add me to Gtalk (gmail) 'lakshan1989' or PM me.

      Comment


        #4
        thnx bro

        Comment


          #5
          Let me check out
          have connected with http://adexchat.com ?
          Fun up with
          http://forum.adexchat.com

          Comment


            #6
            Spammers use triggers to define an url... examples :
            Code:
            (index\.php\?PHPSESSID=[a-z0-9]{1,250}&amp;action=verificationcode;rand=[a-z0-9]{1,250}) 
            (index\.php\?PHPSESSID=[a-z0-9]{1,250}&amp;action=verificationcode;vid=register;rand=[a-z0-9]{1,250})
            a database handling urls sends captcher images to a captcher solving server,
            but the top soft cracks even recapctha, so spammers dont need a solving server.
            To avoid? it depends on script how you block.
            If you want to avoid spam try htaccess.

            Code:
            RewriteEngine On
            RewriteCond %{REQUEST_METHOD} POST
            RewriteCond %{REQUEST_URI} .register.php*
            RewriteCond %{HTTP_REFERER} !.coding-talk.com [OR]
            RewriteCond %{HTTP_USER_AGENT} ^$
            RewriteRule (.*) http://google.com/ [R=301,L]
            spammers use a direct url.A real user would come from coding-talk.com and
            not directly without a referer.
            Last edited by haraldl; 17.01.11, 22:30.

            Comment


              #7
              can some0ne put that captcha to this script
              Attached Files
              ยป PornZeriEs.com - | New! Hottest Porn Movies

              Comment


                #8
                Using that htaccess, you will only hurt your users.
                Some users don't send referers due to proxies or browser setup.
                A spammer can easily send a referer. Eg curl setopt referer can be simply used. You need to research before using certain techniques.
                Perfection comes at a cost



                I accept liberty!

                Comment


                  #9
                  can u make for lava???
                  LoveForum.BiZ

                  Comment

                  Working...
                  X