Làm cách nào để tạo biểu mẫu đăng nhập với quản trị viên và người dùng trong php?

Cách tạo Hệ thống đăng nhập của quản trị viên và người dùng Cơ sở dữ liệu PHP và MySQL


  • Đầu tiên tạo các tệp hoặc thư mục này

  • Tạo tệp này Tạo cơ sở dữ liệu & bảng.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
How to run project:
1] Create a database called multi_login
2] create a table users with the following fields:
 - id - int[11]
 -username - varchar[100]
 -email - varchar[100]
 -user_type - varchar[20]
 -password - varchar[100]
3] Start apache and mysql and launch site on browser
4] In order to create an admin, use a client like phpmyadmin and manually create a user with user_type admin. Use this user to login and be able to create other users.
Thanks
Get more at codewithawa.com



  • Tạo tệp này Kiểu. css.
Mã nguồn

 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
* {
 margin: 0px;
 padding: 0px;
}
body {
 font-size: 120%;
 background: #F8F8FF;
}

.header {
 width: 40%;
 margin: 50px auto 0px;
 color: white;
 background: #5F9EA0;
 text-align: center;
 border: 1px solid #B0C4DE;
 border-bottom: none;
 border-radius: 10px 10px 0px 0px;
 padding: 20px;
}
form, .content {
 width: 40%;
 margin: 0px auto;
 padding: 20px;
 border: 1px solid #B0C4DE;
 background: white;
 border-radius: 0px 0px 10px 10px;
}
.input-group {
 margin: 10px 0px 10px 0px;
}

.input-group label {
 display: block;
 text-align: left;
 margin: 3px;
}
.input-group input {
 height: 30px;
 width: 93%;
 padding: 5px 10px;
 font-size: 16px;
 border-radius: 5px;
 border: 1px solid gray;
}
#user_type {
 height: 40px;
 width: 98%;
 padding: 5px 10px;
 background: white;
 font-size: 16px;
 border-radius: 5px;
 border: 1px solid gray;
}
.btn {
 padding: 10px;
 font-size: 15px;
 color: white;
 background: #5F9EA0;
 border: none;
 border-radius: 5px;
}
.error {
 width: 92%; 
 margin: 0px auto; 
 padding: 10px; 
 border: 1px solid #a94442; 
 color: #a94442; 
 background: #f2dede; 
 border-radius: 5px; 
 text-align: left;
}
.success {
 color: #3c763d; 
 background: #dff0d8; 
 border: 1px solid #3c763d;
 margin-bottom: 20px;
}

.profile_info img {
 display: inline-block; 
 width: 50px; 
 height: 50px; 
 margin: 5px;
 float: left;
}

.profile_info div {
 display: inline-block; 
 margin: 5px;
}

.profile_info:after {
 content: "";
 display: block;
 clear: both;
}

  • Tạo tệp này Chức năng. php.
Mã nguồn

  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

Chủ Đề