ruạṛ
<?php /** * Manage file * @version 0.10 * @author Robert Urquhart <programmer@activatedesign.co.nz> * @package WEP-CMS * @since KPMG */ session_start(); require_once $_SERVER['DOCUMENT_ROOT'].'/admin/scripts-includes/universal.php'; require_once $_SERVER['DOCUMENT_ROOT'].'/admin/scripts-includes/display.php'; $connID = connect_to_db(); /** * define variables to be passed to header function * @var string $current section of site for navigation menu highlighting * @var string $title page title for browser * @var string $keywords meta keywords * @var string $keywords meta description */ $current = 'files'; $title = 'Administration Panel'; $keywords = ''; $description = ''; /** * buffer then output page */ ob_start(); head($current,$title); this_page(); footer(); ob_end_flush(); /** * clean up and exit script */ exit; /** * function to display content specific to this page * @global int $cust_id */ function this_page() { /** * new or existing file? * @var int $file_id * @var object $file * @var string $h1 * @var string $action * @var string $button */ if(!$file_id = is_numeric_id($_GET['file'],false)) { $file = new file(); if(isset($_SESSION['passback'])) { $file->load_from_data($_SESSION['passback']); unset($_SESSION['passback']); } $button = $h1 = 'Add file'; $field = 'Select file'; $action = 'process-file-new.php'; } else { $file = new file($file_id); //print_r($file); if(!$file->file_id) { echo '<p class="center">File not found.</p>'; return; } $action = 'process-file-edit.php'; $button = 'Update file'; $field = 'Replace file?'; $h1 = 'Edit '.$file->title; } ?> <h1>Update <?php echo $file->name; ?></h1> <?php if($f->file_id): ?> <p>File added <?php echo date('j-M-Y',$f->uploaded); ?></p> <p>File last updated <?php echo date('j-M-Y',$f->updated); ?></p> <p>File downloaded <?php echo $f->downloaded; ?> times</p> <?php endif; ?> <form method="post" action="processes/<?php echo $action; ?>" name="file_edit" id="file_edit" enctype="multipart/form-data" class="edit"> <input name="file_id" id="file_id" type="hidden" value="<?php echo $file->file_id; ?>" /> <div class="mock_table"> <fieldset> <label for="upload_title"><span class="right">File title:</span><span class="left"><input name="upload_title" id="file_title" type="text" value="<?php echo $file->title; ?>" /></span></label> <label for="upload_description"> <span class="right">File description:</span> <span class="left"><textarea name="upload_description" id="upload_description" rows="4" cols="40"><?php echo str_replace(array('\r\n','\n'),"\n",$file->description); ?></textarea></span> </label> <label for="upload"> <span class="right"><?php echo $field; ?></span> <span class="left"><input type="file" name="upload" id="upload" /></span> </label> </fieldset> <p> </p> </div> <!-- end mock_table --> <p class="center"> <input name="submit" id="submit" type="submit" value="<?php echo $button; ?>" /> </p> </form> <p> </p> <?php } ?>
cải xoăn