-
Notifications
You must be signed in to change notification settings - Fork 0
/
userPref_settings.php
76 lines (64 loc) · 2.57 KB
/
userPref_settings.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
<?php
require_once ("Includes/header.php");
if(!logged_on())
{
header ("Location: /Home.php");
}
if (isset($_GET['Message'])){
echo "<script>popup('".$_GET['Message']."')</script>";
header ("Refresh:2; url=/userPref_settings.php");
}
if(isset($_POST['AddDevice']))
{
header ("Location: /user_addDevice.php");
}
if(isset($_POST['Update']))
{
$Uid = $_SESSION['userid'];
$query = "SELECT * FROM riot4.settings WHERE User_ID = ? ORDER BY PrimKey DESC";
$params = array($Uid);
$statement_user = sqlsrv_query($conn,$query,$params);
while($row = sqlsrv_fetch_array($statement_user))
{
$d1 = $row['PrimKey'];
$val = $_POST[$d1];
$query_update = "UPDATE riot4.settings SET Value = ? WHERE PrimKey = ?";
$params = array($val, $row['PrimKey']);
$statement_update = sqlsrv_query($conn,$query_update,$params);
}
}
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"/Styles/Settings.css\">";
global $conn;
$Uid = $_SESSION['userid'];
$query = "SELECT * FROM riot4.settings WHERE User_ID = ? ORDER BY PrimKey DESC";
$params = array($Uid);
$statement_user = sqlsrv_query($conn,$query,$params);
echo "<div id=\"main\">";
echo "<h2> Preferences</h2>";
echo "<p><form action=\"userPref_settings.php\" method=\"post\"></p>";
while($row = sqlsrv_fetch_array($statement_user))
{
$d = $row['PrimKey'];
$dev = $row['Device'];
$val = $row['Value'];
if($val!=NULL||$val==0)
{
echo "<div class=\"settings\">";
echo "<img src=\"/Images/$dev.png\" alt=\"$dev\" height=\"50em\" width=\"50em\">";
echo "<input name=\"$d\" type=\"range\" min=\"0\" max=\"10\" value=\"$val\" oninput=\"showValue(this.name,this.value)\" />";
echo "<span id=\"$d\">$val</span>";
echo "</div>";
}
}
if(isset($_POST['Update']))
{
echo "Updated<br><br>";
}
echo "<div class=\"settingsUpdate\">";
echo "<input id=\"Update\" name=\"Update\" type=\"submit\" value=\"Update\"/> ";
echo "<input id=\"AddDevice\" name=\"AddDevice\" type=\"submit\" value=\"Add/Remove Device\"/>";
echo "</div>";
echo "</form>";
echo "</div>";
require_once ("Includes/footer.php");
?>