Jump to content

Recommended Posts

Hello, Everyone

I am trying to use the below code to create a path to a file and then download it.  I need to do this because the users will enter in a keycode in the webaddress that will query an sql database to find out what they need to download and then generate a path to the file.

 

<?php

 

$myServer = "XXX.XXX.XXX.XXX";

$myUser = "XXXX";

$myPass = "XXXXXXX";

$myDB = "esolinker";

 

 

$keycode = $_GET['downIT'];

 

//connection to the database

$dbhandle = mysql_connect($myServer, $myUser, $myPass)

  or die("Couldn't connect to server, please contact TCM technical support.");

 

//select a database to work with

$selected = mysql_select_db($myDB, $dbhandle)

  or die("Couldn't open database, please contact TCM technical support.");

 

//declare the SQL statement that will query the database

 

$query = "SELECT account,agency,linkkey,user,computer,peach,folder,custexe,custlink,downdate ";

$query .= "FROM downlinks ";

$query .= "WHERE linkkey ='";

$query .= $keycode;

$query .= "'";

 

//execute the SQL query and return records

$result = mysql_query($query);

 

//display the query...

echo $query;

 

//display the results

while($row = mysql_fetch_array($result))

{

  echo "<li>" . $row["account"] . $row["agency"] . $row["linkkey"] . $row["user"] . $row["computer"] . $row["peach"] . $row["folder"] . $row["custexe"] . $row["custlink"] . $row["downdate"] . "</li>";

 

}

 

 

//close the connection

mysql_close($dbhandle);

 

?>

 

what the above will do is create a link such as http://www.mycompany.com/$row["folder"]/$row["custexe"]

 

I need to somehow pass this information on to another PHP script

 

 

<?php

 

header("Pragma: public");

header("Expires: 0");

header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

 

header("Content-Type: application/force-download");

 

header( "Content-Disposition: attachment; filename=custom.exe");

 

header( "Content-Description: File Transfer");

 

?>

 

 

I am a newbie and would appreciate any help you can provide.

Thanks in advance

~Ken

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.