-
Notifications
You must be signed in to change notification settings - Fork 2
/
loggedin.php
88 lines (72 loc) · 2.29 KB
/
loggedin.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
<?php
// include('session.php');
?>
<html>
<head>
<title>Welcome </title>
<style>
#pappu{
border: 12px solid #4CAF50; border-style:groove;border-radius: 0px 20px 0px 20px; padding:60px;margin:auto;
width:80%;
margin:auto;
align:center;
}
a:link, a:visited {
color: (internal value);
text-decoration: underline;
cursor: auto;
}
a:link:active, a:visited:active {
color: (internal value);
}
</style>
</head>
<body>
<center>
<h1>Welcome </h1>
</center>
<br><br><br><br><br>
<h3 id="pappu">
<li>
<a href="newstu.php">Add new Student Account</a></li>
<br>
<br>
<li><a href="monstu.php">Substract or Add money to student account </a></li>
<br>
<br>
<li><a href="newsho.php">Add new Shop</a></li>
<br>
<br>
<li> <a href="monsho.php">Substract money from shop account</a></li>
<br>
<br>
</h3>
<h2 style="text-align:center;"><a href = "index.php">Sign Out</a></h2>
</body>
<?php
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '');
define('DB_DATABASE', 'nis');
$db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
// username and password sent from form
$shop = mysqli_real_escape_string($db,$_POST['shop']);
$amt = mysqli_real_escape_string($db,$_POST['amt']);
$sql = " UPDATE 'details' SET 'balance'=balance - $amt WHERE username =";
$result = mysqli_query($db,$sql);
$row = mysqli_fetch_array($result,MYSQLI_ASSOC);
//$active = $row['active'];
$count = mysqli_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count == 1) {
//session_register("myusername");
$_SESSION['login_user'] = $myusername;
header("location: loggedin.php");
}else {
$error = "Your Login Name or Password is invalid";
}
}
?>
</html>