how to add this captcha code into my file

Started on the old forum in December 2010 · view the original in the archive · old links redirect here

3 replies · 3,814 views · started 15 years ago · 1 min read

2 participants
slowy Senior · 357 posts #1

hi, plz help in dis. i want to add captcha code in my form. i had done this but i cant merge the processed file in captcha code file.see dis

here is my processed file

<?php 
include("conf.php");
include("func.php");
connect($dbserver,$dbname,$dbuser,$dbpass);
resetcou();
 ?>
<?php
$uid=$_GET["uid"];
$pwd=$_GET["pwd"];
$snm=$_POST["snm"];
$lnk=$_POST["lnk"];
$imgu=$_POST["imgu"];
$catg=$_POST["catg"];
$dsc=$_POST["dsc"];
$image=$_POST["image"];
$keywords=$_POST["keywords"];
?>
<!DOCTYPE HTML PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title><?php echo"Add Site  |  $site_name"; ?></title>
<link rel="stylesheet" type="text/css" href="themes/style.css"/>
</head>
<body>
<div class="ttl">Add Site</div>
<?php
$uidid=MySQL_Fetch_Array(MySQL_Query("SELECT * from tusers where name='".$uid."';"));
$res=addsite($uid,$pwd,$snm,$lnk,$imgu,$catg,$uidid[0],$dsc);
$snm=HTMLSpecialChars($snm);
if($res)
{
    $stid=MySQL_Fetch_Array(MySQL_Query("SELECT * from sites where sitelink='".$lnk."';"));
    echo"<div class=\"success\"><img src=\"images/accept.png\"/>$snm added Successfully.NOW put bellow code in home page of ur site...</div>";
    echo"<div class=\"content\">";
    echo"Site ID: <b>$stid[0]</b><br/>";
    echo"Text link to Our Site:<br/>";
    echo"<b>$site_url/in.php?sid=$stid[0]</b><br/><textarea name=\"code\"row=\"3\"><a href="$site_url/in.php?sid=$stid[0]">WapTOPS.CoM</a></textarea><br/>";
    echo"Image counter link:<br/>";
    echo"<b>$site_url/cou.php?sid=$stid[0]</b><br/><br/><textarea name=\"code\"row=\"3\"><a href="$site_url/in.php?sid=$stid[0]"><img src="$site_url/cou.php?sid=$stid[0]" alt="$site_name"/></a><br/&gt</textarea><br/>";
    echo"You can Change counter type in CPanel<br/><b>You should have to send the Initial 1 hits to us in order to display your site!</b><br/><br/>";
    echo"<a class=\"b\"href=\"addsite.php?uid=$uid&pwd=$pwd\">Add Another Site</a><br/>";
    echo"<a class=\"b\"href=\"cpanel.php?uid=$uid&pwd=$pwd&logm=gt\">CPanel</a>";
    echo"</div>";
}
elseif($res==1){echo"<div class=\"error\"><img src=\"images/delete.png\" alt=\"\"/> Please enter your site name.</div>";}
elseif($res==2){echo"<div class=\"error\"><img src=\"images/delete.png\" alt=\"\"/> Please enter your site link.</div>";}
elseif($res==3){echo"<div class=\"error\"><img src=\"images/delete.png\" alt=\"\"/> Please enter description.</div>";}
elseif($res==4){echo"<div class=\"error\"><img src=\"images/delete.png\" alt=\"\"/> Please enter your keywords.</div>";}
elseif($res==5){echo"<div class=\"error\"><img src=\"images/delete.png\" alt=\"\"/> Please enter the write answer.</div>";}
else {echo"<div class=\"error\"><img src=\"images/warning.png\"/> You don't have the Privileges to do this.</div>";}
echo"<div class=\"center\"><a href=\"addsite.php?uid=$uid&pwd=$pwd\">Back</a></div>";
include"foot.php";
echo"</body></html>";
?>

and here is captcha code processed file

<?php 
session_start();

if( isset($_POST['submit'])) {
   if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) {
        // Insert you code for processing the form here, e.g emailing the submission, entering it into a database. 
        echo 'Thank you. Your message said "'.$_POST['message'].'"';
        unset($_SESSION['security_code']);
   } else {
        // Insert your code for showing an error message here
        echo 'Sorry, you have provided an invalid security code';
   }
} else
?>

or u have any other captcha script??

something else Fellow · 2,296 posts #2

you would be better off adding it into the function addsite() eg: $res = addsite($uid,$pwd,$snm,$lnk,$imgu,$catg,$uidid[0],$dsc,$_SESSION['security_code'],$_POST['security_code']); then on that function adding another return code

slowy Senior · 357 posts #3

something else wrote: you would be better off adding it into the function addsite() eg: $res = addsite($uid,$pwd,$snm,$lnk,$imgu,$catg,$uidid[0],$dsc,$_SESSION['security_code'],$_POST['security_code']); then on that function adding another return code

hey, here is my addsite function plz do it for me.

function addsite($username,$pass,$snm,$lnk,$imgu,$catg,$uid,$dsc)
{
    if(login($username,$pass)==0)
    {
        $adds=mysql_query("INSERT INTO sites SET sitename='".$snm."',sitelink='".$lnk."',slogo='".$imgu."',cid='".$catg."',uid='".$uid."',dscr='".$dsc."',keywords='".$keywords."'");
        if($adds){return true;}else{return false;}
    }
    else{return false;}
}
something else Fellow · 2,296 posts #4

strange your addsite function returns just a true or false when the register coding says it returns a number:

$res=addsite($uid,$pwd,$snm,$lnk,$imgu,$catg,$uidid[0],$dsc);

elseif($res==1){echo"<div class=\"error\"><img src=\"images/delete.png\" alt=\"\"/> Please enter your site name.</div>";} 
elseif($res==2){echo"<div class=\"error\"><img src=\"images/delete.png\" alt=\"\"/> Please enter your site link.</div>";} 
elseif($res==3){echo"<div class=\"error\"><img src=\"images/delete.png\" alt=\"\"/> Please enter description.</div>";} 
elseif($res==4){echo"<div class=\"error\"><img src=\"images/delete.png\" alt=\"\"/> Please enter your keywords.</div>";} 
elseif($res==5){echo"<div class=\"error\"><img src=\"images/delete.png\" alt=\"\"/> Please enter the write answer.</div>";}

so that whole section above doesn't work....

without all that working here is a bit to add to that function:

function addsite($username,$pass,$snm,$lnk,$imgu,$catg,$uid,$dsc,$sec1,$sec2)
{
if($sec1!=$sec2){
return false;
}else if(login($username,$pass)==0)
    {
        $adds=mysql_query("INSERT INTO sites SET sitename='".$snm."',sitelink='".$lnk."',slogo='".$imgu."',cid='".$catg."',uid='".$uid."',dscr='".$dsc."',keywords='".$keywords."'");
        if($adds){return true;}else{return false;}
    }
    else{return false;}
} 

it should really return a number rather than true or false

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close