forked from Siddhi-Mahawar/Event_Scheduler
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathform.php
235 lines (211 loc) · 7.93 KB
/
form.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<?php
include('config.php');
session_start();
extract($_SESSION);
extract($_GET);
$errors=array();
$eventvenue=$_REQUEST['ev'];
$_SESSION['venue1']=$eventvenue;
$eventstart=$start;
$eventend=$end;
$eventname="";
$eventdesc="";
$eventv1=$venue1;
echo '<br />';
if(isset($_POST['addevent'])){
$eventname = ($_POST['eventname']);
$eventdesc = ($_POST['eventdesc']);
$sql2="SELECT id from venue where name='$eventv1'";
$result1=mysqli_query($con,$sql2);
$row1=mysqli_fetch_array($result1);
$venueid=$row1['id'];
$sql3="SELECT id from user where email='$user'";
$result2=mysqli_query($con,$sql3);
$row2=mysqli_fetch_array($result2);
$id=$row2['id'];
$_SESSION['userid']=$id;
echo $eventname.$eventstart.$eventend.$eventdesc.$eventv1;
echo '<br />';
$sql="INSERT INTO event(eventname,eventdesc,eventstart,eventend,eventvenue,venueid,eventcreator) VALUES('$eventname','$eventdesc','$eventstart','$eventend','$eventv1','$venueid','$id')";
mysqli_query($con,$sql);
echo $eventname.$eventstart.$eventend.$eventdesc.$eventv1;
$q1="SELECT * FROM event where eventname='$eventname' and eventdesc='$eventdesc' and eventstart='$eventstart' and eventend='$eventend' and eventvenue='$eventv1'";
$result=mysqli_query($con,$q1);
$row=mysqli_fetch_array($result);
$eventid=$row['eventid'];
echo $eventid;
$_SESSION['eveid']=$eventid;
//For uploading cover image
$name= $_FILES["image"]["name"];
$dot='.';
$tmp_name= $_FILES["image"]["tmp_name"];
$position= strpos($name, ".");
$fileextension= substr($name, $position);
$path= 'Uploads/cover/';
if (!empty($name)){
if (move_uploaded_file($tmp_name,$path.$eveid.$fileextension)) {
echo 'Uploaded!';
}
}
// $file = addslashes(file_get_contents($_FILES["image"]["tmp_name"]));
$query = "UPDATE event SET eventcover='$path$eveid$fileextension' where eventid=$eventid";
if(mysqli_query($con,$query))
{
echo '<script>alert("Image Inserted into database")</script>';
}
$name= $_FILES["profile"]["name"];
$dot='.';
$tmp_name= $_FILES["profile"]["tmp_name"];
$position= strpos($name, ".");
$fileextension= substr($name, $position);
$path= 'Uploads/profile/';
if (!empty($name)){
if (move_uploaded_file($tmp_name, $path.$eveid.$fileextension)) {
// echo 'Uploaded!';
}
}
// $file = addslashes(file_get_contents($_FILES["profile"]["tmp_name"]));
$query = "UPDATE event SET eventimage='$path$eveid$fileextension' where eventid=$eventid";
if(mysqli_query($con,$query))
{
// echo '<script>alert("Image Inserted into database")</script>';
}
header('location:event_page.php');
}
?>
<html>
<head>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- beauty font ROBOTO -->
<link href='http://fonts.googleapis.com/css?family=Roboto:100' rel='stylesheet' type='text/css'>
<style>
@import url('https://fonts.googleapis.com/css?family=Satisfy');
@import url('https://fonts.googleapis.com/css?family=Margarine');
@import url('https://fonts.googleapis.com/css?family=Courgette');
/* Font ROBOTO */
.roboto{
font-family: 'Roboto', sans-serif !important;
}
/* custom background header panel */
.custom-header-panel{
background-color: #004b8e !important;
border-color: #004b8e !important;
color: white;
}
.no-margin-form-group {
margin: 0 !important;
}
.requerido {
color: red;
}
.btn-orange-md {
background:#73CC77 !important;
border-bottom: 3px solid #3B923F !important;
color: white;
}
.btn-orange-md:hover {
background: #3B923F !important;
color: white !important;
}
@media only screen and (max-width: 600px) {
#space
{
padding-top:25%;
padding-bottom:15%;
}
}
/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {
#space
{
padding-top:25%;
padding-bottom:15%;
}
}
@media only screen and (min-width: 768px) {
#space
{
padding-top:20%;
padding-bottom:10%;
}
}
/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {
#space
{
padding-top:15%;
padding-bottom:10%;
}
}
/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {
#space
{
padding-top:15%;
padding-bottom:10%;
}
}
</style>
</head>
<body>
<?php
include 'header.php';
include 'nav.php' ?>
<div id="space">
<div class="container">
<div class="row">
<div class="col-md-12">
<form id="eventdata" class="form-horizontal" method="POST" role="form" action="" enctype="multipart/form-data">
<div class="row">
<div class="col-md-offset-2 col-md-8">
<div class="panel">
<div class="panel-heading custom-header-panel">
<h3 class="panel-title roboto">Event info</h3>
</div>
<div class="panel-body">
<div class="form-group">
<label class="col-sm-4 control-label" for="name">Event Name <span class="requerido"> *</span></label>
<div class="col-sm-8">
<input type="text" class="form-control" name="eventname" id="name" value="" required maxlength="70">
</div>
</div>
<div class="form-group">
<label for="event desc" class="col-sm-4 control-label">Event description<span class="requerido"> *</span></label>
<div class="col-sm-8">
<input type="text" class="form-control" name="eventdesc" id="desc" value="" required maxlength="700">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="imgpro">Add event image<span class="requerido"> *</span></label>
<div class="col-sm-8">
<input type="file" name="profile" id="profile">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="imgpro">Add event cover image</label>
<div class="col-sm-8">
<input type="file" name="image" id="image">
</div>
</div>
<div class="form-group">
<div class="col-sm-8">
<input type="submit" class="form-control btn-orange-md" name="addevent" id="addevent" value="SUBMIT">
</div>
</div>
</div>
</div>
</div>
</div>
</form> <!-- Fint form -->
</div>
</div>
<!-- Tab panes -->
</div></div>
</body></html>
<?php
include('footer.php');
?>