-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path18.request.php
163 lines (147 loc) · 3.54 KB
/
18.request.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
$server_name = "localhost";
$user_name = "root";
$password = "";
$db = "project";
$conn = mysqli_connect($server_name, $user_name, $password, $db);
if(!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
session_start();
$comment_err = $email_err = "";
if($_SERVER["REQUEST_METHOD"] == "POST")
{
$email=$_POST["email"];
$comment=$_POST["comment"];
if(empty($email))
{
$email_err="Required";
}
else if(!filter_var($email,FILTER_VALIDATE_EMAIL) or !str_contains($email, "[email protected]"))
{
$email_err="Invalid email address";
}
if(empty($comment))
{
$comment_err="Required";
}
if(strlen($email_err)==0 and strlen($comment_err)==0)
{
$query="SELECT * FROM fac_details WHERE Email = '$email' " ;
$sql=mysqli_query($conn,$query);
$row= mysqli_num_rows($sql);
if(($row) >0 )
{
$msg="Dear sir/madam,\n \t\t\t This is a request from student bearing Roll No:";
$roll_no=$_SESSION['disprollno'];
$msg=$msg . strval($roll_no);
$msg=$msg.". ".$comment;
$msg=$msg."\n\n\n\n\nRegards\n".strval($roll_no);
mail($email,"Request From Student",$msg);
echo ("<script LANGUAGE='JavaScript'>
window.alert('Request sent successfully to concerned Faculty');
</script>"
);
}
else
{
$email_err="Invalid email ID";
}
}
}
?>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width: device-width, initial scale=2.0">
<title>Request Form</title>
<style>
body
{
background-image: url(images/request.jpeg);
background-size: cover;
}
.done
{
margin-top:10%;
margin-left:39%;
}
.done h2
{
font-size: 50px;
margin-left:15px;
}
.done label
{
color:black;
}
.email
{
width: 250px;
height: 34px;
border:none;
border-radius: 5px;
margin-left:50px;
background-color:#9DAAF2;
}
.done textarea
{
border-radius: 5px;
background-color:#9DAAF2;
margin-left:0px;
border:none;
margin-left:-10px;
}
.btn1
{
padding-top:10px;
padding-bottom:10px;
padding-left:12px;
padding-right:12px;
width: 90px;
border-radius: 5px;
margin-left: 130px;
color:white;
font-size:15px;
border:none;
border:1px solid white;
border-radius:10px;
background-color:#263f97;
cursor:pointer;
font-weight: bold;
opacity:0.8;
}
.btn1:hover
{
background-color:white;
color:#263f97;
transition-duration: 0.6s;
}
.email::-webkit-input-placeholder
{
font-size:15px;
color:black;
}
textarea::placeholder
{
font-size:15px;
color:black;
}
</style>
</head>
<body>
<div class="done">
<h2 > Request Form </h2>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"])?>" method="POST" id="req_form">
<input type="text" name="email" class="email" placeholder=" Enter Email "> <span style="color: red">* <?php echo $email_err ?></span>
<br><br><br>
<textarea name="comment" form="req_form" rows="11" cols="50" placeholder="Enter Your Request Here....."></textarea>
<span style="color: red; vertical-align: top;">* <?php echo $comment_err ?></span>
<br><br>
<br>
<input class="btn1" type="submit" name="submit" value="Submit">
</form>
</div>
</body>
</html>