Important alert: (current site time 8/2/2014 2:11:46 AM EDT)
 

article

secure & privacy download to authorized person or members ~ PART 5/6/7/8/9

Email
Submitted on: 6/1/2011 11:38:31 AM
By: eSanshar  
Level: Advanced
User Rating: By 1 Users
Compatibility: PHP 3.0, PHP 4.0, PHP 5.0
Views: 4721
author picture
(About the author)
 
     

this article for those who want to develop Security & Privacy Download any files to authorized person or members...............

Make your files secure download

Make your download folder secure

Make download link secure.............visitors Or members may keeps & share your download links for future download thousand's time same link from unauthorized place & sites.

So keep safe your download link & safe your bandwidth.

DO encrypt in md5 to every download links

Keep tracking your download links.

Only allow to authorize persons or your members..............etc


much more were have in this tutorials & articles share my knowledge's with yours I hope you like it. :)

Powered by technicguy [ eSanshar IT Experts ]
A complete IT Solutions & services



 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
  1. You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
				

Part: 5

  1. ADD Requested to store secure links into database

    <?php include_once('db.php');

    $file=$_GET['file'];
    $name=$_GET['name'];
    $size=$_GET['size'];
    $user=$mysite_username;

    $hits="1";

    $datetime = date("Y-m-d") ." : ". date("H:i:s A");

    if (getenv(HTTP_X_FORWARDED_FOR)) {
    $ip = getenv(HTTP_X_FORWARDED_FOR);
    } else {
    $ip = getenv(REMOTE_ADDR);
    }



    $sql="SELECT * FROM download WHERE f_file='". $file ."'";
    $result = mysql_query($sql);

    if(mysql_num_rows($result) >0) {

    while($row = mysql_fetch_array($result)) {

    echo "Already Exists in DataBase <span class='error'>". $row['f_name'] ."</span>";

    }

    } else {

    mysql_select_db("my_db", $con);
    $sql="INSERT INTO download (f_file, f_name, f_size, f_user, f_mby, f_dmby, f_hits, f_ip, f_date)VALUES('$file','$name','$size','$user','$user','$datetime','$hits','$ip','$datetime')";

    if (!mysql_query($sql,$con)){
    die('Error: ' . mysql_error());
    }
    echo "Successfully Added new File : <span class='error'>". $files ."</span>";

    header("Location:index.php?axn=upload");

    }

    mysql_close($con);


    ?>

Part: 6

  1. DELETE  Requested secure links from database

    <?php include_once('db.php');

    $file=$_GET['file'];
    $id=$_GET['id'];


    $queryDel = "DELETE from download WHERE no='$id' && f_file='$file' ";
    $result = mysql_query($queryDel) or die("ERROR");
    echo "<span class='error'>Sucessfully Deleted File</span>";


    header("Location:index.php?axn=upload");



    ?>

Part: 7

  1. DOWNLOAD files lists from database

<?php
include_once('db.php');
$sqlAll= mysql_query("SELECT * FROM download ORDER BY no");

$_SESSION['download_file']="true";

while($files= mysql_fetch_array($sqlAll))
{
echo "<li><b>Download : </b><tt>:".$files['f_size'] . "</tt><br>&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<a href='".$seo."download&file=".$files['f_file']."&id=".$files['no']."' >".$files['f_name'] . "</a></li>";
}


?>
 

Part: 8

  1. Permission to download files & download Tracking

<?php include_once('db.php');

$file=$_GET['file'];
$id=$_GET['id'];


$datetime= date("Y-m-d") ." : ". date("H:i:s A");
if (getenv(HTTP_X_FORWARDED_FOR)) {
$ip = getenv(HTTP_X_FORWARDED_FOR);
} else {
$ip = getenv(REMOTE_ADDR);
}


if($_SESSION['download_file']=="true"){
$sql="SELECT * FROM download WHERE f_file='". $file ."' && no='". $id ."' ";
$result = mysql_query($sql);

while($row = mysql_fetch_array($result)) {

$filedown=$row['f_name'];
$filehits=$row['f_hits'];

if ($filehits==""){
$hits=1;
}else{
$hits= $filehits+1;
}


$trackDownload="UPDATE download SET f_hits='$hits', f_ddate='$datetime', f_ip='$ip' WHERE no='$id'";
$result = mysql_query($trackDownload) or die("ERROR");


$file="download/".$filedown;
header("Content-type: application/force-download");
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($file));
header("Content-disposition: attachment; filename=\"".basename($file)."\"");
readfile("$file");

}

}
?>

Part: 9

  1. Create index.php file

    <?php
    $do = $_GET['axn'];
    switch ($do){

    case "download":
    if(($_GET['file']!='') && ($_GET['id']!='')){
    require('download_ok.php');
    }
    require("download.php");
    break;

    case "upload":
    require("upload.php");
    break;

    default:
    require("details.php");

    break;
    }

    ?>

Powered by technicguy [ eSanshar IT Experts ]
A complete IT Solutions & services


Other 7 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Advanced category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.