Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** files.php **/
- <?php
- session_start();
- if (isset($_SESSION['user'])) {
- require_once('core/header.inc.php');
- require_once('core/menubar.inc.php');
- require_once 'connect.php';
- include_once 'emailLinks.php';
- echo "
- <div id='files'>
- <form name='form' action='' method='POST'>
- <input type='submit' name='email' value='Email links'>
- ";
- if (checkUserLvl('2', $dbh)) {
- echo "
- <input type='submit' name='delete' value='Delete files'>
- <input type='submit' name='invoice' value='Create invoice'>
- ";
- } else {
- echo 'Not allowed';
- }
- echo "
- <table>
- <tr>
- <th><input type='checkbox' id='selectall'></th>
- <th>
- <select name='sel_company' id='sel_company'>
- <option value='all'>All</option>
- <option value='II'>II</option>
- <option value='QI'>QI</option>
- </select>
- </th>
- <th>Date</th>
- <th style='width: 200px;'>Address</th>
- <th>Size</th>
- <th>Job</th>
- <th>Link</th>
- <th>Invoice</th>
- </tr>
- <tr></tr>
- <div id='filelist'>
- </div>
- </table>
- </form>
- </div>
- ";
- require_once('core/footer.inc.php');
- } else {
- header('Location: index.php');
- }
- ?>
- /** filelist.php **/
- <?php
- if (isset($_POST['company'])) {
- require_once 'connect.php';
- if ($_POST['company'] == 'All') {
- $query = $dbh->prepare("SELECT * FROM files ORDER BY company, date");
- $query->execute();
- } else {
- $query = $dbh->prepare("SELECT * FROM files WHERE company=:company ORDER BY date");
- $query->bindParam(':company', $_POST['company']);
- $query->execute();
- }
- foreach ($query as $row) {
- $company = $row['company'];
- $date = date("d/m/y", strtotime($row['date']));
- $address = $row['address'];
- $size = $row['size'];
- $job = $row['job'];
- $md5 = $row['md5'];
- $link = 'download.php?id='.$md5;
- $invoice = $row['invoice'];
- echo "
- <tr>
- <td><input type='checkbox' name='file[]' value='$md5'></td>
- <td class='company'>$company</td>
- <td>$date</td>
- <td>$address</td>
- <td>$size</td>
- <td>$job</td>
- <td><a href='$link'>download</a></td>
- <td>$invoice</td>
- </tr>
- ";
- }
- }
- ?>
- /** files.js **/
- $(document).ready(function() {
- $('#filelist').load('filestable.php').show();
- $('#sel_company').change(function() {
- var sel_company = $(this).val();
- var company = 'company';
- $.post('filestable.php', { company: sel_company },
- function(result) {
- $('#filelist').html(result).show();
- });
- });
- $('#sel_company').change();
- });
Add Comment
Please, Sign In to add comment