-
Notifications
You must be signed in to change notification settings - Fork 0
/
changeNotfId.php
112 lines (92 loc) · 3.64 KB
/
changeNotfId.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
<?include_once("global.php");?>
<!DOCTYPE html>
<html lang="en">
<?include_once("./phpParts/head.php");?>
<body class="">
<div class="wrapper ">
<div class="sidebar" data-color="purple" data-background-color="white" data-image="assets/img/sidebar-1.jpg">
<!--
Tip 1: You can change the color of the sidebar using: data-color="purple | azure | green | orange | danger"
Tip 2: you can also add an image using data-image tag
-->
</div>
<div class="main-panel">
<!-- Navbar -->
<!-- End Navbar -->
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="alert alert-success" role="alert" id="success" style="display:none;">
<b>Associated Student ID changed.</span>
</div>
<div class="card">
<div class="card-header card-header-primary">
<h4 class="card-title ">Change Notification Student ID</h4>
</div>
<div class="card-body">
<div class="table-responsive">
<form style="margin:12px;" method="post" action="" autocomplete="off" >
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputEmail4">Previous Student ID</label>
<input id="studentIdBox" name="studentId" type="text" class="form-control" style="padding:5px;" placeholder="" required readonly>
</div>
<div class="form-group col-md-6">
<label for="inputEmail4">New Student ID [eg. 2908]</label>
<input id="studentIdBoxNew" name="studentIdNew" type="text" class="form-control" maxlength="4" placeholder="" required>
</div>
<div class="form-group col-md-6" style="display:none;">
<input id="token" name="token" type="text" class="form-control" placeholder="" required>
</div>
</div>
<button type="submit" class="btn btn-primary">Change</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?include_once("./phpParts/footer.php");?>
</body>
</html>
<?
if(isset($_POST["studentId"])&&isset($_POST["studentIdNew"])){
$studentId = $_POST["studentId"];
$studentIdNew = $_POST["studentIdNew"];
$token = $_POST["token"];
?>
<script>
localStorage.setItem("studentId", "<?echo $studentIdNew?>")
</script>
<?
if((!$studentIdNew)||(!$studentId)){
$message = "Please insert both fields.";
}
else{
//go
//update room status
$sql="update lib_pushTokens set studentId='$studentIdNew' where studentId='$studentId' and token='$token'";
if(!mysqli_query($con,$sql))
{
echo"can not";
}
?>
<?php
if(isset($_GET['retUrl'])){
$retUrl = $_GET['retUrl'];
}
?>
<script type="text/javascript">
document.getElementById("success").style.display = "block"
window.location = "<?echo $retUrl?>";
</script>
<?
}}
?>
<script>
document.getElementById("studentIdBox").value = localStorage.getItem("studentId");
document.getElementById("token").value = localStorage.getItem("token");
</script>