plik admin/option.adm.php
<?php $katalog = 'theme'; function option_form() { $dir = $katalog.'/'; while (false !== ($entry = $d->read())) { { $fileArray[] = $entry; } } $d->close(); $query = "SELECT * FROM config WHERE cfg='1'"; $title = $r['title']; $footer = $r['footer']; $describe = $r['describe']; $key_word = $r['key_word']; $theme = $r['theme']; echo ' <br> <fieldset> <form action="admin.php?mod=option&action=change" method="POST" name="zmiana"> <legend>Pozostałe ustawienia</legend> <table width="100% align="center"> <tr> <td width="45%" align="right" valign="top" size="30">Tytuł strony</td> <td width="55%" align="left"><input type="text" name="title_" value="'.$title.'"></td> </tr> <tr> <td width="45%" align="right" valign="top" size="30">Stopka strony</td> <td width="55%" align="left"><input type="text" name="footer_" value="'.$footer.'"></td> </tr> <tr> <td width="45%" align="right" valign="top">Słowa kluczowe</td> <td width="55%" align="left"><input type="text" size="30" name="key_word_" value="'.$key_word.'"></td> </tr> <tr> <td width="45%" align="right" valign="top">Opis</td> <td width="55%" align="left"><input type="text" size="30" name="describe_" value="'.$describe.'"></td> </tr> <tr> <td width="45%" align="right" valign="top">Skórka</td> <td width="55%" align="left"> <SELECT name="theme_">'; foreach ($fileArray as $name) { if ($name == $theme) {$e = 'SELECTED';} '<OPTION VALUE="'.$name.'" '.$e.'>'.$name; } '</SELECT></td> </tr> <tr> <td width="45%" align="right" valign="top"></td> <td width="55%" align="left"><input type="submit" value="zmień"></td> </tr> </table> </form> </fieldset> '; } function option_change() { if ($title_ == '' || $key_word_ == '' || $describe_ == '' || $footer_ == '' || $theme_ == '') { exit; } $query = "UPDATE config SET title='$title_', key_word='$key_word_', describe='$describe_', footer='$footer_', theme='$theme_' WHERE cfg='1'"; /*header("Location: admin.php?mod=others"); exit;*/ } ?>
fragment pliku admin.php
<?php if ($_GET['mod']=='option') { include_once('admin/option.adm.php'); option_form(); if($_GET['action']=='change') { option_change(); } } ?>