-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorgregistration.php
236 lines (210 loc) · 8.17 KB
/
orgregistration.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
236
<?php
include'/accessctrl.php';
//Varible initialisation.
$bizname = "";
$bizDescriptn = "";
$Extracts = "";
$Exts = "";
$logopath = "";
$errorMsg = "";
//retreiving some of the user's data.
$usersOtherNames = explode(" ", mysqli_result($result, 0,'user_other_names'));
$CUEmail = mysqli_result($result, 0,'user_Email');
$firstName = $usersOtherNames[0];
//function to check that all form variables are set.
function Check(){
if( isset($_POST['BizRegBtn']) == "register"){
return isset($_POST['bizname'], $_POST['bizDescriptn']);
}
}
// check all our variables are set and move their value to database
if(Check() == TRUE){
$errJar = "";
if(!empty($_POST['bizname']))
{
$bizname = $_POST['bizname'];
}
else
{
$errJar .= '<li>Please type in the <b>name of your Business or Organisation</b>.</li>';
}
if(!empty($_POST['bizDescriptn']))
{
$bizDescriptn = $_POST['bizDescriptn'];
}
else
{
$errJar .= '<li>Please provide a brief <b>Description of your Business or Organisation</b>.</li>';
}
//picking up uploaded logo
$fileDestinatn = 'bizlogos/'.$_POST['bizname'];
if(!file_exists($fileDestinatn)){
mkdir($fileDestinatn, 0, true);
}
$safeExts = array("jpg", "jpeg", "gif", "png");
$Extracts = explode(".", $_FILES["logofile"]["name"]);
$Exts = end($Extracts);
$Exts = strtolower($Exts);
if((($_FILES["logofile"]["type"] == "image/gif")||($_FILES["logofile"]["type"] == "image/jpg")||
($_FILES["logofile"]["type"] == "image/jpeg")||($_FILES["logofile"]["type"] == "image/pjpeg")||
($_FILES["logofile"]["type"] == "image/png")) && in_array($Exts, $safeExts) && !empty($_FILES["logofile"])){
$logopath = "bizlogos/".$_POST['bizname']."/". $_FILES["logofile"]["name"];
move_uploaded_file($_FILES["logofile"]["tmp_name"], $logopath);
}else{
$errJar .="<li>Looks like you're <b>trying to upload a picture type we really don't deal with for now, or you're not uploading your logo.</b>.</li>";
}
if($bizname != "" && $bizDescriptn != "" && $logopath != ""){
//Moving collected data to database
$query1 = sprintf("INSERT INTO reg_biz_details(biz_name, biz_descriptn, biz_admin_email, biz_logo_path)
VALUES('%s','%s','%s','%s')",
mysqli_real_escape_string($dblink, $bizname),
mysqli_real_escape_string($dblink, $bizDescriptn),
mysqli_real_escape_string($dblink, $CUEmail),
$logopath);
$result1= mysqli_query($dblink, $query1);
if($result1 == FALSE){
$errorMsg .= "<ul>Oops! There is a little problem. Try registering again.</ul>";
} else{
header("Location:orgdashboard.php?admin=".$CUEmail."&orgname=".stripslashes(htmlentities($bizname, ENT_QUOTES)));
exit;
}
}else{
$errorMsg = "<p> Please make sure to <b>fill out the entire form</b>.</p>";
}
if(!empty($errJar)){
$errorMsg = "<p> Please make sure to <b>fill out the entire form always</b>.</p>";
$errorMsg .= "<ul>" .$errJar. "</ul>";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Organisation Registration - Pyruscape™</title>
<link rel = "stylesheet" type ="text/css" href = "css/bootstrap.min.css">
<link rel = "stylesheet" type = "text/css" href = "css/codedoc.css">
<link rel = "stylesheet" type ="text/css" href = "css/bootstrap-fileupload.min.css">
</head>
<body>
<script src="js/jquery-1.8.1.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap-fileupload.min.js"></script>
<!--HEADER SECTION-->
<div class="headr">
<div class="container">
<div class="span12">
<div class="row-fluid">
<!--SITE LOGO-->
<div class="span4"><img src = "img/pyrusclogo v4.gif"></div>
<!--LOGIN FORM ON HEADER-->
<div class="span8">
<form class="form-inline" method="post" action="yourdocstream.php">
<div id ="headr-logout">
<button type="submit" class="btn" name ="SignOut" value = "SignOut">Sign out</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!--FLAG SECTION-->
<?php
if(!empty($errorMsg)){
echo('<div class = "redflag"><div class ="container"><div class = "row-fluid"><div class = "errFlagMgr">'.$errorMsg.'</div></div></div></div>');
}
?>
<!--MENU SECTION-->
<div class="menu">
<div class="container">
<div class ="span12">
<div class = "menuLinks">
<div class="menulist">
<a href ="yourdocstream.php"><i class = ' icon-list-alt'></i> <?php echo $firstName;?>'s Document Stream</a>
<a href ="profilepage.php?uemail=<?php echo $CUEmail;?>"><i class = 'icon-user'></i> <?php echo $firstName;?>'s Profile</a>
<a href ="notifier.php"><i class = ' icon-bell'></i> Notifications</a>
<a href ="msgstream.php"><i class = ' icon-envelope'></i> Messages</a>
<a href ="reminder.php"><i class = ' icon-check'></i> Reminders</a>
</div>
</div>
</div>
</div>
</div>
<!--PROFILE TITLE SECTION-->
<div class = "container">
<div class = "span12">
<div class = "row-fluid">
<h2 class = "regTitle">Business/Organisation Registration Page</h2>
</div>
</div>
</div>
<!--CONTENT SECTION-->
<div class = "container">
<div class = "bizregbody">
<div class ="span12">
<div class = "row-fluid">
<div class = "span2">
</div>
<div class = "span8">
<form method = "post" action = "orgregistration.php" enctype = "multipart/form-data">
<table class = "table">
<tr>
<td>
</td>
<td>
<div class = "fileupload fileupload-new" data-provides = "fileupload">
<div class = "fileupload-new thumbnail" style = "width:142px; height:148px;">
<img src = "img/logopix2.jpg"/>
</div>
<div class = "fileupload-preview fileupload-exists thumbnail" style = "max-width:142px; max-height:148px;">
</div>
<div>
<span class = "btn btn-file">
<span class = "fileupload-new"><i class = 'update'>Select Logo</i></span>
<span class = "fileupload-exists"><i class = 'update'>Change</i></span>
<input type ="file" id = "logofile" name = "logofile"/>
</span>
<a href = "#" class = "btn fileupload-exists" data-dismiss = "fileupload"><i class = 'update'>Remove</i></a>
</div>
</div>
</td>
</tr>
<tr>
<td>Business/Organisation Name: </td><td><input class="span5" type = "text" name = "bizname" width = "100%" placeholder = "Type in your business name here"/></td>
</tr>
<tr>
<td>Description of Business: </td><td><textarea class="span5" name = "bizDescriptn" width = "100%" placeholder = "Give a brief description of your business here"></textarea></td>
</tr>
<tr>
<td></td><td><button class = "btn" name = "BizRegBtn" value = "register">Register</button></td>
</tr>
</table>
</form>
</div>
<div class = "span2">
</div>
</div>
</div>
</div>
</div><br>
<!--FOOTER-->
<div class="footr">
<div class="container">
<div class ="span12">
<div class = "footrLinks">
<div class="copyright">© <?php echo date("Y");?>
<a href ="">Kaelahi Technologies</a>
<a href ="">About Us</a>
<a href ="">Contact</a>
<a href ="">Career</a>
<a href ="">FAQ</a>
<a href ="">Privacy Statement</a>
<a href ="">Terms and Conditions</a>
<a href ="">Blog</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>