-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcontactrqst.php
84 lines (75 loc) · 2.27 KB
/
contactrqst.php
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
include('pass.php');
if(isset($_POST["fullname"])!=null)
{
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$type=$_POST["type"];
$fullname=$_POST["fullname"];
$email=$_POST["email"];
$mobile=$_POST["mobile"];
$msg=$_POST["message"];
if(strpos($fullname,'<') !== false||strpos($fullname,'/') !== false||strpos($fullname,'>') !== false)
{
header("location: contact.php?msg=Error");
}
else if (strpos($email,'<') !== false||strpos($email,'/') !== false||strpos($email,'>') !== false)
{
header("location: contact.php?msg=Error");
}
else if (strpos($mobile,'<') !== false||strpos($mobile,'/') !== false||strpos($mobile,'>') !== false)
{
header("location: contact.php?msg=Error");
}
else if (strpos($msg,'<') !== false||strpos($msg,'/') !== false||strpos($msg,'>') !== false)
{
header("location: contact.php?msg=Error");
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
$ua=$_SERVER['HTTP_USER_AGENT'];
$sql = "INSERT INTO `logs` (feedback_type,fullname,email,mobile,message,type,ip,ua,time,status) VALUES ('$type','$fullname','$email','$mobile','$msg','contact','$ip','$ua',now(),'pending');";
if ($conn->query($sql) === TRUE) {
header("location: contact.php?msg=done");
}
else {
//echo "Error In Teacher Zone:<br>Error Details:- " . $sql . "<br>" . $conn->error;
header("location: contact.php?msg=Error");
}
}
}
else
{
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$type=$_POST["type"];
include('session.php');
$msg=$_POST["message"];
if (strpos($msg,'<') !== false||strpos($msg,'/') !== false||strpos($msg,'>') !== false)
{
header("location: contact.php?msg=Error");
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
$ua=$_SERVER['HTTP_USER_AGENT'];
$sql = "INSERT INTO `logs` (feedback_type,username,message,type,ip,ua,time,status) VALUES ('$type','$user_check','$msg','contact','$ip','$ua',now(),'pending');";
if ($conn->query($sql) === TRUE) {
header("location: contact.php?msg=done");
}
else {
// echo "Error In Teacher Zone:<br>Error Details:- " . $sql . "<br>" . $conn->error;
header("location: college.php?msg=Error");
}
}
}
?>