hjkhhrtertererrrrrerrtertertertertertertert
bnmbnerterterterterterdfgdfgdfgdfgdfgdfgdfgdfgdfg
/
home4
/
digil8bw
/
collegeexpress.in
/
Upload FileeE
HOME
<?php ob_start(); include("config/config.php"); //Insert query for contact table if (!empty($_POST['email'])) { if (empty($_POST["name"])) { $_SESSION['error_msg'] = "Please Enter Name"; $referer = $_SERVER['HTTP_REFERER']; header("Location: $referer"); exit(); } else { if (!preg_match("/^[a-zA-Z ]*$/", $_POST["name"])) { $_SESSION['error_msg'] = "Only Letters And Whitespace Allowed For Name"; $referer = $_SERVER['HTTP_REFERER']; header("Location: $referer"); exit(); } } if (!filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) { $_SESSION['error_msg'] = "Invalid Email format"; $referer = $_SERVER['HTTP_REFERER']; header("Location: $referer"); exit(); } if (empty($_POST["message"])) { $_SESSION['error_msg'] = "Please Enter Message"; $referer = $_SERVER['HTTP_REFERER']; header("Location: $referer"); exit(); } if (empty($_POST["phone"])) { $_SESSION['error_msg'] = "Please Enter Phone"; $referer = $_SERVER['HTTP_REFERER']; header("Location: $referer"); exit(); } else { if (!is_numeric($_POST["phone"])) { $_SESSION['error_msg'] = "Only Numbers Allowed For Phone"; $referer = $_SERVER['HTTP_REFERER']; header("Location: $referer"); exit(); } if (!preg_match("/^[+]?[1-9][0-9]{9,14}$/", $_POST["phone"])) { $_SESSION['error_msg'] = "Enter Only 10 Digit Number For Phone"; $referer = $_SERVER['HTTP_REFERER']; header("Location: $referer"); exit(); } } if (!empty($_POST['name']) && !empty($_POST['email']) && !empty($_POST['phone'] && !empty($_POST['message']))) { $name = mysqli_real_escape_string($conn, test_input($_REQUEST['name'])); $email = mysqli_real_escape_string($conn, test_input($_REQUEST['email'])); $phone = mysqli_real_escape_string($conn, test_input($_REQUEST['phone'])); $message = mysqli_real_escape_string($conn, test_input($_REQUEST['message'])); $sql = "Insert into contact set name='" . $name . "', email='" . $email . "', phone='" . $phone . "', message='" . $message . "', created=date('Y-m-d H:i:s')"; $query = mysqli_query($conn, $sql); if ($query) { $to = 'contact@collegeexpress.in'; $from = $email; $fromName = $name; $subject = "Contact Us | College Express"; $htmlContent = '<html><body>'; $htmlContent .= '<h3>Dear Team,</h3> <p>Please find below details-</p>'; $htmlContent .= '<table rules="all" style="border-color: #666;" cellpadding="10">'; $htmlContent .= "<tr style='background: #eee;'><td><strong>Name:</strong> </td><td>" . $name . "</td></tr>"; $htmlContent .= "<tr><td><strong>Email:</strong> </td><td>" . $email . "</td></tr>"; $htmlContent .= "<tr><td><strong>Phone:</strong> </td><td>" . $phone . "</td></tr>"; $htmlContent .= "<tr><td><strong>Message:</strong> </td><td>" . $message . "</td></tr>"; $htmlContent .= "</table>"; $htmlContent .= "</body></html>"; // Set content-type header for sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // Additional headers $headers .= 'From: ' . $fromName . '<' . $from . '>' . "\r\n"; // Send email if (mail($to, $subject, $htmlContent, $headers)) { $_SESSION['success_msg'] = " Thank You! Your message has been sent."; $referer = $_SERVER['HTTP_REFERER']; header("Location: $referer"); exit(); } else { $_SESSION['error_msg'] = "Something error"; $referer = $_SERVER['HTTP_REFERER']; header("Location: $referer"); exit(); } /* $_SESSION['success_msg'] = " Thank You! Your message has been sent."; $referer = $_SERVER['HTTP_REFERER']; header("Location: $referer"); exit();*/ } else { $_SESSION['error_msg'] = "Something error"; $referer = $_SERVER['HTTP_REFERER']; header("Location: $referer"); exit(); } } } else { $_SESSION['error_msg'] = "Please Enter Email"; $referer = $_SERVER['HTTP_REFERER']; header("Location: $referer"); exit(); }