I am a bit confused about adding captcha into form mail.. I am trying to not break anything in the main script. That's why i have a couple of question. I have this mailform pro main script, which is right below...
sub _MAIN {
&_ModuleLoadConfigs;
if($ENV{'REQUEST_METHOD'} eq "POST" && $_GET{'module'} eq $null){
$_ENV{'mode'} = 1;
&mailformpro;
}
elsif($_GET{'module'} ne $null){
$_ENV{'mode'} = 0;
&_ModuleMode;
}
else {
&mfpjs;
}
}
sub mailformpro {
&_RunModule('extend');
&_COOKIE;
&_POST;
#@AttachedFiles = ();
#@ResAttachedFiles = ();
($Serial,$InputTime,$ConfirmTime,$_ENV{'mfp_uniqueuser'}) = split(/\,/,&_LOAD($config{'file.data'}));
&_RunModule('check');
&_ErrorCheck;
if(!$Error){
&_RunModule('initialize');
if(!$config{'disabled'}){
&_MAINPROCESS;
}
&_RESULT;
}
else {
&_RunModule('error');
if($_POST{'mfp_jssemantics'}){
&_REDIRECT("$ENV{'HTTP_REFERER'}#WarningCode${Error}");
}
else {
&_Error($Error);
}
}
}
sub _MAINPROCESS {
&_SETENV;
&_RunModule('startup');
&_MAILTEXT;
&_RunModule('run');
if($_POST{'mfp_testmode'}){
@mailto = @testmailto;
if($config{'bcc'}){
$config{'bcc'} = $mailto[0];
}
}
if($config{'mailto'} eq $null){
$config{'mailto'} = $mailto[0];
$config{'mailtoName'} = $mailto[0];
}
elsif($config{"ReturnSubject"} ne $null && $_TEXT{'responder'} ne $null){
&_SENDMAIL($config{'mailto'},$config{'mailfrom'},$config{'fromname'},$config{"ReturnSubject"},$_TEXT{'responder'},join('',@ResAttachedFiles),$_HTML{'HTMLMail'});
}
if($config{'fixed'}){
$replyTo = $config{'mailto'};
$config{'mailto'} = $config{'mailfrom'};
$config{'mailtoName'} = $config{'mailfrom'};
}
if(!$config{'mailtoName'}){
$config{'mailtoName'} = $config{'mailto'};
}
for(my $cnt=0;$cnt<@mailto;$cnt++){
&_SENDMAIL($mailto[$cnt],$config{'mailto'},$config{'mailtoName'},$config{'subject'},$_TEXT{'posted'},join('',@AttachedFiles),$_HTML{'HTMLMailAdmin'});
}
&_RunModule('finish');
}
sub _RESULT {
if($_RESULT{'error'}){
&_Error(500);
}
elsif($_RESULT{'html'}){
print "Content-type: text/html;charset=UTF-8
";
&_SET_COOKIE;
print $_RESULT{'html'};
}
elsif($_RESULT{'uri'}){
&_REDIRECT($_RESULT{'uri'});
}
else {
&_REDIRECT($config{'ThanksPage'});
}
}
sub _ErrorCheck {
## Error Chec
if(!$_POST{'mfp_jssemantics'} && $config{'DisabledJs'}){
## Error Code 1 / Disabled Javascript
$Error = 1;
}
elsif($config{"EnglishSpamBlock"}){
## Error Code 2 / All English
$Error = 2;
}
And this is my captcha.php But the problem here, how to connect main script and captcha php. I mean where should add these lines in main script
$captcha = isset($_POST['captcha']) ? $_POST['captcha'] : '';
$img_session = isset($_SESSION['img_session']) ? $_SESSION['img_session'] : '';
Then I can use captcha in the contact form. Really, need help about this issue...