PhP Form Stoped Working- and Does Not Show Errors?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
DreamerPHP
Forum Newbie
Posts: 2
Joined: Fri Aug 12, 2011 3:26 pm

PhP Form Stoped Working- and Does Not Show Errors?

Post by DreamerPHP »

Hello,

http://www.collegestudentvoice.com/form/form.php

Form Does Not Show Errors. Does not pass Label Parameters.


1. Programmer says that he did not change anything in the form. It is the latest version.

2. Hosting company says it is an coding issues.

3. It could be incompatibility in Perl script version between the form and the server. Or issues how server delivers emails.

No Spam Filter is Not Set...
Emails are Whited Out
Parameters Values Are Correct

Link to a file 'Send-Action-Form" http://www.collegestudentvoice.com/form ... l-form.php

Code for FormAction.php File

<?php
require_once('recaptchalib.php');
$privatekey = "6LfwwsISAAAAAAPShkJ6nV3qkgLDHCe2uXj9RTWw";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);

if (!$resp->is_valid) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"");
}
else {


include_once('Mail.php');
include_once('Mail/mime.php');

$errors ='';


$max_allowed_file_size = 10000000; // size in KB
$allowed_extensions = array("jpg", "jpeg", "gif", "bmp");
$upload_folder = 'files/';


$name_of_uploaded_file = basename($_FILES['uploaded_file']['name']);

$type_of_uploaded_file = substr($name_of_uploaded_file,
strrpos($name_of_uploaded_file, '.') + 1);

$size_of_uploaded_file = $_FILES["uploaded_file"]["size"]/1024;


if($size_of_uploaded_file > $max_allowed_file_size )
{
$errors .= "\n Size of file should be less than $max_allowed_file_size";
}

$allowed_ext = false;
for($i=0; $i<sizeof($allowed_extensions); $i++)
{
if(strcasecmp($allowed_extensions[$i],$type_of_uploaded_file) == 0)
{
$allowed_ext = true;
}
}

if(!$allowed_ext)
{
$errors .= "\n The uploaded file is not supported file type. ".
" Only the following file types are supported: ".implode(',',$allowed_extensions);
}

if(empty($errors))
{
$path_of_uploaded_file = $upload_folder . $name_of_uploaded_file;
$tmp_path = $_FILES["uploaded_file"]["tmp_name"];

if(is_uploaded_file($tmp_path))
{
if(!copy($tmp_path,$path_of_uploaded_file))
{
$errors .= '\n error while copying the uploaded file';
}
}


$Business = Trim(stripslashes($_POST['Business']));
$ProfessionalSports = Trim(stripslashes($_POST['ProfessionalSports']));
$Humor101 = Trim(stripslashes($_POST['Humor101']));
$CollegeSports = Trim(stripslashes($_POST['CollegeSports']));
$Politics = Trim(stripslashes($_POST['Politics']));





$EmailToBusiness = $Business . "@collegestudentvoice.net";
$EmailToProfessionalSports = $ProfessionalSports . "@collegestudentvoice.net";
$EmailToHumor101 = $Humor101 ."@collegestudentvoice.net";
$EmailToCollegeSports = $CollegeSports . "@collegestudentvoice.net";
$EmailToPolitics = $Politics . "@collegestudentvoice.net";


$EmailTo = "narodetsky@yahoo.com";
$EMailSubject = Trim(stripslashes($_POST['Subject']));



$First = Trim(stripslashes($_POST['First']));
$Last = Trim(stripslashes($_POST['Last']));
$Email = Trim(stripslashes($_POST['Email']));
$Suggestions = Trim(stripslashes($_POST['Suggestions']));



$Body = "The following form has been filled";
$Body .= "\n";
$Body .= "---------------------------------------------------------------------------------";
$Body .= "\n";
$Body .= "\n";
$Body .= "First Name: ";
$Body .= $First;
$Body .= "\n";
$Body .= "Last Name: ";
$Body .= $Last;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Business: ";
$Body .= $Business;
$Body .= "\n";
$Body .= "Professional Sports: ";
$Body .= $ProfessionalSports;
$Body .= "\n";
$Body .= "Humor 101: ";
$Body .= $Humor101;
$Body .= "\n";
$Body .= "College Sports: ";
$Body .= $CollegeSports;
$Body .= "\n";
$Body .= "Politics: ";
$Body .= $Politics;
$Body .= "\n";
$Body .= "Suggestions: ";
$Body .= $Suggestions;
$Body .= "\n";
$Body .= "\n";
$Body .= "---------------------------------------------------------------------------------\n";
$Body .= "Emails sent to: " . strtolower($EmailToBusiness) . " / " .strtolower($EmailToProfessionalSports). " / " .strtolower($EmailToHumor101). " / " .strtolower($EmailToCollegeSports). " / ".strtolower($EmailToPolitics). "";

$to = "kamran@radialcreations.com";
$subject= $EMailSubject;
$from = "do-not-reply@collegestudentvoice.com";
$text = "\n $Body";


$message = new Mail_mime();
$message->setTXTBody($text);
$message->addAttachment($path_of_uploaded_file);
$body = $message->get();
$extraheaders = array("From"=>$from, "Subject"=>$subject,"Reply-To"=>$Email);
$headers = $message->headers($extraheaders);
$mail = Mail::factory("mail");
$mail->send($to, $headers, $body);

if ($Business != "")
{
$mail->send(strtolower($EmailToBusiness), $headers, $body);

}

if ($ProfessionalSports != "")
{
$mail->send(strtolower($EmailToProfessionalSports), $headers, $body);
}

if ($Humor101 != "")
{
$mail->send(strtolower($EmailToHumor101), $headers, $body);
}

if ($CollegeSports != "")
{
$mail->send(strtolower($EmailToCollegeSports), $headers, $body);
}

if ($Politics != "")
{
$mail->send(strtolower($EmailToPolitics), $headers, $body);
}

}



print "<meta http-equiv=\"refresh\" content=\"0;URL=form.php?suc=y\">";
}
?>
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: PhP Form Stoped Working- and Does Not Show Errors?

Post by twinedev »

Can you be a little more clear on things. You say it is not giving you any errors, are you referring to the programmed errors in the script or that the server itself isn't listing any errors.

You mention three different URL's, the first one has a form that posts to the third one, I'm not sure what the middle referenced URL is for.

You mention Perl, yet you are posting PHP code, so not sure if perhaps that is something one of the two included files calls or something, if so, would need to know what that is.

What all debugging have you done already to try to troubelshoot it?
Post Reply