-
Notifications
You must be signed in to change notification settings - Fork 0
/
change_stuff.php
130 lines (127 loc) · 3.71 KB
/
change_stuff.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
<?php
session_start();
try{
$conn=oci_connect('speculapp','SPECULAPP','localhost/XE');
if (!$conn) {
$e = oci_error();
throw new Exception;
}
// Prepare the statement
$stid = oci_parse($conn, 'SELECT WIN_SUM,LOSE_SUM,INTERVAL,START_SUM FROM SETTINGS');
if (!$stid) {
$e = oci_error($conn);
throw new Exception;
}
// Perform the logic of the query
$r = oci_execute($stid);
if (!$r) {
$e = oci_error($stid);
throw new Exception;
}
$row = oci_fetch_array($stid, OCI_NUM);
$winsum=$row[0];
$losesum=$row[1];
$interval=$row[2];
$start_sum=$row[3];
oci_free_statement($stid);
$stid = oci_parse($conn, "SELECT EXCHANGE_RATE FROM CURRENCY WHERE TRIGRAMM='USD'");
if (!$stid) {
$e = oci_error($conn);
throw new Exception;
}
// Perform the logic of the query
$r = oci_execute($stid);
if (!$r) {
$e = oci_error($stid);
throw new Exception;
}
$row = oci_fetch_array($stid, OCI_NUM);
$usdrate=$row[0];
oci_free_statement($stid);
$stid = oci_parse($conn, "SELECT EXCHANGE_RATE FROM CURRENCY WHERE TRIGRAMM='EUR'");
if (!$stid) {
$e = oci_error($conn);
throw new Exception;
}
// Perform the logic of the query
$r = oci_execute($stid);
if (!$r) {
$e = oci_error($stid);
throw new Exception;
}
$row = oci_fetch_array($stid, OCI_NUM);
$eurrate=$row[0];
oci_free_statement($stid);
}catch(Exception $e){
header("Location: generic_error.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Settings</title>
<link rel="stylesheet" type="text/css" href="navbar.css" />
<link rel="stylesheet" type="text/css" href="changestuff.css" />
</head>
<body>
<nav>
<ul class="navigation">
<?php
if(isset($_SESSION["logged"])){
if($_SESSION["uid"]==1){
echo '<li><a href="admin.php">Home</a></li>';
}else{
echo '<li><a href="choice.php">Home</a></li>';
}
}
else{
echo '<li><a href="home.php">Home</a></li>';
}
?>
<li><a href="contact.php">Contact</a></li>
<li><a href="about.php">About</a></li>
<li><a href="login.php">Login</a></li>
<li><a href="signup.php">Signup</a></li>
<?php
if(isset($_SESSION["logged"])){
echo '<li style="float:right"><a href="logout.php">Logout</a></li>';
}
?>
</ul>
</nav>
<div class="menu">
<div class="board">
<p>current win sum: <?php echo htmlspecialchars($winsum); ?></p>
<form action="changewinsum.php">
<input type="text" id="delete" name="delete" ><br>
<input type="submit" value="Change win sum" id="sub">
</form>
<p>current lose sum: <?php echo htmlspecialchars($losesum); ?></p>
<form action="changelosesum.php">
<input type="text" id="delete" name="delete" ><br>
<input type="submit" value="Change lose sum" id="sub">
</form>
<p>current start sum: <?php echo htmlspecialchars($start_sum); ?></p>
<form action="changestartsum.php">
<input type="text" id="delete" name="delete" ><br>
<input type="submit" value="Change start sum" id="sub">
</form>
<p>current interval: <?php echo htmlspecialchars($interval); ?> ms</p>
<form action="changeinterval.php">
<input type="text" id="delete" name="delete" ><br>
<input type="submit" value="Change interval" id="sub">
</form>
<p>current medium USD price: <?php echo htmlspecialchars($usdrate); ?></p>
<form action="changeusdrate.php">
<input type="text" id="delete" name="delete" ><br>
<input type="submit" value="Change dollar rate" id="sub">
</form>
<p>current medium Euro price: <?php echo htmlspecialchars($eurrate); ?></p>
<form action="changeeurrate.php" style="padding-bottom:5px;">
<input type="text" id="delete" name="delete" ><br>
<input type="submit" value="Change euro rate" id="sub">
</form>
</div>
</div>
</body>
</html>