could someone help me or provide me a script on download.php? so people cannot see the actual link of the file they are downloading like download.php?id=1231213 or download.php?rel=12... i am clueless with php
download.php?id=1231231.....etc
Started by takz, May 26 2005 07:12 PM
4 replies to this topic
#1
Posted 26 May 2005 - 07:12 PM
#2
Posted 27 May 2005 - 10:08 AM
Assuming you have access to phpMyAdmin
Run the following query:
Add your download url to the dlurl feild.
Add the following code to download.php
The download url can be access by http://domain.com/download.php?id=1234
Run the following query:
CREATE TABLE dow ( id INT NOT NULL AUTO_INCREMENT, dlurl TEXT, PRIMARY KEY(id) );
Add your download url to the dlurl feild.
Add the following code to download.php
The download url can be access by http://domain.com/download.php?id=1234
<?php
//output buffer
ob_start();
$id = $_GET['id'];
$res = mysql_query('SELECT COUNT(*) FROM download WHERE id = '.$id);
$exists = mysql_fetch_row($res);
if($exists[0] > 0)
{
$query=mysql_query("SELECT * FROM download WHERE id='$id'");
while ($r = mysql_fetch_array($query))
{
$dlurl = stripslashes($row["dlurl"]);
header("Location: $dlurl");
//flush output buffer
ob_end_flush();
}
}
else
{
echo"Please enter a valid id!";
}
?>
#3
Posted 27 May 2005 - 10:25 AM
so would it be like this?
CREATE TABLE dow (
id INT NOT NULL AUTO_INCREMENT,
dlurl www.domain.com/sgdsgs.zip,
PRIMARY KEY(id)
);
and would i have to do this same process over again for another download url?
sorry i am a big time php nooby =(
CREATE TABLE dow (
id INT NOT NULL AUTO_INCREMENT,
dlurl www.domain.com/sgdsgs.zip,
PRIMARY KEY(id)
);
and would i have to do this same process over again for another download url?
sorry i am a big time php nooby =(
#4
Posted 27 May 2005 - 11:19 AM
No, that's wrong.
Here is a script you can add a download with.
Save this as adddl.php
Here is a script you can add a download with.
Save this as adddl.php
<?
//connect to database
$cid = mysql_connect(localhost,dbuser,dbpasswd);
mysql_select_db(dbname);
if (mysql_error()) { print "Database ERROR: " . mysql_error(); }
?>
<?
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
# escape data and set variables
$id = addslashes($_POST["id"]);
$dlurl = addslashes($_POST["dlurl"]);
//setup SQL statement
$sql = " INSERT INTO dow ";
$sql .= " (id, dlurl) VALUES ";
$sql .= " ('$id','$dlurl') ";
//execute SQL statement
$result = mysql_query($sql, $cid);
//check for error
if (mysql_error()) { print "Database ERROR: " . mysql_error(); }
else
{
print "<p><b>Download Added!</b></p>\n";
}
?>
<?php
echo'<form name="dl" action="adddl.php" method="POST">
<table>
<tr><td><b>Download URL: </b>
</td><td><input type="text" name="dlurl" size=20 class="input"></td></tr>
<tr><th colspan=2><p><input type="submit" value="Add Download"></p></th></tr>
</table>
</form>';
}
?>
#5
Posted 27 May 2005 - 05:51 PM
could you tell me from the beginning what i have to do..like when i go in phpadmin what do i do to the end.. thanks..sorry im a nub
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
