Click to See Complete Forum and Search --> : Random Download URL Expires???
anoluck
07-14-2007, 07:48 PM
Well I want to be able to hide my downloadable files
And use MD5 to hide the files
When the users click it they have a certain tim limit before it expires
Like the one showns Here (http://forums.devshed.com/showpost.php?p=159331&postcount=2)
For some reason the script keep giving me an error im kind if a newb
Can someone be very detail thx
CrazyMerlin
07-15-2007, 12:23 AM
it helps if you post what error you are getting.
thanks
anoluck
07-15-2007, 01:11 AM
I Dont know why its not going through and it keeps saying
File is not accessible. when i want to see test.php
File: see.php
<?php
$dbhost = 'localhost';
$dbuser = 'MyUserName';
$dbpass = 'MyPassWord';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'example';
mysql_select_db($dbname);
$sSecretCode = 232323;
$sFileName = 'test.php';
$iValidSecs = '30';
if (mysql_query("INSERT INTO tblCodes SET code='$sSecretCode',
filename='$sFileName',expires=(NOW() + $iValidSecs)")) {
// Code was added to database
$sLink = "http://anoluck.com/file.php?c=$sSecretCode&n=$sFileName";
echo "The link to the file is: <A HREF=\"$sLink\">$sLink</A>";
} else {
// Code was not added
echo "There was an error setting up your link.";
}
// Use this file access as a trigger to clean out tblCodes
$rslt = mysql_query("DELETE FROM tblCodes WHERE expires<NOW()");
?>
File: file.php
<?php
$dbhost = 'localhost';
$dbuser = 'MyUserName';
$dbpass = 'MyPassWord';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'example';
mysql_select_db($dbname);
$c = $HTTP_GET_VARS["c"];
$n = $HTTP_GET_VARS["n"];
// Use this file access as a trigger to clean out tblCodes
$rslt = mysql_query("DELETE FROM tblCodes WHERE expires<NOW()");
$sSQL = "SELECT * FROM tblCodes WHERE code='" . addslashes($c)
. "' AND filename='" . addslashes($n) . "' AND expires>=NOW()";
if ($rslt = mysql_query($sSQL)) {
if (mysql_num_rows($rslt) > 0) {
// valid code for file
// DELETE CODE (allow only one access of the file)
$rslt = mysql_query("DELETE FROM tblCodes WHERE code='" . addslashes($c)
. "' AND filename='" . addslashes($n) . "'");
// Take the user to the file:
header("Location: http://anoluck.com/filedir/" . addslashes($n));
} else {
echo "File is not accessible.";
}
} else {
echo "Error attempting to access file.";
}
?>
Serpentmike
07-18-2007, 08:20 PM
Is this by any chance the master of fox and the shine spike? Defeater of the Falco spike and the shield grab?
anoluck
07-19-2007, 12:16 AM
Is this by any chance the master of fox and the shine spike? Defeater of the Falco spike and the shield grab?
its sure is!!!! :D