function VypisZam($SQL) { global $kod; if(DB_select($SQL, $vystup, $pocet)) { while($zaznam=MySQL_fetch_array($vystup)) { echo "<tr class=\"tabulka\" id=\"tabulka\" onMouseOver=\"styl();\" onMouseOut=\"styl();\">"; echo " <td width=\"30%\"> </td>"; echo " <td width=\"60\"><input type=\"checkbox\" name=smaz[] value=\"".$zaznam["login"]."\"> ".$zaznam["zkratka"]."</td>"; echo "<td>".Sestav_jmeno($zaznam["titul_pred"], $zaznam["jmeno"], $zaznam["prijmeni"],$zaznam["titul_za"]); echo "</td></tr>"; } } }
function show_search_results() { global $user, $config, $keyword, $search_mode, $page_name; #santize sql keyword in case anyone reads xkcd... $keyword = mysql_real_escape_string($keyword); #perform the search #full text search in boolean mode #$sql = "SELECT * from files where MATCH(path, file) AGAINST('$keyword' in boolean mode)"; #<<----- orignal search command $sql = 'SELECT DISTINCT ' . $config[dbfiles] . '.ip, ' . $config[dbhosts] . '.name, ' . $config[dbhosts] . '.online, path, file, size, MATCH(path, file) AGAINST("' . $keyword . '") AS relevance FROM ' . $config[dbfiles] . ' JOIN ' . $config[dbhosts] . ' ON ' . $config[dbhosts] . '.ip = ' . $config[dbfiles] . '.ip WHERE MATCH(path, file) AGAINST("' . $keyword . '" IN BOOLEAN MODE)'; #add file type filters if requested #video needs to be bigger than 1MB, this eliminates most spurious results. I don't think a filesize filter can be applied to music though without #adverse effects if ($search_mode == 'video') { $sql = $sql . ' AND (file LIKE "%.avi" OR file LIKE "%.mpg" OR file LIKE "%.mpeg" OR file LIKE "%.ogm" OR file LIKE "%.wmv" OR file LIKE "%.mkv" OR file LIKE "%.mp4" OR file LIKE "%.ogg" OR file LIKE "%.ogv") AND (size > 1000000)'; } if ($search_mode == 'music') { $sql = $sql . ' AND (file LIKE "%.mp3" OR file LIKE "%.ogg" OR file LIKE "%.aac" OR file LIKE "%.mp4" OR file LIKE "%.wav" OR file LIKE "%.flac" OR file LIKE "%.m4a" OR file LIKE "%.oga")'; } if ($search_mode == 'documents') { $sql = $sql . ' AND (file LIKE "%.doc" OR file LIKE "%.xls" OR file LIKE "%.ppt" OR file LIKE "%.pdf" OR file LIKE "%.odt" OR file LIKE "%.txt" OR file LIKE "%.rtf" OR file LIKE "%.ods" OR file LIKE "%.odp")'; } if ($search_mode == 'disk_images') { $sql = $sql . ' AND (file LIKE "%.iso" OR file LIKE "%.bin" OR file LIKE "%.cue" OR file LIKE "%.vdi" OR file LIKE "%.vhd" OR file LIKE "%.wim" OR file LIKE "%.ima" OR file LIKE "%.img")'; } #remove nuisance files (thumbs.db, .lnk files, etc.) #I doubt anyone wants to look for these #add another condition if theres a type of usless file that's spoiling search results #we have to be careful not to make this too strict though as there is no intuitive option to disable it yet if ($_GET['spamfilter']) { $sql = $sql . ' AND (file NOT LIKE "%.db" AND file NOT LIKE "%.ini" AND file NOT LIKE "%.dll" AND file NOT LIKE "%.lnk" AND file NOT LIKE "%.scf" AND file NOT LIKE "%.DS_Store%" AND file NOT LIKE ".directory" AND file NOT LIKE "folder.jpg" AND file NOT LIKE "AlbumArt_%" AND file NOT LIKE "AlbumArtSmall.jpg" )'; } #order the results with preferance for online hosts #then by relevance $sql = $sql . ' ORDER BY (' . $config[dbhosts] . '.online = 1) DESC, relevance DESC'; #dispaly all films on network if this is requested. have moved this after the order by line as having it before causes errors (relevance DESC is #meaningless as this query string doesn't have a relevance variable) if ($search_mode == 'all_films') { $sql = 'SELECT DISTINCT ' . $config[dbfiles] . '.ip, ' . $config[dbhosts] . '.name, ' . $config[dbhosts] . '.online, path, file, size FROM ' . $config[dbfiles] . ' JOIN ' . $config[dbhosts] . ' ON ' . $config[dbhosts] . '.ip = ' . $config[dbfiles] . '.ip WHERE (size > 600000000) AND (file LIKE "%.avi" OR file LIKE "%.mpg" OR file LIKE "%.mpeg" OR file LIKE "%.ogm" OR file LIKE "%.wmv" OR file LIKE "%.mkv" OR file LIKE "%.mp4" OR file LIKE "%.ogg" OR file LIKE "%.ogv") ORDER BY (' . $config[dbhosts] . '.online = 0), (' . $config[dbfiles] . '.file) '; #online then offline, each alphabetical } if ($search_mode == 'extension') { $sql = 'SELECT DISTINCT ' . $config[dbfiles] . '.ip, ' . $config[dbhosts] . '.name, ' . $config[dbhosts] . '.online, path, file, size FROM ' . $config[dbfiles] . ' JOIN ' . $config[dbhosts] . ' ON ' . $config[dbhosts] . '.ip = ' . $config[dbfiles] . '.ip WHERE (file LIKE "%.' . $keyword . '") ORDER BY (' . $config[dbhosts] . '.online = 0), (' . $config[dbfiles] . '.file) '; #online then offline, each alphabetical } if ($search_mode == 'show_my_files') { $sql = 'SELECT DISTINCT ' . $config[dbfiles] . '.ip, ' . $config[dbhosts] . '.name, ' . $config[dbhosts] . '.online, path, file, size FROM ' . $config[dbfiles] . ' JOIN ' . $config[dbhosts] . ' ON ' . $config[dbhosts] . '.ip = ' . $config[dbfiles] . '.ip WHERE ' . $config[dbfiles] . '.ip like "' . $user->info[ip] . '"'; } #send query to mysql $res = MySQL_query($sql); ?> <?php if (mysql_num_rows($res) > 0) { if ($search_mode != 'show_my_files') { if ($user->can_use_site == false) { echo '<a href="wiki/index.php?title=Sharing">Share</a> your files to activate these links<br><br>'; } if ($user->can_use_site == true and $user->can_see_computers == false) { echo '<a href="wiki/index.php?title=Sharing">Share</a> your files to see the computer names<br><br>'; } } } ?> <table> <tr> <td align="left"><b>File</b></td> <td align="center"><b>Computer</b></td> <td align="center"><b>Size (MB)</b></td> </tr> <?php #put the results into a table, with clickable links for each file $table_row_number = 0; while ($row = MySQL_fetch_array($res)) { #colour the table rows alternately, and grey out offline computers $online_status = $row['online'] ? 'online' : 'offline'; $even_or_odd = $table_row_number % 2 ? 'even' : 'odd'; $class = 'class = "' . $online_status . '_' . $even_or_odd . '"'; if (eregi("windows", $_SERVER['HTTP_USER_AGENT'])) { $file_link = 'file://///' . $row['ip'] . '\\' . str_replace('/', '\\', $row['path']) . '\\'; $computer_link = 'file://///' . $row['ip'] . '/'; } else { $file_link = 'smb://' . $row['ip'] . '/' . $row['path'] . '/'; $computer_link = 'smb://' . $row['ip'] . '/'; } echo "<tr {$class} >"; #link to file echo '<td>'; if ($user->can_use_site or $search_mode == 'show_my_files') { echo '<a class=' . $online_status . ' href="' . $file_link . '">' . $row['file'] . '</a>'; } else { echo $row['file']; } echo '</td>'; #link to computer echo '<td align="center">'; if ($user->can_use_site and $user->can_see_computers or $search_mode == 'show_my_files') { echo '<a class=' . $online_status . ' href="' . $computer_link . '">' . $row['name'] . '</a>'; } else { echo '?'; } echo '</td>'; #size of file echo '<td align="center">'; echo round($row['size'] / 1000000, 2); echo '</td>'; echo '</tr>'; #produce readable HTML by having a new line here echo "\r\n"; #increment row count $table_row_number++; } echo '</table>'; #show the number of files if (mysql_num_rows($res) == 0) { echo '<h3 align="center">'; echo '0 files found'; echo '</h3>'; } }
echo "<td><a class=\"vzkaz\" href=\"./vzkazy_vedeni.php?kod=$kod&id_vzkazu=".$zaz["id_vzkazu"]."\">".Datum($zaz["datum"])."</a></td>"; echo "</tr>"; $i++; } echo "</table>"; } else echo Text_alter("","Nemáte ¾ádné zprávy."); } else { $SQL = "select * from vzkazy v, skupiny s, ucitele u where v.id = '$id_vzkazu' and s.id = v.id_skup_odesilatel and u.login = v.login_uc"; if(DB_select($SQL, $vystup, $pocet)) { echo "<table>"; echo "<tr><td><a href=\"./vzkazy_vedeni.php?kod=$kod\"><img src=\"./images/sipka.gif\" border=none></a></td></tr>"; if($zaz = MySQL_fetch_array($vystup)) { echo "<TR><td colspan=2> </td></tr>"; echo "<tr><td width=\"150\"><b>Odesílatel:</b></td><td>".$zaz["jmeno"]." ".$zaz["prijmeni"].", ".$zaz["skupina"]."</td></tr>"; echo "<tr><td width=\"150\"><b>Pro tøídy/skupiny:</b></td><td>".Text_alter($zaz["trida"], "neuvedeno")."</td></tr>"; echo "<tr><td width=\"150\"><b>Pøedmìt:</b></td><td>".Text_alter($zaz["predmet"], "neuvedeno")."</td></tr>"; echo "<tr><td colspan=2> </td></tr><tr><td colspan=2><i>".Text_alter($zaz["text"], "zpráva neobsahuje ¾ádný text")."</i></td></tr></table>"; echo "<P>"; } } } Konec(); } ?>
function Uloz_uziv($login, $fullname, $id_skup, $prava, &$kod) { global $REMOTE_ADDR; $log = "log_uloz.txt"; VytvorLog($log); srand((double)microtime()*1e6); $kod = "$login|$id_skup|".rand(); ZapisDoLogu($log, "kod=$kod"); $cas = date("Y-m-d H:i:s"); /*$SQL = "delete from prihl_uziv where ip='$REMOTE_ADDR' and kod<>'$kod' "; DB_exec($SQL);*/ $SQL = "select count(*) pocet from prihl_uziv where login_uc = '$login'"; DB_select($SQL, $vystup, $zaznamu); $zaznam = MySQL_fetch_array($vystup); if ($zaznam["pocet"]==0) { $SQL = "insert into prihl_uziv(kod, ip, fullname, cas, login_uc, skupina, prava) values ('$kod', '$REMOTE_ADDR', '$fullname', '$cas', '$login', '$id_skup', '$prava')"; } else { $SQL = "update prihl_uziv set kod='$kod', ip='$REMOTE_ADDR', fullname='$fullname', cas='$cas', skupina='$id_skup' where login_uc='$login' "; } DB_exec($SQL); $cas = time()+3600*24*365; /*echo "kod = $kod"; echo "cas = $cas";*/ }
?> <?php include 'common.php'; $sql = 'SELECT author, message, time, ip FROM ' . $config[dbwall] . ' ORDER BY time DESC LIMIT 40'; $wall = MySQL_query($sql); ?> <rss version="2.0"> <channel> <?php echo "\r\n"; echo '<title>' . $config[website_name] . '</title>'; echo '<link>' . $config[web_address] . '</link>'; echo '<description>Feed for comments on the ' . $config[website_name] . ' wall</description>'; echo "\r\n"; while ($row = MySQL_fetch_array($wall)) { echo '<item>'; echo '<title>' . safe_html($row['author']) . '</title>'; echo '<link> ' . $config[web_address] . '</link>'; echo '<description>' . safe_html(stripslashes($row['message'])) . '</description>'; echo '</item>'; echo "\r\n"; } ?> </channel> </rss>
if ($il_record['admin'] == 0) { echo "<button type='submit' style='border-color:red;background-color:red;' class='btn-block btn-large' onclick='gestadm(" . $il_record['id_utente'] . ");'>" . $il_record['username'] . "</button>"; } else { echo "<button type='submit'style='border-color:green;background-color:green;' class='btn-block btn-large' onclick='gestadm(" . $il_record['id_utente'] . ");'>" . $il_record['username'] . "</button>"; } } echo '<input id="campoutente" type="hidden" name="usradmin" placeholder="Nome utente"/>'; } else { echo "<h1 style='text-align:center; color:white;'>Password errata</h1><br/>"; echo "<script>cambia_stato(7)</script>"; die; } echo '</div>'; break; case 14: while ($il_record = MySQL_fetch_array($tutto_il_recordset)) { if ($il_record['id_utente'] == $_POST['usradmin']) { if ($il_record['username'] == 'cortinovis') { echo "<h1 style='text-align:center; color:white;'>Non puoi togliere l'amministratore supremo</h1><br/>"; echo "<script>cambia_stato(7)</script>"; die; } else { if ($il_record['username'] == $_SESSION['usr']) { $_SESSION['admin'] = 0; } $controllaadmin = $il_record['admin']; } } } if ($controllaadmin == 0) { $sql = "update utenti set admin=1 where id_utente=" . $_POST['usradmin'];
echo "<tr><td><a href=\"./vzkazy_editace.php?kod=$kod\"><img src=\"./images/sipka.gif\" border=none><P></P></a></td></tr>"; echo "<tr><td colspan=3><b><".c_font.">Pøíjemce zprávy (roèník):</font></b>"; echo "<br><font color=gray><small>- zvolíte-li <i>uèitel</i>, zpráva se zobrazí i øediteli, zástupcùm a administrátorùm<br>"; echo "- jednotlivé skupiny mají pøednost pøed volbou <i>v¹ichni</i> i <i>v¹ichni studenti</i></li></small></font></td></tr>"; $SQL = "select * from skupiny where id<100 order by id"; DB_select($SQL, $vystup, $pocet); $i=0; while($zaznam = MySQL_fetch_array($vystup)) { $skup[$i] = new Cskupina($zaznam["id"], $zaznam["skupina"]); $i++; } for($i=0;$i<count($skup);$i++) $checked[$i] = ""; $SQL = "select id_skup from vzkazy_skupiny where id_vzkaz = '$id_vzkazu'"; DB_select($SQL, $vystup, $pocet); while($zaznam = MySQL_fetch_array($vystup)) for($i=0; $i<count($skup); $i++) if($skup[$i]->id==$zaznam["id_skup"]) $checked[$i] = " checked"; echo "<tr><td><br><input type=\"checkbox\" name=\"vsichni[]\" value=\"".$skup[0]->id."\" ".$checked[0].">".$skup[0]->skupina; echo "<br><input type=\"checkbox\" name=\"vsichni_studenti[]\" value=\"".$skup[1]->id."\" ".$checked[1].">".$skup[1]->skupina."</td></tr>"; echo "<tr><td colspan=3><hr></td></tr>"; echo "<tr><td valign=\"top\">"; for($i=2; $i<count($skup); $i++) { if((($i-2)%9)==0 and $i<>2) { echo "</td><td valign=\"top\">"; echo "<input type=\"checkbox\" name=\"prijemce[]\" value=\"".$skup[$i]->id."\" ".$checked[$i].">".$skup[$i]->skupina; } else if($i==2) echo "<input type=\"checkbox\" name=\"prijemce[]\" value=\"".$skup[$i]->id."\" ".$checked[$i].">".$skup[$i]->skupina; else echo "<br><input type=\"checkbox\" name=\"prijemce[]\" value=\"".$skup[$i]->id."\" ".$checked[$i].">".$skup[$i]->skupina;
exit; } else { header("Location:stu.php"); exit; } } if (isset($_SESSION['login']) && $_SESSION['login'] === true) { go(); } if (!empty($user) && !empty($pass)) { $con = mysql_connect("localhost", "root", "vawait"); mysql_select_db("db", $con); $sql = "select * from user where number = '{$user}'"; echo $sql; $result = mysql_query($sql, $con); $row = MySQL_fetch_array($result); if ($row && $pass == $row['pass']) { $_SESSION['user'] = $user; $_SESSION['login'] = true; $_SESSION['state'] = $row['state']; go(); } } ?> <!DOCTYPE html> <html lang="en"> <head>
echo '</form>'; echo '</tr>'; echo '</table><br><br>'; if ($con = mysql_connect($dbhost, $dbuser, $dbpass)) { mysql_select_db($dbname); $query = mysql_query('SELECT * FROM users'); echo '<table border=1>'; echo '<tr>'; echo '<td colspan=4 bgcolor="#666666"><b><center>Current users</center></b></td>'; echo '</tr><tr>'; echo '<td><b><center>Auth Name</center></b></td>'; echo '<td><b><center>Auth Pass</center></b></td>'; echo '<td><b><center>Day, Date, Time, GMT offset</center></b></td>'; echo '<td width=400><b><center>Comments</center></b></td>'; echo '</tr>'; while ($array = MySQL_fetch_array($query)) { echo '<tr>'; echo '<td><center><a href=user.php?user='******'>' . $array[username] . '</a></center></td>'; echo '<td><center>' . $array[password] . '</center></td>'; echo '<td><center>' . $array[rdate] . '</center></td>'; echo '<td><center>' . $array[comments] . '</center></td>'; echo '</tr>'; } echo '</table>'; } else { echo 'Error!'; } echo "<br>"; echo '</center>'; echo '</body>'; echo '</html>';
function VypisZamSprav($SQL) { global $kod; if(DB_select($SQL, $vystup, $pocet)) { while($zaznam=MySQL_fetch_array($vystup)) { echo "<tr class=\"tabulka\" id=\"tabulka\" onMouseOver=\"styl();\" onMouseOut=\"styl();\"><td width=\"30%\"> </td><td width=\"50\"><a class=\"seznam_black\" href=\"./ucitele.php?kod=$kod&ucitel=".$zaznam["login"]."\">".$zaznam["zkratka"]."</a></td><td> <a class=\"seznam\" href=\"./ucitele.php?kod=$kod&ucitel=".$zaznam["login"]."\">". Sestav_jmeno($zaznam["titul_pred"], $zaznam["jmeno"], $zaznam["prijmeni"],$zaznam["titul_za"])." </a>(".$zaznam["skupina"].")</td></tr>"; } } }
function User() { global $config; $remote_ip = $_SERVER['REMOTE_ADDR']; if ($config['fake_ip']) { if (!$config['admin_ip'] or $remote_ip != $config['admin_ip']) { echo "You are not allowed to use this site, set your ip as admin_ip in the config file"; exit; } $remote_ip = $config['fake_ip']; } $sql = 'SELECT * from ' . $config[dbhosts] . ' where ip like "' . $remote_ip . '";'; $query = MySQL_query($sql); $this->info = MySQL_fetch_array($query); #so $user->info gives a list of the sql line for this user #perhaps insert user into hosts $sql = 'select count(*) from ' . $config[dbhosts] . ' where ip like "' . $this->info[ip] . '";'; $query = MySQL_query($sql); $result = MySQL_fetch_array($query); if ($result['count(*)'] == 0) { $sql = 'insert into ' . $config[dbhosts] . ' (ip) values("' . $this->info[ip] . '");'; $query = MySQL_query($sql); } $this->can_see_computers = false; $this->can_use_site = false; global $show_results; global $search_mode; if ($show_results == true and $search_mode != 'show_my_files') { $this->change_hitcount(); } #check permissions $this->check_permissions(); #must be called after change_hitcount() }
function next_tah() { $q = MySQL_query("UPDATE hra_udaje SET cislo=(cislo+1) WHERE meno='stavhry';"); $q = MySQL_query("SELECT stav FROM hra_wedr WHERE meno='aktualne';"); $wedr = MySQL_result($q, 0); $mojew = getwedrpole($wedr); $f_sused = $mojew[0]; //1; $f_1 = $mojew[1]; //1.5; $f_obrana = $mojew[2]; //1; $f_utok = $mojew[3]; //2; $f_stit = $mojew[4]; //3; $poc = rand(1, 6); if ($poc == 1) { $wedr = 'jasno'; } elseif ($poc == 2) { $wedr = 'polo'; } elseif ($poc == 3) { $wedr = 'blesk'; } elseif ($poc == 4) { $wedr = 'sneh'; } elseif ($poc == 5) { $wedr = 'dazd'; } elseif ($poc == 6) { $wedr = 'hmla'; } else { $wedr = 'jasno'; } // zmarime zmenu pocasia - ma byt iba apokalipsa (fire) //$q=MySQL_query("UPDATE hra_wedr SET stav='".$wedr."' WHERE meno='aktualne';"); //$q=MySQL_query("UPDATE hra_wedr SET stav='Už je noc a ty ešte furt hráš?' WHERE meno='noc'"); //$q=MySQL_query("DELETE FROM hra_pm WHERE stav=1 AND komu!=-1"); $q = MySQL_query("UPDATE hra_pm SET stav=2 WHERE stav=1 AND komu!=-1;"); $q = MySQL_query("UPDATE hra_pm SET stav=1 WHERE stav=0;"); // ZABA SA MNOZI $q = MySQL_query("SELECT * FROM hra_akcie WHERE typ='zaba';"); while ($zaba = MySQL_fetch_array($q)) { $zaby[] = array($zaba['x'], $zaba['y']); } foreach ($zaby as $zaba) { zaba_rozsir($zaba[0] + 1, $zaba[1]); zaba_rozsir($zaba[0] - 1, $zaba[1]); zaba_rozsir($zaba[0], $zaba[1] + 1); zaba_rozsir($zaba[0], $zaba[1] - 1); zaba_apply($zaba[0], $zaba[1]); } $q = MySQL_query("DELETE FROM hra_oznamy;"); // zmazeme oznamy $q = MySQL_query("SELECT * FROM hra_akcie WHERE typ='doby' ORDER BY RAND();"); while ($doby = MySQL_fetch_array($q)) { $x = $doby['x']; $y = $doby['y']; $hracat = $doby['hrac']; $q2 = MySQL_query("SELECT hrac FROM hra_teren WHERE x=" . $x . " AND y=" . $y . ";"); $hracob = MySQL_result($q2, 0); // obranca $q2 = MySQL_query("SELECT COUNT(*) FROM hra_teren WHERE hrac=" . $hracat . " AND (ABS(x-" . $x . ")+ABS(y-" . $y . "))<2;"); $susedov_at = MySQL_result($q2, 0); $q2 = MySQL_query("SELECT COUNT(*) FROM hra_teren WHERE hrac=" . $hracob . " AND (ABS(x-" . $x . ")+ABS(y-" . $y . "))<2;"); $susedov_ob = MySQL_result($q2, 0); if ($hracob == 0) { $susedov_ob = 2; } $q2 = MySQL_query("SELECT COUNT(*) FROM hra_akcie WHERE typ='obran' AND x=" . $x . " AND y=" . $y . ";"); $obstit = MySQL_result($q2, 0); $utocnik = $f_sused * $susedov_at + $f_1 + $f_utok; $obranca = $f_sused * $susedov_ob + $f_1 + $f_obrana + $f_stit * $obstit; $q2 = MySQL_query("SELECT COUNT(*) FROM hra_akcie WHERE typ='nehaj' AND x=" . $x . " AND y=" . $y . ";"); if (MySQL_result($q2, 0) == 1) { $obranca = 0; //delete prenechat $q2 = MySQL_query("DELETE FROM hra_akcie WHERE typ='nehaj' AND x=" . $x . " AND y=" . $y . ";"); } $q2 = MySQL_query("SELECT meno FROM hra_hrac WHERE id={$hracat};"); $meno_at = MySQL_result($q2, 0); if ($hracob == 0) { $meno_ob = 'Barbari'; } else { $q2 = MySQL_query("SELECT meno FROM hra_hrac WHERE id={$hracob};"); $meno_ob = MySQL_result($q2, 0); } //if ($meno_at=='vyr') {$utocnik = $utocnik + 2;} //if ($meno_ob=='vyr') {$obranca = $obranca + 2;} $imghrd = '<img src="blog/ico_hrad.png" style="float: left; margin-right: 5px;" />'; $imghrdl = '<img src="blog/ico_hrad-sedy.png" style="float: left; margin-right: 5px;" />'; $imgbtk = '<img src="blog/ico_bitka.png" style="float: left; margin-right: 5px;" />'; $imgbtkl = '<img src="blog/ico_bitka-sedy.png" style="float: left; margin-right: 5px;" />'; $brclb = '<br style="clear: both" />'; //arnendilova sprava pre kolo 150. $imggear = '<img src="blog/ico_gear.png" style="float: left; margin-right: 5px;" />'; oznam(15, "{$imggear} Tvoji vedci rozobrali hrdzavých golemov natretých načerveno a po dlhom bádaní úspešne objavili technológiu lodnej skrutky. Research complete. {$brclb}"); if (verzus($utocnik, $obranca)) { $q2 = MySQL_query("DELETE FROM hra_akcie WHERE x={$x} AND y={$y} AND hrac={$hracat};"); $q2 = MySQL_query("DELETE FROM hra_akcie WHERE x={$x} AND y={$y} AND hrac={$hracob};"); $uz = "[{$x},{$y}]"; $koho = $kohop[$x . '-' . $y]; // OZNAM DOBYL SI UZEMIE/DOBYLITI if ($dobyl[$x . '-' . $y] == 1) { oznam($hracat, "{$imgbtk} Využil si pobojového zmätku a oslabenie vojsk po boji s hráčom {$koho} a lsťou si vzal uzemie {$uz} dobyvateľovi {$meno_ob} {$brclb}"); oznam($hracob, "{$imghrdl} Hráč {$meno_at} využil oslabenie vojsk po boji a zradou ti vzal novonadobudnuté uzemie {$uz} {$brclb}"); } elseif ($dobyl[$x . '-' . $y] == 2) { oznam($hracat, "{$imgbtk} {$meno_ob} síce stihol odvrátiť útok hráča {$koho}, no územie {$uz} už nápor tvojích vojsk vydržať nedokázalo {$brclb}"); oznam($hracob, "{$imghrdl} Ubránil si sa útoku hráča {$koho}, no keď už bol útok odrazený, {$meno_at} dokončil jeho prácu a zabral ti územie {$uz} {$brclb}"); } else { if ($obranca == 0) { oznam($hracat, "{$imgbtk} Hráč {$meno_ob} ti dobrovoľne podstúpil územie {$uz} {$brclb}"); oznam($hracob, "{$imghrdl} Hráč {$meno_at} si vzal ponúkané územie {$uz} {$brclb}"); } else { oznam($hracat, "{$imgbtk} Dobyl si územie {$uz} od hráča {$meno_ob} {$brclb}"); oznam($hracob, "{$imghrdl} Hráč {$meno_at} ti dobyl územie {$uz} {$brclb}"); } } $q2 = MySQL_query("UPDATE hra_teren SET hrac=" . $hracat . " WHERE x=" . $x . " AND y=" . $y . " AND hrac=" . $hracob . ";"); $dobyl[$x . '-' . $y] = 1; $kohop[$x . '-' . $y] = $meno_ob; } else { $q2 = MySQL_query("DELETE FROM hra_akcie WHERE x={$x} AND y={$y} AND hrac={$hracat};"); $q2 = MySQL_query("DELETE FROM hra_akcie WHERE x={$x} AND y={$y} AND hrac={$hracob};"); $uz = "[{$x},{$y}]"; $koho = $kohop[$x . '-' . $y]; // OZNAM OCHRANIL SI UZEMIE/NEDOBYL if ($dobyl[$x . '-' . $y] == 1) { oznam($hracat, "{$imgbtkl} Hráč {$meno_ob} si svoje novo nadobudnuté územie {$uz} uchránil. {$brclb}"); oznam($hracob, "{$imghrd} Prítomnosť armády zabránila hráčovi {$meno_at} aby nám vzal naše nové územie {$uz} {$brclb}"); } elseif ($dobyl[$x . '-' . $y] == 2) { oznam($hracat, "{$imgbtkl} Hráč {$meno_ob} zrejme stráži územie {$uz} ako oko v hlave. Dobyť sa ho nepodarilo hráčovi {$koho}, ubránilo sa i proti tebe. {$brclb}"); oznam($hracob, "{$imghrd} Naše ťažko chránené územie {$uz} vydržalo nápor už druhého vojska - od hráča {$meno_at} {$brclb}"); } else { oznam($hracat, "{$imgbtkl} Nepodarilo sa ti dobyť územie {$uz} od hráča {$meno_ob} {$brclb}"); oznam($hracob, "{$imghrd} Podarilo sa ti ubrániť územie {$uz} pred hráčom {$meno_at} {$brclb}"); } $dobyl[$x . '-' . $y] = 2; $kohop[$x . '-' . $y] = $meno_at; } } $brclb = '<br style="clear: both" />'; $imgptp = '<img src="blog/ico_potop.png" style="float: left; margin-right: 5px;" />'; $q = MySQL_query("SELECT * FROM hra_akcie WHERE typ='potop';"); while ($pt = MySQL_fetch_array($q)) { //hrac typ x y $uz = "[" . $pt['x'] . "," . $pt['y'] . "]"; $qp = MySQL_query("UPDATE hra_teren SET hrac=0, teren=0 WHERE x=" . $pt['x'] . " AND y=" . $pt['y'] . ";"); $qhr = MySQL_query("SELECT * FROM hra_hrac;"); while ($fhr = MySQL_fetch_array($qhr)) { oznam($fhr['id'], "{$imgptp} Voda sa zdvihla a pohltila územie {$uz} do svojich spárov {$brclb}"); } } $q = MySQL_query("DELETE FROM hra_akcie WHERE typ<>'zaba';"); // zmazeme akcie }
function VypisZam($SQL) { global $kod; if(DB_select($SQL, $vystup, $pocet)) { while($zaznam=MySQL_fetch_array($vystup)) { $aktivni_text = ""; if($zaznam["aktivni"]=="0") $aktivni_text = " (doèasnì na ¹kole nepracuje)"; echo "<tr class=\"tabulka\" id=\"tabulka\" onMouseOver=\"styl();\" onMouseOut=\"styl();\"><td width=\"30%\"> </td><td width=\"50\"><a class=\"seznam_black\" href=\"./ucitele.php?kod=$kod&ucitel=".$zaznam["login"]."\">".$zaznam["zkratka"]."</a></td><td> <a class=\"seznam\" href=\"./ucitele_udaje_admin.php?kod=$kod&ucitel=".$zaznam["login"]."\">". Sestav_jmeno($zaznam["titul_pred"], $zaznam["jmeno"], $zaznam["prijmeni"],$zaznam["titul_za"])."</a></td><TD>".Text_alter("", $aktivni_text)."</TD></tr>"; } } }
echo "<form action=\"./soubory_send.php?kod=$kod\" method=post enctype=\"multipart/form-data\"><table>"; echo "<tr><td colspan=3><b><".c_font.">Skupiny u¾ivatelù, kterým je soubor urèen (roèník):</font></b>"; echo "<br><font color=gray><small>- zvolíte-li <i>uèitel</i>, soubor se zobrazí i øediteli, zástupcùm a administrátorùm"; echo "<br>- jednotlivé skupiny mají pøednost pøed volbou <i>v¹ichni</i> i <i>v¹ichni studenti</i>"; echo "<br>- podobnì <i>v¹ichni studenti</i> má pøednost pøed volbou <i>v¹ichni</i>"; echo "<br>- nezvolíte-li ¾ádnou skupinu, bude soubor viditelný v¹em</li></small></font></td></tr>"; $SQL = "select * from skupiny where id<100 order by id"; DB_select($SQL, $vystup, $pocet); $i=0; while($zaznam = MySQL_fetch_array($vystup)) { $skup[$i] = new Cskupina($zaznam["id"], $zaznam["skupina"]); $i++; } $SQL = "select count(*) pocet from skupiny where id<20"; if(DB_select($SQL, $vystup, $pocet)) $zaznam = MySQL_fetch_array($vystup); $zaklad = $zaznam["pocet"]-2; echo "<tr><td><br><input type=\"checkbox\" name=\"vsichni[]\" value=\"".$skup[0]->id."\">".$skup[0]->skupina; echo "<br><input type=\"checkbox\" name=\"vsichni_studenti[]\" value=\"".$skup[1]->id."\">".$skup[1]->skupina."</td></tr>"; echo "<tr><td colspan=3><hr></td></tr>"; echo "<tr><td valign=\"top\">"; for($i=2; $i<count($skup); $i++) { if((($i-2)%$zaklad)==0 and $i<>2) { echo "</td><td valign=\"top\">"; echo "<input type=\"checkbox\" name=\"prijemce[]\" value=\"".$skup[$i]->id."\">".$skup[$i]->skupina; } else if($i==2) echo "<input type=\"checkbox\" name=\"prijemce[]\" value=\"".$skup[$i]->id."\">".$skup[$i]->skupina; else echo "<br><input type=\"checkbox\" name=\"prijemce[]\" value=\"".$skup[$i]->id."\">".$skup[$i]->skupina; }