-
Notifications
You must be signed in to change notification settings - Fork 5
/
db.php
160 lines (139 loc) · 6.85 KB
/
db.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
<html>
<head>
<title>guesthouse</title>
<link href="https://fonts.googleapis.com/css?family=Dosis|Open+Sans+Condensed:300" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Oswald" rel="stylesheet">
<style>
body{
overflow-x:hidden;
}
.success{
text-align:center;
padding-top:90px;
padding-bottom:85px;
background:#DDDAD8;
}
span{
font-family:'Oswald',sans-serif;
}
.text{
font-family:'Raleway',sans-serif;
padding-bottom:10px;
}
a:link{
text-decoration:none;
}
</style>
</head>
<body>
<?php
if(isset($_POST['name'])){$name=$_POST['name'];}
if(isset($_POST['email'])){$email=$_POST['email'];}
if(isset($_POST['phone'])){$phone=$_POST['phone'];}
if(isset($_POST['reference'])){$reference=$_POST['reference'];}
if(isset($_POST['namestudent'])){$namestudent=$_POST['namestudent'];}
if(isset($_POST['reg'])){$reg=$_POST['reg'];}
if(isset($_POST['year'])){$year=$_POST['year'];}
if(isset($_POST['relation'])){$relation=$_POST['relation'];}
if(isset($_POST['purpose'])){$purpose=$_POST['purpose'];}
if(isset($_POST['affiliated'])){$affiliated=$_POST['affiliated'];}
if(!empty($name) && !empty($email)&& !empty($phone)&& !empty($reference)){
$group='Faculty';
$dbc=mysqli_connect('localhost','root','','guesthouse');
$query=$pdo->prepare("INSERT INTO faculty VALUES('$name','$email','$phone','$reference')");
$result=mysqli_query($dbc,$query);
echo '<div class="success">';
echo '<div class="row"><div class="col-md-12" style="text-align:center;">';
echo '<p><img src="images/tick.png" class="img-fluid" style="height:120px;width:100px;"></p>';
echo '<p><h1 class="text" style="font-size:300%;">Thanks for reaching out!</h1>';
echo '<span>Your message just showed up in our inbox.Please wait for your confirmation</span></p>';
echo '</div></div></div>';
echo '<div class="footer" style="background:#023668;padding:20px;">';
echo '<div class="row">
<div class="col-md-12" style="text-align:center;">
<img src="images/logo.gif" class="img-fluid" style="height:100px;width:100px;"> <br/>
<h2 class="text" style="color:white;">Indian Institute of Information Technology</h2>
<a href="index.php" style="background:orange;color:white;border-radius:10px;padding:10px;">Main Page</a>
</div>
</div>';
echo '</div>';
mysqli_close($dbc);
$to='[email protected]';
$subject='Guest house Booking';
$msg='I am ' .$name.' and I want to book a room.I work as guest faculty for the college.
Hope!!This' .$reference.'reference number could be useful.I will be available on'.$phone."\n". 'Thanking you!!' ;
mail($to,$subject,$msg,'From:'.$email);
}
else if(!empty($name)&&!empty($email)&&!empty($phone)&&!empty($namestudent)&&!empty($reg)&&!empty($year)&&!empty($relation)){
$group='Student Related';
$dbc=mysqli_connect('localhost','root','','guesthouse');
$query=$pdo->prepare("INSERT INTO studentrelated VALUES('$name','$email','$phone','$namestudent','$reg','$year','$relation')");
$result=mysqli_query($dbc,$query);
echo '<div class="success">';
echo '<div class="row"><div class="col-md-12" style="text-align:center;">';
echo '<p><img src="images/tick.png" class="img-fluid" style="height:120px;width:100px;"></p>';
echo '<p><h1 class="text" style="font-size:300%;">Thanks for reaching out!</h1>';
echo '<span>Your message just showed up in our inbox.Please wait for your confirmation</span></p>';
echo '</div></div></div>';
echo '<div class="footer" style="background:#023668;padding:20px;">';
echo '<div class="row">
<div class="col-md-12" style="text-align:center;">
<img src="images/logo.gif" class="img-fluid" style="height:100px;width:100px;"> <br/>
<h2 class="text" style="color:white;">Indian Institute of Information Technology</h2>
<a href="index.php" style="background:orange;color:white;border-radius:10px;padding:10px;">Main Page</a>
</div>
</div>';
echo '</div>';
mysqli_close($dbc);
$to='[email protected]';
$subject='Guest house Booking';
$msg='I am ' .$name. ' and I want to book a room.I am' .$relation. 'of' .$namestudent. 'studying' .$year. 'year
Hope!!This' .$reg. 'Registration number could be useful.I will be available on' .$phone."\n".'Thanking you!!' ;
mail($to,$subject,$msg,'From:'.$email);
}
else if(!empty($name)&&!empty($email)&&!empty($phone)&&!empty($purpose)&&!empty($affiliated)){
$group='Other';
$dbc=mysqli_connect('localhost','root','','guesthouse');
$query=$pdo->prepare("INSERT INTO other VALUES('$name','$email','$phone','$purpose','$affiliated')");
$result=mysqli_query($dbc,$query);
echo '<div class="success">';
echo '<div class="row"><div class="col-md-12" style="text-align:center;">';
echo '<p><img src="images/tick.png" class="img-fluid" style="height:120px;width:100px;"></p>';
echo '<p><h1 class="text" style="font-size:300%;">Thanks for reaching out!</h1>';
echo '<span>Your message just showed up in our inbox.Please wait for your confirmation</span></p>';
echo '</div></div></div>';
echo '<div class="footer" style="background:#023668;padding:20px;">';
echo '<div class="row">
<div class="col-md-12" style="text-align:center;">
<img src="images/logo.gif" class="img-fluid" style="height:100px;width:100px;"> <br/>
<h2 class="text" style="color:white;">Indian Institute of Information Technology</h2>
<a href="index.php" style="background:orange;color:white;border-radius:10px;padding:10px;">Main Page</a>
</div>
</div>';
echo '</div>';
mysqli_close($dbc);
$to='[email protected]';
$subject='Guest house Booking';
$msg='I am ' .$name. ' and I want to book a room and my purpose to visit is'.$purpose.'I am from'.$affiliated.
'I will be available on'.$phone."\n".'Thanking you!!' ;
mail($to,$subject,$msg,'From:'.$email);
}
else{
echo 'Please enter all information!!!';
}
$dbc=mysqli_connect('localhost','root','','guesthouse');
$query=pdo->prepare("INSERT INTO admindata VALUES('$name','$email','$phone','$group',NOW(),0,0)");
$result=mysqli_query($dbc,$query);
mysqli_close($dbc);
?>
</body>
</html>