-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathevent_form2.php
133 lines (123 loc) · 4.29 KB
/
event_form2.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
<?php
ob_start();
?>
<?php require_once("includes/base.php") ?>
<?php require_once("includes/functions.php") ?>
<?php require_once("includes/connection.php") ?>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Tangerine">
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Montserrat">
<link href="css/bootstrap.min.css" rel="stylesheet">
<?php
$username = $_SESSION['currentuser'];
?>
<?php
if(isset($_GET['id']))
{
$id = $_GET['id'];
}
if (isset($_POST['submit']))
{
//echo $id;
$uploadDir = 'img/';
//chmod("img/",0600);
$image_name = $_FILES['image']['name'];
$image_type = $_FILES['image']['type'];
$image_size = $_FILES['image']['size'];
$image_tmp_name = $_FILES['image']['tmp_name'];
$ext = pathinfo($image_name, PATHINFO_EXTENSION);
//echo $ext;
//echo type($ext);
echo $image_name;
echo $image_tmp_name;
if($ext == "jpg")
{
$filePath = $uploadDir . $id . '.jpg';
}
if($ext == "JPG")
{
$filePath = $uploadDir . $id . '.JPG';
}
if($ext == "png")
{
$filePath = $uploadDir . $id . '.png';
}
if($ext == "PNG")
{
$filePath = $uploadDir . $id . '.PNG';
}
if($ext == "jpeg")
{
$filePath = $uploadDir . $id . '.jpeg';
}
if($ext == "JPEG")
{
$filePath = $uploadDir . $id . '.JPEG';
}
echo $filePath;
$result = move_uploaded_file($image_tmp_name, $filePath);
if (!$result)
{
echo "Error uploading file";
exit;
}
$query = mysql_query("UPDATE Event SET Ev_photo = '$filePath' WHERE Ev_id = '$id'");
if(!$query)
{
echo mysql_error();
}
redirect_to("event_form3.php?user=$username&id=$id");
}
if (isset($_POST['submit1']))
{
redirect_to("event_form3.php?user=$username&id=$id");
}
?>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header text-center"><font face="Montserrat">Event Form</font></h1>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading text-center">
<h1><font face="Tangerine">Upload Cover Picture for your event</font></h1>
</div>
<div class="panel-body">
<div class="row col-md-offset-1">
<div class="col-lg-12">
<form enctype="multipart/form-data" role="form" method="post" action="event_form2.php?user=<?php echo $username;?>&id=<?php echo $id; ?>">
<div class="form-group">
<label><h3><font face="Montserrat">Cover Photo(.jpg,.jpeg,.png only)</font></h3></label>
<input type="file" name="image">
<br>
<button type="submit" class="btn btn-primary" name="submit" value="submit"><font face="Montserrat">Proceed to next step</font></button>
<button type="submit" class="btn btn-link" name="submit1" value="submit"><font face="Montserrat">Skip</font></button>
</div>
</form>
</div>
<!-- /.col-lg-12 (nested) -->
</div>
<!-- /.row (nested) -->
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
</div>
<!-- /#page-wrapper -->
<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<!-- Metis Menu Plugin JavaScript -->
<script src="metisMenu.min.js"></script>
<!-- Custom Theme JavaScript -->
<script src="sb-admin-2.js"></script>
<?php require_once("includes/footer.php") ?>