1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<?php header('Content-Type: text/html; charset=UTF-8'); ?> <?php session_start(); $ara = explode("|", $_SESSION['vCode']);
if ($ara[0] && $ara[0] == $_POST['verification']) {
// clear used vcode $_SESSION['vCode'] = "";
$mailto = htmlspecialchars($_POST["mailto"],ENT_QUOTES); $name = htmlspecialchars($_POST["name"],ENT_QUOTES); $company = htmlspecialchars($_POST["company"],ENT_QUOTES); $email = htmlspecialchars($_POST["email"],ENT_QUOTES); $phone = htmlspecialchars($_POST["phone"],ENT_QUOTES); $nowdate = date("Y-m-d H:i:s"); //print_r($_POST); if(!filter_var($email, FILTER_VALIDATE_EMAIL)){ echo '<script>alert("Invalid email format."); history.back();</script>'; exit; }
require("../inc/class.phpmailer.php"); $subject = "One Solution Enquiry E-mail";
$body = 'Name: '.$name.'<br /><br /> Company Name : '.$company.'<br /><br /> E-Mail : '.$email.'<br /><br /> Tel : '.$phone.'<br /><br /> Message : <br />'.nl2br($_POST["message"]).'<br /><br />';
$x_mail = new PHPMailer(); $x_mail->IsSMTP(); $x_mail->Host = "localhost"; //$x_mail->SMTPAuth = true; $x_mail->CharSet = "UTF-8"; $x_mail->From = $email; $x_mail->FromName = $name; $x_mail->AddAddress($mailto); $x_mail->WordWrap = 50; $x_mail->IsHTML(true); $x_mail->Subject = $subject; $x_mail->Body = $body; $x_mail->Send();
mysql_close($dbh);
header("Location: index.html");
} else { echo"<script language='javascript'> alert('Verify Code Error'); history.back(); </script>"; } ?>
|