-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
92 lines (88 loc) · 2.75 KB
/
signup.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
<html>
<head>
<title>Please enter required information to sign up to Koo...</title>
</head>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Update the DB with the new data
$bu_name = $_POST['name'];
$bu_category = $_POST['category'];
$bu_sub_category = $_POST['sub_category'];
$bu_login = $_POST['username'];
$bu_password = $_POST['password'];
$bu_intro = $_POST['intro'];
$stmt = 'INSERT INTO business_unit (name, login, password, category, sub_category, intro)'
. ' VALUES ("' . $bu_name . '", "' . $bu_login . '", "' . $bu_password
. '", "' . $bu_category . '", "' . $bu_sub_category . '", "' . $bu_intro . '")';
$mysql_client = mysqli_connect('koodemo.cwmhshxpuljc.us-west-2.rds.amazonaws.com',
'koomaster',
'koopassword',
'koodb');
if ($mysql_client->connect_errno) {
echo 'Failed to connect to Mysql: ' . $mysql_client->error
. ' (' . $mysql_client->connect_errno . ')';
return;
} else {
if ($mysql_client->query($stmt) === TRUE) {
$mysql_client->close();
header('Location: http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/index.php');
} else {
echo 'Failed to insert new business to Mysql: ' . $mysql_client->error;
$mysql_client->close();
return;
}
}
}
?>
<body>
<form action='signup.php' method='post'>
<table>
<tr>
<td colspan='2'>Please enter the information for the new business entity...</td>
</tr>
<tr>
<td>Business name:</td>
<td><input name='name' /></td>
</tr>
<tr>
<td>Category:</td>
<td>
<select name='category'>
<option>Restaurant</option>
<option>Barber</option>
</select>
</td>
</tr>
<tr>
<td>Sub category:</td>
<td><input name='sub_category' /></td>
</tr>
<tr>
<td>Username:</td>
<td><input name='username' /></td>
<tr>
<td>Password:</td>
<td><input name='password' type='password' /></td>
</tr>
<tr>
<td>Introduction:</td>
<td><input name='intro' /></td>
</tr>
<tr>
<td>Cover image:</td>
<td><input name='cover_image' /></td>
</tr>
<tr>
<td colspan='2'>
<table width='100%'>
<tr>
<td width='50%' align='center'><button type='submit'>Sign up</button></td>
<td align='center'><button type='button' onclick='javascript:window.location="login.php"'>Cancel</button></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>