-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhome.php
201 lines (160 loc) · 4.27 KB
/
home.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
<?php
// for checking if user is trying to access without login
session_start();
if (isset($_SESSION['name']) && !empty($_SESSION['name'])) {
} else {
header("Location: index.html");
exit();
}
//////////////////////////////////
$sname= "localhost";
$unmae= "root";
$password = "";
$db_name = "test_db";
$con =mysqli_connect($sname, $unmae, $password,$db_name);
if ($con -> connect_error) {
die("connection failed:".$conn->connect_error);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
html{
/* background: linear-gradient(to right top, #0c008c, #002a8d, #003c82, #134971, #45535e) ; */
max-height:768px;
height:100%;
color:black;
/* background-image: linear-gradient(to bottom, #00132e, #27485a, #648085, #acbbb7, #f7f8f7); */
}
form{
margin:10px auto;
max-width:350px;
width:100%;
border:2px solid lightgrey;
background: white;
/* box-shadow: 1px 2px 1px 3px lightgrey; */
height:300px;
border-radius: 10px;
text-align:center;
margin-bottom:0px;
}
form div{
height:50px;
color: #002a8d;
text-align:center;
padding:10px ;
margin-top:-10px !important;
border-bottom: 2px solid transparent;
border-bottom: 2px solid #002a8d;
margin-bottom:10px;
}
form div h3{
margin-top:50px;
margin-bottom:0px;
}
form label{
padding-left:5px;
float:left;
margin:13px auto ;
}
form input{
padding:5px;
border-radius: 5px;
border:2.5px solid grey;
border-radius: 5px;
max-width:160px;
margin:10px auto;
margin-right:10px;
float:right;
}
.submit{
height:40px;
font-size:16px;
border: 2px solid transparent;
border-radius: 5px;
background: #002a8d;
font-weight:bold;
color: white;
margin-top:20px;
margin-right:100px !important;
width:120px;
}
table{
max-width:600px;
width:80%;
border: 2px solid black;
margin-top:30px;
text-align: center;
padding:5px;
background: white;
color:black;
border-collapse: collapse;
margin:30px auto 0px;
}
table thead{
font-size: 20px;
font-weight: bold;
border: 1px solid black;
width:200px;
color:black;
}
table tr {
border: 1px solid black;
color:black;
}
table tr td{
color: black;
font-weight: bold;
border: 1px solid black;
}
h2{
margin:30px auto 10px;
width:200px;
}
h1{
width:800px;
margin:30px auto 0px;
text-align:center;
}
.button {
border-radius: 15px;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 22px;
margin: 4px 2px;
cursor: pointer;
}
.button1 {background-color: RED;} /* Red */
</style>
</head>
<body>
<h2 margin="0px auto" color="Black" >Students Table</h2>
<table cellpadding="1" cellspacing="1">
<tr> <thead><td>RollNo</td><td>Name</td><td>Email ID</td></thead></tr>
<tr>
<?php
$sql= "SELECT * FROM `students`";
$result= mysqli_query($con, $sql);
//if ($result->num_rows>0){
while ($rows=$result->fetch_assoc())
{
?>
<td><?php echo $rows['rollNo'] ?></td>
<td><?php echo $rows['name'] ?></td>
<td><?php echo $rows['email'] ?></td>
</tr>
<?php
} ?>
</table>
<button onclick="window.location.href='logout.php?logout=1'" class="button1 button">Log Out</button> <br>
<br>
</body>
</html>