below page is process.php of a script.
This page sends emails at PHP 5.4 but not at PHP7.
ı couldnt find the error , help please.
<?php
include("functions/settings.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
$name=$_POST["name"];
$email=$_POST["email"];
$yourfile=$_FILES['yourfile'];
if($name=="" || $email=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if($_FILES['yourfile']['tmp_name']==""){ }
else if(!is_uploaded_file($_FILES['yourfile']['tmp_name'])){
$error.="<li>The file, ".$_FILES['yourfile']['name'].", was not uploaded!";
$errors=1;
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)){
$error.="<li>Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
if (
preg_match('~^application/msword$~i', $_FILES['yourfile']['type']) or
preg_match('~^application/pdf$~i', $_FILES['yourfile']['type']) or
preg_match('~^text/plain$~i', $_FILES['yourfile']['type']) or
preg_match('~^application/vnd.openxmlformats-officedocument.wordprocessingml.document$~i', $_FILES['yourfile']['type'])
)
{
// Handle the file...
$image_part = $_FILES['yourfile']['name'];
$image_list[2] = $image_part;
copy($_FILES['yourfile']['tmp_name'], "../files/".$image_part);
$where_form_is="http"."://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
$where_form_is = dirname($where_form_is);
$message="
name : ".$name."
email : ".$email."
your file : ".$where_form_is."/files/".$image_list[2]."
";
$message = stripslashes($message);
mail($notify_email,"Form Submitted at your website",$message,"From: Sheryl");
$make=fopen("data.dat","a");
$to_put="";
$to_put .= $name."|".$email."|".$where_form_is."/files/".$image_list[2]."
";
fwrite($make,$to_put);
}
else
{
include 'error.php';
exit();
}
?>
<!-- This is the content of the Thank you page, be careful while changing it -->
<?php include "header.php" ?>
<h3 align="center">Thank you <?php echo $name; ?> !</h3>
<h3 align="center"> Your text file has been successfully uploaded.</h3>
<hr align="center" width="300" size="2" />
<h4 align="center"> <a href="edit.php" title="List of Uploaded files" target="_self">List of Uploaded files</a> | <a href="index.php" title="Upload again?" target="_self">Upload again?</a> | <a href='logout.php'>Logout</a> </h4>
<!-- Do not change anything below this line -->
<?php
}
?>
<?php include "footer.php" ?>