-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.php
181 lines (159 loc) · 8.07 KB
/
register.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
<?php
require_once 'php_action/db_connect.php';
$errors = array();
$errors = [];
if ($_POST) {
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$companyid = $_POST['companyid'];
$companyname = $_POST['companyname'];
$companyaddress = $_POST['companyaddress'];
$licenceno = $_POST['licenceno'];
$phoneno = $_POST['phoneno'];
if (empty($companyid) || empty($companyname) || empty($companyaddress) || empty($licenceno) || empty($phoneno) || empty($username) || empty($password) || empty($email)) {
if ($password == "") {
$errors[] = "password is required";
}
if ($username == "") {
$errors[] = "username is required";
}
if ($companyid == "") {
$errors[] = "companyid is required";
}
if ($companyname == "") {
$errors[] = "Company name required";
}
if ($companyaddress == "") {
$errors[] = "Company address required";
}
if ($licenceno == "") {
$errors[] = "licence no is required";
}
if ($phoneno == "") {
$errors[] = "phone no is reuired";
}
} else {
$sql1 = "SELECT * FROM users WHERE username = '$username'";
$result = $connect->query($sql1);
if ($result->num_rows > 0) {
$errors[] = "username already exit";
} else {
$sql = "INSERT INTO users (username,password,email,companyid,companyname,companyaddress,licenceno,phoneno)
VALUES ('$username','$password','$email','$companyid','$companyname','$companyaddress','$licenceno','$phoneno')";
if ($connect->query($sql) === TRUE) {
$errors['messages'] = "Successfully Added";
} else {
$errors['messages'] = "Error while adding the members";
}
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Stock Management System</title>
<!-- bootstrap -->
<link rel="stylesheet" href="assests/bootstrap/css/bootstrap.min.css">
<!-- bootstrap theme-->
<link rel="stylesheet" href="assests/bootstrap/css/bootstrap-theme.min.css">
<!-- font awesome -->
<link rel="stylesheet" href="assests/font-awesome/css/font-awesome.min.css">
<!-- custom css -->
<link rel="stylesheet" href="custom/css/custom.css">
<!-- jquery -->
<script src="assests/jquery/jquery.min.js"></script>
<!-- jquery ui -->
<link rel="stylesheet" href="assests/jquery-ui/jquery-ui.min.css">
<script src="assests/jquery-ui/jquery-ui.min.js"></script>
<!-- bootstrap js -->
<script src="assests/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<!-- Content Wrapper -->
<div class="login-wrapper">
<div class="container-center lg">
<div class="login-area">
<div class="panel panel-bd panel-custom">
<div class="panel-heading">
<div class="view-header">
<div class="header-icon">
<i class="pe-7s-unlock"></i>
</div>
<div class="header-title">
<h3>Register</h3>
<small><strong>Please enter your data to register.</strong></small>
</div>
</div>
</div>
<div class="panel-body">
<div class="messages">
<?php if ($errors) {
foreach ($errors as $key => $value) {
echo '<div class="alert alert-warning" role="alert">
<i class="glyphicon glyphicon-exclamation-sign"></i>
' . $value . '</div>';
}
} ?>
</div>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" id="registerform" method="post">
<div class="row ">
<div class="form-group col-lg-6">
<label>Username</label>
<input type="text" value="" id="username" class="form-control" name="username">
<span class="help-block small">Your unique username to app</span>
</div>
<div class="form-group col-lg-6">
<label>Company ID</label>
<input type="text" value="" id="companyid" class="form-control" name="companyid">
<span class="help-block small">Your unique companyno to app</span>
</div>
<div class="form-group col-lg-6">
<label>Password</label>
<input type="password" value="" id="password" class="form-control" name="password">
<span class="help-block small">Your hard to guess password</span>
</div>
<div class="form-group col-lg-6">
<label>Repeat Password</label>
<input type="password" value="" id="repeatpassword" class="form-control" name="repeatpassword">
<span class="help-block small">Please repeat your pasword</span>
</div>
<div class="form-group col-lg-6">
<label>Email Address</label>
<input type="text" value="" id="email" class="form-control" name="email">
<span class="help-block small">Your address email to contact</span>
</div>
<div class="form-group col-lg-6">
<label>Company Name</label>
<input type="text" value="" id="companyname" class="form-control" name="companyname">
<span class="help-block small">Your Company Name</span>
</div>
<div class="form-group col-lg-6">
<label>Company Address</label>
<input type="text" value="" id="companyaddress" class="form-control" name="companyaddress">
<span class="help-block small">Your Company Address</span>
</div>
<div class="form-group col-lg-6">
<label>Licence #</label>
<input type="text" value="" id="licenceno" class="form-control" name="licenceno">
<span class="help-block small">Your Company Licence Number</span>
</div>
<div class="form-group col-lg-6">
<label>Phone #</label>
<input type="text" value="" id="phoneno" class="form-control" name="phoneno">
<span class="help-block small">Your Company Phone Number</span>
</div>
</div>
<div>
<button type="submit" name="register" class="btn btn-default"> <i class="glyphicon glyphicon-log-in"></i> Register</button>
<br>
<a href="index.php">Click To Login</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php require_once 'includes/footer.php'; ?>