1 | 2 | simandl | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | | | <html> |
3 | | | <head> |
4 | | | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"> |
5 | | | <style type="text/css" media="screen"> @import "style.css"; </style> |
6 | | | <title>db.jablonka.cz ebanka</title> |
7 | | | </head> |
8 | | | <link rel="stylesheet" type="text/css" href="style.css"> |
9 | | | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"> |
10 | | | </head> |
11 | | | <body topmargin=0 leftmargin=10> |
12 | | | <? |
13 | | | require('grab_globals.lib.php'); |
14 | | | include ("header.htm"); |
15 | | | include ("fce.php"); |
16 | | | $spojeni = MySQL_Connect($db_host, $db_user, $db_pass); |
17 | | | MySQL_Select_DB($db_name); |
18 | | | |
19 | | | if(!@$action) $action=""; |
20 | | | |
21 | | | ########################################################################################### |
22 | | | ########################################################################################### |
23 | | | if ($action=="") |
24 | | | { |
25 | | | $fp = fopen ("http://www.rb.cz/firemni-finance/transparentni-ucty/?root=firemni-finance&item1=transparentni-ucty&tr_acc=vypis&account_number=2118436001", "r"); |
26 | | | # $fp = fopen ("http://www.ebanka.cz/tran_uct/2118436001.html", "r"); |
27 | | | # $fp = fopen ("http://jabtoc.prosek.czf/ebanka/2118436001.html", "r"); |
28 | | | # $fp = fopen ("http://jabtoc.prosek.czf/ebanka/20070104.html", "r"); |
29 | | | # $fp = fopen ("http://jabtoc.prosek.czf/ebanka/20060810_2118436001.html", "r"); |
30 | | | # $fp = fopen ("http://jabtoc.prosek.czf/ebanka/20060810_2118436001orig.html", "r"); |
31 | | | # $fp = fopen ("http://jabtoc.prosek.czf/ebanka/20060502_2118436001orig.html", "r"); |
32 | | | # $fp = fopen ("http://jabtoc.prosek.czf/ebanka/all.html", "r"); |
33 | | | # $fp = fopen ("http://jabtoc.prosek.czf/ebanka/20060410_2118436001.html", "r"); |
34 | | | if ($fp) { |
35 | | | $message=""; |
36 | | | while (($s =fgets($fp))) { |
37 | | | $message.=$s; |
38 | | | } |
39 | | | fclose($fp); |
40 | | | } |
41 | | | #echo $message; |
42 | | | |
43 | | | #$message=""; |
44 | | | #exec('wget -q -O - http://www.ebanka.cz/tran_uct/2118436001.html -a 10.33.6.3',$vypis); |
45 | | | #foreach($vypis as $s) $message.=$s."\n"; |
46 | | | |
47 | | | #upravy pro stary vypisy z ebanky |
48 | | | # $message=str_replace ("<td", "<TD", $message); |
49 | | | # $message=str_replace (" ALIGN=\"center\" VALIGN=\"middle\" BGCOLOR=\"#FFFFFF\"", "", $message); |
50 | | | |
51 | | | $message=str_replace (" class=\"odd\"", "", $message); |
52 | | | $message=str_replace (" class=\"even\"", "", $message); |
53 | | | $message=str_replace (" class=\"whitel\"", "", $message); |
54 | | | $message=str_replace (" class=\"whitelc\"", "", $message); |
55 | | | $message=str_replace (" class=\"whitep\"", "", $message); |
56 | | | $message=str_replace (" class=\"whtransaction\"", "", $message); |
57 | | | |
58 | | | $message=stristr($message, "<tbody>"); |
59 | | | $message=stristr($message, "<tr>"); |
60 | | | #klasicke ukonceni ale zatim se nepouzije aby se odfiltrovalo to co bylo pred3.1.2007 |
61 | | | # $konec=strpos($message,"</tbody>"); |
62 | | | #odfiltrovani vseho pred 4.1.2007 - uz to je v databazi a tak by to rusilo |
63 | | | $konec=strpos($message,"2007-01-03"); |
64 | | | $message=substr($message,0,$konec-1); |
65 | | | |
66 | | | echo $konec; |
67 | | | echo " : zobrazuje se vse po 2.1.2007 protoze v tu dobu se zmenil vypis z ebanky"; |
68 | | | |
69 | | | #echo $message; |
70 | | | #count se o jednicku zmensi aby se nevypisoval posledni useknuty pohyb |
71 | | | $count=substr_count($message,"<tr>")-1; |
72 | | | |
73 | | | $output=spliti("<tr>",$message); |
74 | | | echo ' |
75 | | | <table width=100% cellspacing=1> |
76 | | | <tr> |
77 | | | <td bgcolor=#73BE1E> |
78 | | | |
79 | | | <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0" WIDTH="100%" HEIGHT="" BGCOLOR="#FFFFFF" align="CENTER"> |
80 | | | <TR> |
81 | | | <td></td> |
82 | | | <TD class=text>DATUM<BR>ČAS</TD> |
83 | | | <TD class=text>POZNÁMKA<BR>NÁZEV ÚČTU<BR>ČÍSLO ÚČTU </TD> |
84 | | | <TD class=text>DATUM ODEPSÁNÍ<BR>VALUTA<BR>TYP</TD> |
85 | | | <TD class=text>VARIABILNÍ SYMBOL<BR>KONSTANTNÍ SYMBOL<BR>SPECIFICKÝ SYMBOL</TD> |
86 | | | <TD class=text>ČÁSTKA</TD> |
87 | | | <TD class=text>POPLATEK<BR>SMĚNA<BR>ZPRÁVA</TD> |
88 | | | <td></td> |
89 | | | </TR></td></tr> |
90 | | | <tr height=2> |
91 | | | <td colspan=8 bgcolor=#000000></td> |
92 | | | </tr>'; |
93 | | | |
94 | | | for ($i=1;$i<=$count;$i++) |
95 | | | { |
96 | | | #posunuti za poradove cislo |
97 | | | #$output[$i]=stristr($output[$i], "</td>"); |
98 | | | |
99 | | | $porovnani=sha1($output[$i]); |
100 | | | |
101 | | | $vysledek=MySQL_Query("SELECT * FROM ekonto WHERE value='$porovnani'"); |
102 | | | $pocet=MySQL_Num_Rows($vysledek); |
103 | | | |
104 | | | if ($pocet==0) |
105 | | | { #jde o novy pohyb na konte |
106 | | | $color="#E7FFF1"; |
107 | | | $msg=str_replace("<td", "<TD valign=top bgcolor=#E7FFF1 class=whitel", $output[$i]); |
108 | | | $msg=str_replace("</tr>", "", $msg); |
109 | | | } |
110 | | | else |
111 | | | { #jde o jiz zapsany pohyb na konte |
112 | | | $color="#e0e0e0"; |
113 | | | $msg=str_replace("<td", "<TD valign=top bgcolor=#e0e0e0 class=whitel", $output[$i]); |
114 | | | $msg=str_replace("</tr>", "", $msg); |
115 | | | } |
116 | | | |
117 | | | echo '<tr><td bgcolor='.$color.'>'.$msg; |
118 | | | |
119 | | | echo '<td bgcolor='.$color.'>'; |
120 | | | if ($pocet==0) |
121 | | | { |
122 | | | echo ' |
123 | | | <form action="ebanka.php?action=synchro" method=POST> |
124 | | | <input name="stuff" type="hidden" value="'.$porovnani.'"> |
125 | | | <input class=field value=" synchronizovat " type="submit"> |
126 | | | </form> |
127 | | | <form action="ebanka.php?action=zapsat&flag=0" method=POST> |
128 | | | <input name="stuff" type="hidden" value="'.$porovnani.'"> |
129 | | | <input name="textik" type="hidden" value="'.$output[$i].'"> |
130 | | | <input class=field value="zapsat transakci" type="submit"> |
131 | | | </form>'; |
132 | | | } |
133 | | | else |
134 | | | { |
135 | | | $vysledek=MySQL_Fetch_Array($vysledek); |
136 | | | if ($vysledek["id"]=="-1") |
137 | | | { |
138 | | | echo ' |
139 | | | <form action="ebanka.php?action=zapsat&flag=1" method=POST> |
140 | | | <input name="stuff" type="hidden" value="'.$porovnani.'"> |
141 | | | <input name="textik" type="hidden" value="'.$output[$i].'"> |
142 | | | <input class=field value="zapsat transakci" type="submit"> |
143 | | | </form> |
144 | | | <form action="ebanka.php?action=reset" method=POST> |
145 | | | <input name="stuff" type="hidden" value="'.$porovnani.'"> |
146 | | | <input class=field value="resetovat zaznam" type="submit"> |
147 | | | </form> |
148 | | | |
149 | | | '; |
150 | | | } |
151 | | | else |
152 | | | { |
153 | | | $iid=$vysledek["id"]; |
154 | | | $tmp=MySQL_Query("SELECT * FROM finance WHERE id='$iid'"); |
155 | | | $tmp=MySQL_Fetch_Array($tmp); |
156 | | | |
157 | | | echo ' |
158 | | | <form action="ebanka.php?action=reset" method=POST> |
159 | | | <input name="stuff" type="hidden" value="'.$porovnani.'"> |
160 | | | <input class=field value="resetovat zaznam" type="submit"> |
161 | | | </form> |
162 | | | </td> |
163 | | | <tr><td bgcolor='.$color.' colspan=8 class=text> |
164 | | | Zapsáno pro: <b>'.id_to_name($tmp["clen"]).'</b> v.s. <b>'.id_to_vs($tmp["clen"]).'</b> dne <b>'.sql2datum($vysledek["datum"]).'</b> |
165 | | | jako <b>'.id_to_platba($tmp["platba"]).'</b> částka: <b>'.$tmp["hodnota"].'</b> |
166 | | | |
167 | | | <a href="clen.php?clen='.$tmp["clen"].'" class=odkaz>zobrazit přehled o uživateli</a> |
168 | | | </tr> |
169 | | | '; |
170 | | | } |
171 | | | } |
172 | | | echo ' |
173 | | | </td></tr> |
174 | | | <tr height=2> |
175 | | | <td colspan=8 bgcolor=#000000></td> |
176 | | | </tr> |
177 | | | '; |
178 | | | } |
179 | | | echo ' |
180 | | | </table> |
181 | | | </td></table> |
182 | | | '; |
183 | | | } |
184 | | | |
185 | | | ########################################################################################### |
186 | | | ########################################################################################### |
187 | | | if ($action=="synchro") |
188 | | | { |
189 | | | #MySQL_Query("INSERT INTO ekonto VALUES ('$stuff','-1','')"); |
190 | | | echo '<br><img src=images/arrow.jpg> Synchronizováno... <a href="ebanka.php" class=odkaz>ZPĚT</a>'; |
191 | | | } |
192 | | | |
193 | | | ########################################################################################### |
194 | | | ########################################################################################### |
195 | | | if ($action=="zapsat") |
196 | | | { |
197 | | | #pokud uz byl tento zaznam ulozen neni dovoleno jeho dalsi uziti |
198 | | | $vysledek=MySQL_Query("SELECT * FROM ekonto WHERE value='$stuff'"); |
199 | | | $pocet=MySQL_Num_Rows($vysledek); |
200 | | | |
201 | | | if ($pocet!=0) |
202 | | | { |
203 | | | echo "V databázi je už záznam s tímto otiskem!<br><br>"; |
204 | | | echo '<img src=images/arrow.jpg> <a href="ebanka.php" class=odkaz>Reload</a> <a href="javascript:history.go(-1)" class=odkaz>zpět</a>'; |
205 | | | } |
206 | | | else |
207 | | | { |
208 | | | |
209 | | | echo ' |
210 | | | <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0" WIDTH="100%" HEIGHT="" BGCOLOR="#FFFFFF" align="CENTER"> |
211 | | | <TR> |
212 | | | <TD class=text>DATUM<BR>ČAS</TD> |
213 | | | <TD class=text>POZNÁMKA<BR>NÁZEV ÚČTU<BR>ČÍSLO ÚČTU </TD> |
214 | | | <TD class=text>DATUM ODEPSÁNÍ<BR>VALUTA<BR>TYP</TD> |
215 | | | <TD class=text>VARIABILNÍ SYMBOL<BR>KONSTANTNÍ SYMBOL<BR>SPECIFICKÝ SYMBOL</TD> |
216 | | | <TD class=text>ČÁSTKA</TD> |
217 | | | <TD class=text>POPLATEK<BR>SMĚNA<BR>ZPRÁVA</TD> |
218 | | | </TR> <tr height=2> |
219 | | | <td colspan=8 bgcolor=#000000></td> |
220 | | | </tr> |
221 | | | '.$textik.' |
222 | | | </table>'; |
223 | | | |
224 | | | #rozdelime radek z vypisu ebanky na jednotliva pole |
225 | | | $sloupce=explode("td", $textik); |
226 | | | |
227 | | | #vyjmeme datum |
228 | | | $datumy=explode("<",$sloupce[1]); |
229 | | | $datum=str_replace (">", "", $datumy[0]); |
230 | | | $datum=str_replace ("\r", "", $datum); |
231 | | | $datum=str_replace ("\n", "", $datum); |
232 | | | $datum=str_replace (" ", "", $datum); |
233 | | | $datum=substr($datum,0,10); |
234 | | | $datum=sql2datum($datum); |
235 | | | #echo "#".$datum."#"; |
236 | | | |
237 | | | #vyjmeme poznamku |
238 | | | $poznamka=str_replace("<","",$sloupce[3]); |
239 | | | $poznamka=str_replace("br/>","",$poznamka); |
240 | | | $poznamka=str_replace(">","",$poznamka); |
241 | | | $poznamka=str_replace("/","",$poznamka); |
242 | | | $poznamka=str_replace(" "," ",$poznamka); |
243 | | | $poznamka=str_replace(" "," ",$poznamka); |
244 | | | $poznamka=str_replace(" "," ",$poznamka); |
245 | | | $poznamka=str_replace(" "," ",$poznamka); |
246 | | | $poznamka=str_replace("^ ","",$poznamka); |
247 | | | |
248 | | | #vyjmeme variabilni symbol |
249 | | | $vsy=explode("<",$sloupce[7]); |
250 | | | $vs=str_replace (">", "", $vsy[0]); |
251 | | | $vs=str_replace (" ", "", $vs); |
252 | | | $vs=str_replace ("\r", "", $vs); |
253 | | | $vs=str_replace ("\n", "", $vs); |
254 | | | #echo "#".$vs."#"; |
255 | | | |
256 | | | #vyjmeme castku |
257 | | | $hodnoty=explode("<",$sloupce[9]); |
258 | | | $hodnota=str_replace ("br />", "", $hodnoty[0]); |
259 | | | $hodnota=str_replace (" ", "", $hodnota); |
260 | | | $hodnota=str_replace (">", "", $hodnota); |
261 | | | $hodnota=str_replace ("\r", "", $hodnota); |
262 | | | $hodnota=str_replace ("\n", "", $hodnota); |
263 | | | #echo "#".$sloupce[9]."#"; |
264 | | | |
265 | | | echo ' |
266 | | | |
267 | | | <form action="ebanka.php?action=zapis" method=POST> |
268 | | | <table> |
269 | | | <tr> |
270 | | | <td> |
271 | | | <b>Člen:</b> |
272 | | | </td> |
273 | | | <td colspan=3> |
274 | | | <select class=field name="clen">'; |
275 | | | #vypis vsech moznosti a predvybrani podle vs |
276 | | | $string=MySQL_Query("SELECT c.id as cid, c.*, i.id as iid, i.* FROM cleni c LEFT JOIN ipecka i ON c.id = i.clen ORDER BY prijmeni"); |
277 | | | while($vysledek=MySQL_Fetch_Array($string)) |
278 | | | { |
279 | | | echo '<option '; if($vs==$vysledek["vs"]){ echo 'selected';} echo' value='.$vysledek["cid"].'>'.$vysledek["prijmeni"]." ".$vysledek["jmeno"]." ".$vysledek["ip"]." ".$vysledek["vs"].'</option>'; |
280 | | | Next($vysledek); |
281 | | | } |
282 | | | echo ' |
283 | | | </select> |
284 | | | <input name="flag" type="hidden" value="'.$flag.'"> |
285 | | | <input name="stuff" type="hidden" value="'.$stuff.'"> |
286 | | | </td> |
287 | | | </tr> |
288 | | | <tr> |
289 | | | <td class=text>Datum:</td><td><input class=field name="datum" type="text" value="'.$datum.'" size=15></td> |
290 | | | <td class=text>Hodnota:</td><td><input class=field name="hodnota" type="text" value="'.$hodnota.'" size=15></td> |
291 | | | </tr> |
292 | | | <tr> |
293 | | | <td class=text>Účtenka:</td><td><input class=field name="uctenka" type="text" value="0" size=15></td> |
294 | | | <td class=text>Pokladna:</td><td> |
295 | | | <select class=field name="pokladna">'; |
296 | | | $dotaz=MySQL_Query("SELECT * from pokladny ORDER BY id"); |
297 | | | $count=MySQL_Num_Rows($dotaz); |
298 | | | $count++; |
299 | | | for ($i=1;$i<$count;$i++) |
300 | | | { |
301 | | | $radek=MySQL_Fetch_Array($dotaz); |
302 | | | echo '<option '; if(3==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>'; |
303 | | | echo ' |
304 | | | '; |
305 | | | Next($string); |
306 | | | } |
307 | | | echo '</select> |
308 | | | </td> |
309 | | | </tr> |
310 | | | <tr> |
311 | | | <td class=text>Typ platby:</td> |
312 | | | <td> |
313 | | | <select class=field name="platba">'; |
314 | | | #vypiseme vsechny dostupne druhy plateb a predvybereme clensky prispevek protoze je nejpravdepodobnejsi |
315 | | | $dotaz=MySQL_Query("SELECT * from platby ORDER BY id"); |
316 | | | $count=MySQL_Num_Rows($dotaz); |
317 | | | $count++; |
318 | | | for ($i=1;$i<$count;$i++) |
319 | | | { |
320 | | | $radek=MySQL_Fetch_Array($dotaz); |
321 | | | echo '<option '; if($i==2){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>'; |
322 | | | echo ' |
323 | | | '; |
324 | | | Next($string); |
325 | | | } |
326 | | | echo '</select> |
327 | | | </td> |
328 | | | <td class=text>Dodavatel:</td> |
329 | | | <td> |
330 | | | <select class=field name="dodavatel">'; |
331 | | | $dotaz=MySQL_Query("SELECT * from dodavatele ORDER BY id"); |
332 | | | $count=MySQL_Num_Rows($dotaz); |
333 | | | $count++; |
334 | | | for ($i=1;$i<$count;$i++) |
335 | | | { |
336 | | | $radek=MySQL_Fetch_Array($dotaz); |
337 | | | echo '<option '; if(@$dodavatel==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>'; |
338 | | | echo ' |
339 | | | '; |
340 | | | Next($string); |
341 | | | } |
342 | | | echo '</select> |
343 | | | </td> |
344 | | | </tr> |
345 | | | <tr> |
346 | | | <td class=text valign=top>Komentář:</td><td colspan=3><textarea class=fieldthin name="komentar" rows=3 cols=45>'.$poznamka.'</textarea></td> |
347 | | | </tr> |
348 | | | </table> |
349 | | | <br><br> |
350 | | | <input class=field type="submit" name="OK" value=" přidat transakci "> |
351 | | | </form> |
352 | | | <img src=images/arrow.jpg> <a href="javascript:history.go(-1)" class=odkaz>zpět</a> |
353 | | | '; |
354 | | | } |
355 | | | } |
356 | | | |
357 | | | ########################################################################################### |
358 | | | ########################################################################################### |
359 | | | if ($action=="zapis") |
360 | | | { |
361 | | | $test=MySQL_Query("SELECT MAX(id) FROM finance"); |
362 | | | $test=MySQL_Fetch_Array($test); |
363 | | | $id=$test["MAX(id)"]; |
364 | | | $id++; |
365 | | | $datum=datum2sql($datum); |
366 | | | $aktualnidatum=date("Y-m-d"); |
367 | | | $pokladna=3; |
368 | | | $dodavatel=0; |
369 | | | $uctenka=0; |
370 | | | MySQL_Query("INSERT INTO finance VALUES ('$id','$clen','$platba','$hodnota','$datum','$komentar','$dodavatel','$uctenka','$pokladna')"); |
371 | | | echo ' |
372 | | | <br><b>Transakce přidána uživateli '.id_to_name($clen).' v této podobě:</b><br> |
373 | | | <br>Datum: '.sql2datum($datum).'<br> |
374 | | | Částka: '.$hodnota.'<br> |
375 | | | Druh platby: '.id_to_platba($platba).'<br> |
376 | | | Poznámka: '.$komentar.' |
377 | | | <br><br> |
378 | | | <img src=images/arrow.jpg> <a href="javascript:history.go(-2)" class=odkaz>zpět</a>'; |
379 | | | if ($flag=="0") |
380 | | | { |
381 | | | MySQL_Query("INSERT INTO ekonto VALUES ('$stuff','$id','$aktualnidatum')"); |
382 | | | } |
383 | | | else |
384 | | | { |
385 | | | MySQL_Query("UPDATE ekonto SET id='$id', datum='aktualnidatum' WHERE value='$stuff'"); |
386 | | | } |
387 | | | |
388 | | | } |
389 | | | |
390 | | | ########################################################################################### |
391 | | | ########################################################################################### |
392 | | | if($action=="reset") |
393 | | | { |
394 | | | echo '<br><br> |
395 | | | Záznam bude resetován do původního stavu. Bude se tedy jevit, jako kdyby byl nový. Transakce v databázi ale zůstane. |
396 | | | Pokud ji budete chtít odstranit, musíte tak učinit ručně! |
397 | | | <br> |
398 | | | <br> |
399 | | | <img src=images/arrow.jpg> <a href="ebanka.php?action=resetOK&stuff='.$stuff.'" class=odkaz>Resetovat</a> |
400 | | | <br> |
401 | | | <br> |
402 | | | <img src=images/arrow.jpg> <a href="ebanka.php" class=odkaz>Zpět</a>'; |
403 | | | } |
404 | | | |
405 | | | ########################################################################################### |
406 | | | ########################################################################################### |
407 | | | if($action=="resetOK") |
408 | | | { |
409 | | | MySQL_Query("DELETE FROM ekonto WHERE value='$stuff'"); |
410 | | | echo '<br><br> |
411 | | | Záznam byl resetován do původního stavu. Bude se tedy jevit, jako kdyby byl nový. Transakce v databázi ale zůstane. Pokud ji chcete odstranit, musíte tak učinit ručně! |
412 | | | <br> |
413 | | | <br> |
414 | | | <img src=images/arrow.jpg> <a href="ebanka.php" class=odkaz>Zpět</a>'; |
415 | | | } |
416 | | | |
417 | | | MySQL_Close($spojeni); |
418 | | | ?> |