Jump to content

[SOLVED] when adding captcha I get error?


sandbudd

Recommended Posts

form worked great uploaded images populated database and then I add the captcha and now I get this error?

 

Fatal error: Call to undefined function move_upload() in /home/anodizi/public_html/image/captcha.php on line 39

 

here is the code and thanks in advance.


<?

session_start();



// *** The text input will come in through the variable $_POST["captcha_input"],
//	while the correct answer is stored in the cookie $_COOKIE["pass"] ***
if ($_POST["captcha_input"] == $_SESSION["pass"])
{
// *** They passed the test! ***
// *** This is where you would post a comment to your database, etc ***


$db_host = ''; 
$db_user = ''; 
$db_pwd = '';

$database = '';
$table = '';






if (!mysql_connect($db_host, $db_user, $db_pwd))
    die("Can't connect to database");

if (!mysql_select_db($database))
    die("Can't select database");

$dest = 'upload/';

if(isset($_FILES) && !empty($_FILES) && is_array($_FILES))
{
    foreach($_FILES as $file)
    {
        $upload_msg[$file['name']] = move_upload($file, $dest);
    }
}
function move_upload( $file, $dest, $overwrite = false )
    {
        $upload_feedback = '';
        if ($file["error"] == UPLOAD_ERR_OK)
       
        {
            if(!file_exists( $dest.$file["name"] ) || $overwrite)
            {
                if(move_uploaded_file( $file["tmp_name"], $dest.$file["name"] ))
                {
                    $upload_feedback .= "The file " . $file["name"] . " was successfully uploaded";
                    $error            = FALSE;
                }
                else
                {
                    $upload_feedback .= "The file " . $file["name"] . " could not be moved";
                    $error            = TRUE;
                }
            }
            else
            {
                $upload_feedback .= "The file " . $file["name"] . " already exists, please check the overwrite option if you wish to replace it";
                $error            = TRUE;
            }
        }
        else
        {
            switch ($file["error"])
            {
                case UPLOAD_ERR_INI_SIZE:
                case UPLOAD_ERR_FORM_SIZE:
                    $upload_feedback .= "The file " . $file["name"] . " is to large to be uploaded<br />";
                    $error            = TRUE;
                break;

                case UPLOAD_ERR_PARTIAL:
                    $upload_feedback .= "The file" . $file["name"] . " was interrupted while uploading, please try again<br />";
                    $error            = TRUE;
                break;
            }
        }

        return array( "error" => $error, "feedback" => $upload_feedback ); //return message plus error status
    }

?>
<?php
$f_1 = $_FILES['file1']['name'] ;
$f_2 = $_FILES['file2']['name'] ;
$f_3 = $_FILES['file3']['name'] ;
$f_4 = $_FILES['file4']['name'] ;
$f_5 = $_FILES['file5']['name'] ;
$f_6 = $_FILES['file6']['name'] ;
$f_7 = $_FILES['file7']['name'] ;
$f_8 = $_FILES['file8']['name'] ;
$f_9 = $_FILES['file9']['name'] ;
$f_10 = $_FILES['file10']['name'] ;
$f_11 = $_FILES['file11']['name'] ;
$f_12 = $_FILES['file12']['name'] ;
$f_13 = $_FILES['file13']['name'] ;
$f_14 = $_FILES['file14']['name'] ;
$f_15 = $_FILES['file15']['name'] ;
$f_16 = $_FILES['file16']['name'] ;
$f_17 = $_FILES['file17']['name'] ;
$f_18 = $_FILES['file18']['name'] ;
$f_19 = $_FILES['file19']['name'] ;
$f_20 = $_FILES['file20']['name'] ;
$customer = $_POST['customer'];
$company = $_POST['company'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip_code = $_POST['zip_code'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$fax = $_POST['fax'];
$type2 = $_POST['type2'];
$type3 = $_POST['type3'];
$burnish = $_POST['burnish'];
$chromate = $_POST['chromate'];
$hex = $_POST['hex'];
$impregnation = $_POST['impregnation'];
$strip = $_POST['strip'];
$part = $_POST['part'];
$description = $_POST['description'];
$alloy = $_POST['alloy'];
$quantity = $_POST['quantity'];
$spec = $_POST['spec'];
$color = $_POST['color'];
$repeat_customer = $_POST['repeat_customer'];
$isearch = $_POST['isearch'];
$internet_directory = $_POST['internet_directory'];
$referral = $_POST['referral'];
$yellow_pages = $_POST['yellow_pages'];
$trade = $_POST['trade'];
$other = $_POST['other'];
$notes = $_POST['notes'];
mysql_query("INSERT INTO ae_gallery (image1,image2,image3,image4,image5,image6,image7,image8,image9,image10,image11,image12,image13,image14,image15,image16,image17,image18,image19,image20,customer,company,address,city,state,zip_code,email,phone,fax,type2,type3,burnish,chromate,hex,impregnation,strip,part,description,alloy,quantity,spec,color,repeat_customer,isearch,internet_directory,referral,yellow_pages,trade,other,notes) VALUES('$f_1','$f_2','$f_3','$f_4','$f_5','$f_6','$f_7','$f_8','$f_9','$f_10','$f_11','$f_12','$f_13','$f_14','$f_15','$f_16','$f_17','$f_18','$f_19','$f_20','$customer','$company','$address','$city','$state','$zip_code','$email','$phone','$fax','$type2','$type3','$burnish','$chromate','$hex','$impregnation','$strip','$part','$description','$alloy','$quantity','$spec','$color','$repeat_customer','$isearch','$internet_directory','$referral','$yellow_pages','$trade','$other','$notes')") or die(mysql_error());
?>
<?php
       
//sends email via php to the following address
$mailuser = "[email protected]";

//echo 'default chosen address: '.$mailuser;

$header = "Return-Path: ".$mailuser."\r\n"; 
$header .= "From: form with captcha <".$mailuser.">\r\n"; 
$header .= "Content-Type: text/html;"; 
	  
$mail_body = '
The User: '.$_POST[company].' has sent his input.
Your Name: '. $_POST[name] . '<br>
Your Surname: '. $_POST[surname] . '<br>
Your Address: '. $_POST[address] . '<br>
Your Zip: '. $_POST[zip] . '<br>
Your City: '. $_POST[city] . '<br>
Your email: '. $_POST[email] . '<br>
Your Telephone: '. $_POST[telephone] . '<br>
Your Mobile: '. $_POST[mobile] . '<br>
Your Comments: '. $_POST[comments] . '<br>'
;	
mail ($mailuser, 'Form sent', $mail_body, $header);
         echo 'THANKS ';    
       

} else {
// *** The input text did not match the stored text, so they failed ***
// *** You would probably not want to include the correct answer, but
//	unless someone is trying on purpose to circumvent you specifically,
//	its not a big deal.  If someone is trying to circumvent you, then
//	you should probably use a more secure way besides storing the
//	info in a cookie that always has the same name!  ***
echo "Sorry, you did not pass the CAPTCHA test.<br><br>";
echo "You said " . $_POST["captcha_input"];
echo " while the correct answer was " . $_SESSION["pass"];

        echo "    - Please click back in your browser and try again <br><br>";

}
?>

Link to comment
https://forums.phpfreaks.com/topic/113822-solved-when-adding-captcha-i-get-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.