Changeset 4
- Timestamp:
- Nov 26, 2008, 9:56:46 PM (16 years ago)
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
config.sample.php
r2 r4 12 12 'Charset' => 'utf-8', 13 13 'BaseURL' => '', 14 'webpass' => '', 14 15 ); 15 16 -
frontend.php
r3 r4 12 12 function show_mass() { 13 13 global $database; 14 $Query = $database->select('mass', '*' );14 $Query = $database->select('mass', '*', 'time > now()'); 15 15 while($DbRow = $Query->fetch_array()) 16 16 { … … 18 18 } 19 19 } 20 21 function show_login() { 22 echo '<form action="?admin" method="post">'.GIF_PASS.'<input name="pass"></form>'; 23 } 24 25 function show_upload_mass() { 26 echo UPLOAD_MASS.'<form action="?admin" method="post"> 27 '.GIF_DATE.' <input name="date"><br> 28 '.GIF_FILE.' <input name="file" type="file"><br> 29 <input value="Uložit" type="submit"> 30 </form>'; 31 } 32 33 function save_file() { 34 if (array_key_exists('date',$_POST) ) { 35 if (is_uploaded_file($_FILES['file']['tmp_name'])) { 36 echo "Soubor ". $_FILES['file']['name'] ." Byl nahrán"; 37 $tmp_name = $_FILES["file"]["tmp_name"]; 38 move_uploaded_file($tmp_name, "mass/".$_POSS['date']); 39 } else { 40 echo "Possible file upload attack: "; 41 echo "filename '". $_FILES['file']['tmp_name'] . "'."; 42 } 43 } 44 45 } 20 46 ?> -
global.php
r3 r4 1 1 <?php 2 session_start(); 3 2 4 include('config.php'); 3 5 -
index.php
r3 r4 17 17 echo ROZPIS; 18 18 show_mass(); 19 echo '<br><br>'; 20 $files = scandir('mass'); 21 for ($i=0;$i<count($files);++$i) { 22 $file = 'mass/'.$files[$i]; 23 if (filetype($file) <> 'dir') echo '<a href="?img='.$file.'"><img width="200" src='.$file.' title="'.FILE_SAVED . date ("m d Y H:i:s.", filemtime($file)).'"></a>'; 24 } 19 25 show_article(3); 20 26 … … 26 32 } else if (array_key_exists('admin',$_GET)) { 27 33 echo ADMIN; 28 show_article(5); 34 if (array_key_exists('pass',$_POST) ) { 35 if ($_POST['pass'] == $Config['webpass']) { 36 $_SESSION['pass'] = $_POST['pass']; 37 } else { 38 echo BAD_PASS; 39 } 40 } 41 if (isset($_SESSION['pass'])) { 42 if ($_SESSION['pass'] == $Config['webpass']) { 43 //administrátorská část 44 show_upload_mass(); //nahrání rozpisu 45 save_file(); 46 show_article(5); 47 } 48 } else { 49 show_login(); 50 } 51 52 53 } else if (array_key_exists('img',$_GET)) { 54 $file = $_GET['img']; 55 echo '<img width="100%" src='.$file.' title="'."Soubor byl vložen " . date ("m d Y H:i:s.", filemtime($file)).'">'; 29 56 30 57 -
language_cz.php
r3 r4 27 27 define('ADMIN', '<h2>Administrace stránek</h2>'); 28 28 29 30 //message 31 define('BAD_PASS', 'Zadali jste špatné heslo'); 32 define('FILE_SAVED', "Soubor byl vložen "); 33 define('GIF_PASS', ' Zadejte heslo: '); 34 define('GIF_FILE', ' Soubor '); 35 define('GIF_DATE', ' Datum od - do '); 36 define('UPLOAD_MASS', ' <b>Nahrání rozpisu mší</b> '); 29 37 ?>
Note:
See TracChangeset
for help on using the changeset viewer.