-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuredi_tecaj.php
52 lines (48 loc) · 1.6 KB
/
uredi_tecaj.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
<?php
include("zaglavlje.php");
$bp=spojiSeNaBazu();
if(!isset($_SESSION['aktivni_korisnik_tip'])||$_SESSION['aktivni_korisnik_tip']==2) header("Location:index.php");
if ($_SERVER['REQUEST_METHOD'] === "POST") {
$bp=spojiSeNaBazu();
$id=$_GET['tecaj'];
$danas=date("Y-m-d");
$tecaj=$_POST['tecaj'];
$sql="UPDATE valuta SET tecaj = '$tecaj', datum_azuriranja ='$danas' WHERE valuta_id='$id'";
izvrsiUpit($bp,$sql);
header("Location:uredi_valutu.php");
}
if(isset($_GET['tecaj'])){
$id=$_GET['tecaj'];
$sql="SELECT * FROM valuta WHERE valuta_id='$id'";
$rs=izvrsiUpit($bp,$sql);
list($id,$moderator,$naziv,$tecaj,$slika,$zvuk,$od,$do,$datum)=mysqli_fetch_array($rs);
}
?>
<!DOCTYPE html>
<html>
<body>
<form method="POST" action="<?php if(isset($_GET['tecaj']))echo "uredi_tecaj.php?tecaj=$id";?>">
<table>
<caption>UREDI TECAJ <br><p class="greska">Napomena: tecaj mozete azurirati samo jednom dnevno</p></caption>
<thead>
<tr>
<td>Id valute</td>
<td>Naziv</td>
<td>Tecaj</td>
<td>Datum posljednjeg azuriranja</td>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $id; ?></td>
<td><?php echo $naziv; ?></td>
<td><?php if(date("Y-m-d")==$datum) echo "<input name='tecaj' id='tecaj' type='number' value='$tecaj' readonly>";
else echo "<input name='tecaj' id='tecaj' type='number' value='$tecaj' step='0.000001'>";?></td>
<td><?php echo date("d.m.Y.", strtotime($datum)) ;?></td>
<td><input type="submit" name="submit" id="submit" value="Spremi"></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>