Path : /var/www/html/main/ap/ebooks/
File Upload :
Current File : /var/www/html/main/ap/ebooks/downloads.php

<?php
/*!
 * Copyright 2014-2017 Anucha Puangpaka
 * Contacts anucha.ppk@icloud.com 062-479-9836
 */

session_start();

error_reporting(E_ALL);
ini_set("display_errors", 0);

include('../../config.php');

if($_GET['nu']==""){
  if(isset($_GET['xid'])){
    $sql = "select * from ap_gallery3 where id='$_GET[xid]'";
    $query = mysqli_query($conn,$sql);
    $rows  = mysqli_fetch_array($query);
    if (empty($rows['downloads'])) { $rows['downloads'] = 0; }
    $c = $rows['downloads']+1;
    mysqli_query($conn,"update ap_gallery3 set downloads='$c' where id='$rows[id]'");

    $gmt_mtime = gmdate('D, d M Y H:i:s', time()) . ' GMT';
    $offset = 3600 * 24;
    $expire = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
    header("Content-type:application/pdf");
    header("Last-Modified: " . $gmt_mtime);
    Header($expire);
    //header("Content-Disposition:attachment;filename='$rows[title].pdf'");
    readfile("$rows[images2]");
  }else{
      echo "<p></p><p>Anucha Puangpaka 062-479-9836 anucha.ppk@icloud.com</p>";
  }
}

include('logs.php');

mysqli_close($conn);
?>