|
Posted by toedipper on 07/13/05 02:19
Hello,
php and mysql
I have the code below. It's a mixture of my hand coding and dreamweaver
created code. It's meant to log a download and then start the download.
I can do the first part ok as I can check the db and see that there is
an entry but the download won't start, it just sits there and nothing
downloads.
As well as the main code below I have the first bit at the top in
between the <head> tags on the html section, I am trying to redirect
focus to the $dllink which I've assigned from the select query.
The value of the dllink field which should be assigned to $dllink in my
db is something like
www.somedomain.com/thefile.zip
Thanks,
td.
-- this bit with head tags on page
<? echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"3\"
URL="http://\"$dllink\" >; ?>
-- all code below does the dirty work
<?
session_start();
if ($_SESSION[loggedin] != "yes") {
header("Location: http://127.0.0.1/custlogin.php");
exit; }
require_once('Connections/local.php');
// dreamweaver put this in
if (isset($_GET['swid'])) {
$swid = (get_magic_quotes_gpc()) ? $_GET['swid'] :
addslashes($_GET['swid']);
}
// connection to log download, works ok
mysql_select_db($database_local, $local);
$sql = "INSERT INTO downloads (swid, date, time) VALUES
('$swid',current_date(),current_time())";
$result = mysql_query($sql) or die(mysql_error());
// dreaweaver put this in
$colname_dllink = "1";
if (isset($_GET['swid'])) {
$colname_dllink = (get_magic_quotes_gpc()) ? $_GET['swid'] :
addslashes($_GET['swid']);
}
// connection to grab url of the file which I hope to go to in header tag //
mysql_select_db($database_local, $local);
$query_dllink = sprintf("SELECT dllink FROM software WHERE swid = %s",
$colname_dllink);
$dllink = mysql_query($query_dllink, $local) or die(mysql_error());
$row_dllink = mysql_fetch_assoc($dllink);
$totalRows_dllink = mysql_num_rows($dllink);
?>
Navigation:
[Reply to this message]
|