Changeset 113 for db/index.php
- Timestamp:
- Oct 27, 2007, 10:23:13 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
db/index.php
r109 r113 4 4 if( !empty($session_id) ){ $session = $session_id; }; 5 5 6 /* =========== Security =========== */ 7 if( isset($_GET['Database']) OR isset($_POST['Database']) ){ unset($_GET['Database']); unset($_POST['Database']); }; 8 if( isset($_GET['DB_read']) OR isset($_POST['DB_read']) ){ unset($_GET['DB_read']); unset($_POST['DB_read']); }; 9 if( isset($_GET['Menu']) OR isset($_POST['Menu']) ){ unset($_GET['Menu']); unset($_POST['Menu']); }; 10 if( isset($_GET['text']) OR isset($_POST['text']) ){ unset($_GET['text']); unset($_POST['text']); }; 11 $klic=array_keys($_POST); 12 for ($i=0;$i<=count($klic)-1;$i++) { 13 $_POST[$klic[$i]]=addslashes($_POST[$klic[$i]]); 14 }; 15 $klic=array_keys($_GET); 16 for ($i=0;$i<=count($klic)-1;$i++) { 17 $_GET[$klic[$i]]=addslashes($_GET[$klic[$i]]); 18 }; 19 6 20 /* =========== Config aj. =========== */ 7 21 require_once "./config.php"; 8 22 require_once "./check_database.php"; 23 require_once "./functions.php"; 24 $databaseR = new CheckDatabaseArray(); 9 25 10 26 /* =========== Připojení k Databázi =========== */ … … 13 29 14 30 /* =========== Login / Logout =========== */ 15 @mysql_select_db($Config['DB_read']['DB_read']['Database_realmd']) 16 OR DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_realmd']."!</p>"); 17 @mysql_query("SET CHARACTER SET utf8"); 31 SwitchDB(2); // nastavení databáze na realmd 18 32 19 33 if( !empty($_POST['username']) AND !empty($_POST['pass']) ){ … … 27 41 $login_info = @MySQL_Fetch_Array($sql_user); 28 42 29 @mysql_select_db($Config['DB_read']['DB_read']['Database_web']) 30 OR DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_web']."!</p>"); 31 @mysql_query("SET CHARACTER SET utf8"); 43 SwitchDB(3); // nastavení databáze na web 32 44 33 45 $sql_active_id_dotaz = @mysql_query("SELECT * FROM `acc_online` WHERE `nick`='".$login_info['username']."' LIMIT 1"); … … 54 66 }; 55 67 56 @mysql_select_db($Config['DB_read']['DB_read']['Database_web']) 57 OR DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_web']."!</p>"); 58 @mysql_query("SET CHARACTER SET utf8"); 68 SwitchDB(3); // nastavení databáze na web 59 69 60 70 if( $_GET['id'] == "logout" ){ … … 147 157 $Menu = array_merge($Menu, $Menu_add); 148 158 149 /* =========== Speciální FCE =========== */150 function DelNl($str){151 $str = @str_replace("\n","",$str);152 $str = @str_replace("\r","",$str);153 return $str;154 };155 156 function AbsCheck($int){ return (abs($int)==$int)? true : false; };157 158 function CheckQuestRace(){159 160 return true;161 };162 163 function StranovaniVypisu($sql, $limit, $nastranu, $adresa, $SID){164 global $text;165 $pocet_radku = @mysql_num_rows(mysql_query($sql));166 if( $pocet_radku > 0 ) {167 $listovani = $pocet_radku/10;168 $listovani = ceil($listovani);169 $listovani = $listovani/($nastranu/10);170 $listovani = ceil($listovani);171 172 if( $listovani == 1 ){173 $navigace = "<< < <b>1</b> > >>";174 }175 elseif( $listovani > 1 ){176 $predchozi = $limit-1;177 $dalsi = $limit+1;178 $posledni = $listovani;179 if( $predchozi < 1 ){ $predchozi = 1; };180 181 if( $listovani <= 10 ){182 for( $i=1; ($i<=10)AND($i<=$listovani) ;$i++ ){183 if($i==$limit){$navigace['cisla'] .= " <b title=\"".$text['navigation']['onpage'].$text['navigation']['number']." $i\">".$i."</b>\n";}184 else{$navigace['cisla'] .= " <a href=\"index.php".$adresa."&list=".$i.$SID."\" title=\"".$text['navigation']['page'].$text['navigation']['number']." $i\">".$i."</a>\n";};185 };186 187 $navigace['zacatek'] = "<a href=\"index.php".$adresa."&list=1".$SID."\" title=\"".$text['navigation']['start']."\"><<</a>"." ";188 $navigace['zacatek'] .= "<a href=\"index.php".$adresa."&list=".$predchozi.$SID."\" title=\"".$text['navigation']['previous']."\"><</a> ";189 $navigace['konec'] = " <a href=\"index.php".$adresa."&list=".$dalsi.$SID."\" title=\"".$text['navigation']['next']."\">></a>"." ";190 $navigace['konec'] .= "<a href=\"index.php".$adresa."&list=".$posledni.$SID."\" title=\"".$text['navigation']['end']."\">>></a>";191 192 if( $limit == 1 ){ $navigace['zacatek'] = "<<"." < "; };193 if( $limit == $listovani ){ $navigace['konec'] = " > >>"; };194 }195 else{196 if( $limit <= 6 ){197 for( $i=1; ($i<=10) ;$i++ ){198 if($i==$limit){$navigace['cisla'] .= " <b title=\"".$text['navigation']['onpage'].$text['navigation']['number']." $i\">".$i."</b>\n";}199 else{$navigace['cisla'] .= " <a href=\"index.php".$adresa."&list=".$i.$SID."\" title=\"".$text['navigation']['page'].$text['navigation']['number']." $i\">".$i."</a>\n";};200 }; $navigace['cisla'] .= " ... ";201 }202 elseif( $limit >= 6 AND (($limit+6) <= $listovani) ){203 $navigace['cisla'] .= " ... ";204 205 for( $i=$limit-5; ($i<=$limit+5) ;$i++ ){206 207 if($i==$limit){$navigace['cisla'] .= " <b title=\"".$text['navigation']['onpage'].$text['navigation']['number']." $i\">".$i."</b>\n";}208 else{$navigace['cisla'] .= " <a href=\"index.php".$adresa."&list=".$i.$SID."\" title=\"".$text['navigation']['page'].$text['navigation']['number']." $i\">".$i."</a>\n";};209 210 }; $navigace['cisla'] .= " ... ";211 }212 elseif( ($limit+6) >= $listovani ){213 $navigace['cisla'] .= " ... ";214 for( $i=$listovani-10; ($i<=$listovani) ;$i++ ){215 if($i==$limit){$navigace['cisla'] .= " <b title=\"".$text['navigation']['onpage'].$text['navigation']['number']." $i\">".$i."</b>\n";}216 else{$navigace['cisla'] .= " <a href=\"index.php".$adresa."&list=".$i.$SID."\" title=\"".$text['navigation']['page'].$text['navigation']['number']." $i\">".$i."</a>\n";};217 };218 };219 220 $navigace['zacatek'] = "<a href=\"index.php".$adresa."&list=1".$SID."\" title=\"".$text['navigation']['start']."\"><<</a>"." ";221 $navigace['zacatek'] .= "<a href=\"index.php".$adresa."&list=".$predchozi.$SID."\" title=\"".$text['navigation']['previous']."\"><</a> ";222 $navigace['konec'] = " <a href=\"index.php".$adresa."&list=".$dalsi.$SID."\" title=\"".$text['navigation']['next']."\">></a>"." ";223 $navigace['konec'] .= "<a href=\"index.php".$adresa."&list=".$posledni.$SID."\" title=\"".$text['navigation']['end']."\">>></a>";224 225 226 if( $limit == 1 ){ $navigace['zacatek'] = "<<"." < "; };227 if( $limit == $listovani ){ $navigace['konec'] = " > >>"; };228 };229 $navigace = $navigace['zacatek'].$navigace['cisla'].$navigace['konec'];230 };231 232 return $navigace;233 }234 else{ return FALSE; };235 };236 237 function SQLselect_Strankovani($dotaz, $limit, $nastranu, $adresa, $SID){238 $navigace = StranovaniVypisu($dotaz, $limit, $nastranu, $adresa, $SID);239 $dotaz = @mysql_query($dotaz." LIMIT ".(--$limit*10*($nastranu/10)).", $nastranu ");240 $vysledek = array( '1' => $dotaz,241 'strankovani' => $navigace );242 return $vysledek;243 };244 245 function GenerateMenu(){246 global $Menu;247 248 $klice = array_keys($Menu);249 $klice_count = count($klice);250 251 for($i=0; $i <= $klice_count ;$i++){252 if($Menu[$klice[$i]][0] == 1){253 if( $inside_submenu == 1 ){ $Generated_Menu .= " </ul></li>\n"; }254 elseif( !empty($Generated_Menu) ){ $Generated_Menu .= "</li>\n"; } unset($inside_submenu);255 $Generated_Menu .= " <li><a href=\"".$Menu[$klice[$i]][1]."\">".$Menu[$klice[$i]][2]."</a>";256 $submenu = 1;257 }258 elseif($Menu[$klice[$i]][0] == 2){259 if( $submenu == 1 ){ $Generated_Menu .= "<ul>\n"; }; unset($submenu);260 $Generated_Menu .= " <li><a href=\"".$Menu[$klice[$i]][1]."\">".$Menu[$klice[$i]][2]."</a></li>\n";261 $inside_submenu = 1;262 }263 elseif($Menu[$klice[$i]][0] == 3){264 if( $submenu == 1 ){ $Generated_Menu .= "<ul>"; }; unset($submenu);265 $Generated_Menu .= " <li>".$Menu[$klice[$i]][1]."</li>\n";266 $inside_submenu = 1;267 }268 elseif( !empty($Menu[$klice[$i]][0]) AND !empty($Menu[$klice[$i]][1]) AND !empty($Menu[$klice[$i]][2]) ){269 $Generated_Menu .= " <li><a href=\"#\">Chyba !!</a>"; }270 else{ $Generated_Menu .= " </ul></li>\n"; };271 };272 273 return $Generated_Menu;274 };275 276 159 /* =========== END_TOP =========== */ 277 160 $vlozeni_souboru = "OK"; … … 300 183 301 184 /* =========== Výchozí databáze =========== */ 302 @mysql_select_db($Config['DB_read']['DB_read']['Database_mangos']) 303 OR DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_mangos']."!</p>"); 304 @mysql_query("SET CHARACTER SET utf8"); 185 SwitchDB(1); // nastavení databáze na mangos 186 187 switch($id){ 188 case 'character': $general_include = "./character.php"; break; 189 default: $general_include = "./hlavni.php"; break; 190 }; 305 191 306 192 /* =========== Vložení základního souboru =========== */ … … 308 194 309 195 require_once "./post_read.php"; 310 require_once "./hlavni.php"; 311 196 $BasicWiewer = new BasicWiewer(); 197 $BasicWiewer->setPage($id,$SID); 198 199 require_once $general_include; 312 200 313 201 mysql_close(); // odpojíme se od databáze
Note:
See TracChangeset
for help on using the changeset viewer.