source: branches/posledni/pages/admin_finance_modify.php

Last change on this file was 685, checked in by george, 15 years ago
  • Opraveno: Resetování xp a pozice.
File size: 4.8 KB
Line 
1<?php
2$lvl = $player -> GetGmLvl();
3if(1 > 0){
4$id_upravit = $_POST['id_upravit'];
5$q = $_GET['q'];
6
7if($q==1):
8
9$operace_obracene = array(
10 "Nákup" => "buy",
11 "Prodej" => "sell",
12 "Spotřeba" => "consumption",
13 "Internet" => "internet",
14 "contribution" => "contribution",
15);
16
17$id2 = $_POST['id'];
18$money = $_POST['money'];
19$oper = $_POST['operace'];
20$popis = $_POST['popis'];
21$odmena = $_POST['odmena'];
22
23$operace = $operace_obracene[$oper];
24
25 $upravit_money = $db->query("update Finance set Money='$money' where Id='$id2'");
26 $upravit_operace = $db->query("update Finance set Operation='$operace' where Id='$id2'");
27 $upravit_popis = $db->query("update Finance set Description='$popis' where Id='$id2'");
28 $upravit_odmenu = $db->query("update Finance set Reward='$odmena' where Id='$id2'");
29
30 if($upravit_money and $upravit_operace and $upravit_popis and $upravit_odmenu):
31 $info = "<font color=green><b>Finance byla upravena vpořádku...</b></font>";
32 else:
33 $info = "<font color=red><b>Při upravování finance došlo k chybě...</b></font>";
34 endif;
35
36endif;
37
38echo"<p align=center>$info";
39$operace = array(
40 "buy" => "Nákup",
41 "sell" => "Prodej",
42 "consumption" => "Spotřeba",
43 "internet" => "Internet",
44 "contribution" => "Příspěvek od",
45);
46
47$db -> select_db($Config['Database']['Database']);
48
49$load_money = $db -> query("SELECT SUM(`Money`) FROM `Finance`;") -> fetch_array();
50
51echo"<p><strong>Aktuální stav financí: ".$load_money[0]." Kč</strong></p>";
52echo "
53 <table border=\"1\" width=\"540\">
54 <tr>
55 <th>Datum</th>
56 <th>Suma</th>
57 <th>Popis</th>
58 <th>Odměna</th>
59 <th>&nbsp;</th>
60 </tr>
61";
62$load_dotation = $db -> query("SELECT * FROM `Finance` ORDER BY `Id` DESC;");
63 while ($row = $load_dotation -> fetch_array())
64 {
65 $id = $row['Id'];
66
67 if ($row["Time"] != "")
68 {
69
70 //$date = $server -> HumanDate ($row["time"],0);
71 $date = $row["Time"];
72 }
73 else
74 {
75 $date = "";
76 }
77 if($row["Money"] > 0)
78 {$plus = "+";} else{$plus = "";}
79
80 if($id != $id_upravit):
81 echo "
82 <tr>
83 <td align=\"center\">".$date."</td>
84 <td align=\"center\">".$plus.$row["Money"]."</td>
85 <td align=\"left\">".$operace[$row["Operation"]]." ".$row["Description"]."</td>
86 <td align=\"center\">".$row["Reward"]."</td>
87 <form method=post><td align=\"center\" valign=\"middle\"><input type=hidden name='id_upravit' value='$id'><input type=submit value='Upravit'></form></td>
88 </tr>
89 ";
90 else:
91 $oper = $row["Operation"];
92 if($operace[$oper]=="Nákup"):
93 $option =
94 "<option value=\"buy\">Nákup
95 <option value=\"sell\">Prodej
96 <option value=\"consumption\">Spotřeba
97 <option value=\"internet\">Internet
98 <option value=\"contribution\">Příspěvek";
99 elseif($operace[$oper]=="Prodej"):
100 $option =
101 "<option value=\"buy\">Nákup
102 <option value=\"sell\" selected>Prodej
103 <option value=\"consumption\">Spotřeba
104 <option value=\"internet\">Internet
105 <option value=\"contribution\">Příspěvek";
106 elseif($operace[$oper]=="Spotřeba"):
107 $option =
108 "<option value=\"buy\">Nákup
109 <option value=\"sell\" >Prodej
110 <option value=\"consumption\" selected>Spotřeba
111 <option value=\"internet\">Internet
112 <option value=\"contribution\">Příspěvek";
113 elseif($operace[$oper]=="Interpret"):
114 $option =
115 "<option value=\"buy\">Nákup
116 <option value=\"sell\" >Prodej
117 <option value=\"consumption\">Spotřeba
118 <option value=\"internet\" selected>Internet
119 <option value=\"contribution\">Příspěvek";
120 elseif($operace[$oper]=="Příspěvek od"):
121 $option =
122 "<option value=\"buy\">Nákup
123 <option value=\"sell\" >Prodej
124 <option value=\"consumption\">Spotřeba
125 <option value=\"internet\">Internet
126 <option value=\"contribution\" selected>Příspěvek";
127
128 endif;
129 echo "
130
131 <tr><form method=post action=\"?page=admin_finance_modify&q=1\"> <input type=hidden name=id value='$id'>
132 <td align=\"center\">".$date."</td>
133 <td align=\"center\"><input type=text name=money value=".$row["Money"]." size=4></td>
134 <td align=\"left\"><select name=operace>$option</select><input type=text name=popis value='".$row["Description"]."'></td>
135 <td align=\"center\"><input type=text name=odmena value='".$row["Odmena"]."'></td>
136 <td align=\"center\" valign=\"middle\"><input type=hidden name=id value='$id'><input type=submit value='Upravit'></td>
137 </form> </tr>
138 ";
139 endif;
140 }
141 echo "</table>";
142
143 } else {
144 echo"<p align=center><font color=red><b>Nemáte dostatečná oprávnění pro tuto akci!</b></font>";
145 echo"<meta http-equiv=\"refresh\" content=\"3;url=?page=main\">";
146 }
147 ?>
Note: See TracBrowser for help on using the repository browser.