Simple CAPTCHA Intergration required.

Discussion in 'PHP' started by ForgottenMemorie, Apr 9, 2010.

  1. #1
    Need to add this Captcha :Securimage CAPTCHA

    Added To, under the "Email" Text area

    PAGE CODE:

    <?php
    
    include "config.php";
    
    $detect=$_SERVER['PHP_SELF'];
    $detect2=$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
    
    $detect3=explode("/",$detect2);
    $count=count($detect3);
    
    $ddd="";
    for ($i=0;$i<$count-1;$i++){
    	if ($i==0){
    	$ddd=$detect3[$i];
    }else{$ddd=$ddd."/".$detect3[$i];}
    }
    $detect3=$ddd."/";
    
    $flag=0; $insert_flag=1;
    if (isset($_POST['url']) and isset($_POST['category']) and isset($_POST['email'])){
    
    $link = mysql_connect("$db_host", "$db_user", "$db_pass"); // host,username,password
    mysql_select_db($db_name);
    	$flag=1;
    	$url=$_POST['url'];
    	$category=$_POST['category'];
    	$email=$_POST['email'];
    
    
    			$query = "SELECT * FROM submission";
        			$result = mysql_query($query) or die("");
    			$count=-1;
        			while ($line = mysql_fetch_row($result)){
         				$count++;
    				$file[$count]=$line[0]; 
       			}
    			
    			$query = "SELECT * FROM approve";
        			$result = mysql_query($query) or die("");
    			
        			while ($line = mysql_fetch_row($result)){
         				$count++;
    				$file[$count]=$line[0]; 
       			}
    
    $url_x=$url;
    if (strstr($url,'http://')){
    	$url_x=str_replace('http://','',$url);
    }
    if (strstr($url,'www.')){
    	$url_x=str_replace('www.','',$url_x);
    }
    
    			
    			for ($i=0;$i<=$count;$i++){
    				//if ($url==$file[$i]){
    				if (strstr($file[$i],$url_x)){
    
    					$insert_flag=0; $flag=0; break;
    				}
    	
    		}
    if ($insert_flag!=0){
    	$time=time();
    	$query = "INSERT INTO `approve` (`url`, `category`, `email`, `time`) VALUES ('$url', '$category', '$email', '$time');";
    
    	$result = mysql_query($query) or die("");
    
    $headers  = "MIME-Version: 1.0
    ";
    $headers .= "Content-type: text/html; charset=windows-1251
    ";
    $headers .= "From: $email
    ";
    
    $checklink=@file($url);
    $checkcount=count($checklink);
    
    $checkflag="No";
    for ($i=0;$i<$checkcount;$i++){
    	if (strstr($checklink[$i],"$detect3")){
    		$checkflag="Yes"; break;
    	}
    }
    
    
    $msg="Proxy URL: <a href=$url>$url</a><br>====================<br>
    Category: $category<br>====================<br>
    E-mail: <a href=mailto:$email>$email</a><br>====================<br>
    Backlink: $checkflag<br>====================<br>
    <br><br>
    
    <a href='http://$detect3"."admin.php'>Go to admin area</a>
    
    ";
    
    mail("$admin_email","New Proxy Site \"$url\" submitted", $msg, $headers);
    
    
    $file=@file("subemail.txt");
    $count=count($file);
    
    $file_subject=@file("subemail_subject.txt");
    $count_subject=count($file_subject);
    
    $msg="";
    for ($i=0;$i<$count;$i++){
    	$msg.=$file[$i];
    }
    
    $headers  = "MIME-Version: 1.0
    ";
    $headers .= "Content-type: text/html; charset=windows-1251
    ";
    $headers .= "From: $admin_email
    ";
    
    mail($email,$file_subject[0],$msg,$headers);
    
    
    
    
    
    }
    }
    ?>
    
    <?php include "template/top.tpl"; ?>
    
    
        <b><font face="Verdana" size="2">Submit your Proxy Site! </b> </font>
         
        </div> 
       <div id="pageNav"> 
       <div id="sectionLinks" style='height: <?php include "config.php"; print ($links_num*24);?>px; overflow: auto; width: 100%'> 
       
    
    <?php
    $recent_num=19; // Number of recent categories
    ?>
        
    <?php include "php/currently_active_proxies.php"; ?>
    
    </div>
    </div>
      <div id="content">
        <div class="feature">
    
    
    
    <?php
    
    if ($insert_flag==0){
    echo <<<D
    <b><br><br><font face=Verdana size=2>Proxy Already Listed
    </b><br><br>
    This proxy is already listed or pending to be listed.</font>
    
    D;
    }
    
    if ($flag==1){
    
    
    
    echo <<<D
    <b><br><br>
    
    <font face=Verdana size=2>Submission Received
    
    </b><br><br>
    
     Thank you for your submission, it has been received.<br> Once approved, your listing should be live within 24 hours.<br><b> A link back is required for a guaranteed listing on our site. </b><br>Please use the following to link to our site:
    <br><br>
    
    <form method=get name=f onSubmit="return false;">
    <input type=text name=l value='<a href="http://$detect3">Web Proxies</a>' size=40 onclick="document.f.l.focus();document.f.l.select();">
    </form>
    
    <br><br>
    
    </font>
    
    D;
    }
    
    ?>
      
    
    
    
    
    <table cellpadding=0 cellspacing=0 width=800><tr><td>
          <br>
         <font face="Verdana" size="2"> Get your proxy listed at Sneek.In, by meeting our requirements:
    <br>
    <br>
       1. <b>A backlink is required. If we dont see it, we wont accept you.</b><br><br>
       <span style="color:#CC0000;font-weight:normal;">&lt;a href=&quot;http://sneek.in/&quot;&gt;Web Proxies&lt;/a&gt;</span></li>
       <br>
       <br>
       2. Web Proxies only. We will <b>NOT</b> accept proxy listing sites!
       <br>
       3. Free domains will <b>NOT</b> be accepted!
       <br>
    
    
    </a>
          <p>
    
    <script language="JavaScript">
    	function check(){
    		if (document.form.url.value=='' || document.form.url.value=='http://' || document.form.email.value==''){
    			alert('Please fill empty fields!'); return false;
    		}
    	}
    </script>
    
    <form method=post action="" name=form onSubmit="return check();">
    
    
    <div id="sectionLinks"> 
      <strong><font face="Verdana" size="2">Website URL</strong></font><br>
      <br>
    <input type=text name=url value='http://' style='width:250px'><br><br>
    
    <strong><font face="Verdana" size="2">Category</strong></font><br>
    <br>
    <select name="category">
    
    <?php
    $cat_list=@file("categories.txt");
    $count_cat=count($cat_list);
    
    for ($i=0;$i<$count_cat;$i++){
    echo <<<D
    	<option value="$cat_list[$i]">$cat_list[$i]</option>
    D;
    }
    ?>
    
    </select><br><br>
    
    <strong><font face="Verdana" size="2">Email</strong></font><br>
    <br>
    <input type=text name=email style='width:250px'><br><br>
    
    <input type=submit value='Submit'> 
    </div> 
    </form>
    </td><td valign=middle width=100>
    
      
      <p>&nbsp;</p></td></tr></table>
         </p>
    
    <?php include "template/bottom.tpl"; ?>
    
    Code (markup):
     
    Last edited: Apr 9, 2010
    ForgottenMemorie, Apr 9, 2010 IP
  2. luden

    luden Active Member

    Messages:
    155
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    Take a look at the captcha documentation, but usually add a condition before including your data form into the database.
     
    luden, Apr 9, 2010 IP