download manager question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, i inserted this code that handles downloads in my cms:


<?php
include('inc/config.php'); #db connection... yadayada

$id = $_GET['id']; #this is the ID of the file

if(!is_numeric($id)) {
	header('Location: '.$_SERVER['HTTP_REFERER']);
	die();
}


$sql = 'SELECT * FROM file WHERE id_file = '.q($id);
$rs = &$cnn->Execute($sql);
if (!$rs->EOF) {
	$record = array();
	$record['downloads'] = $rs->fields['downloads']+1;
	$sql = $cnn->GetUpdateSQL($rs, $record);
	$cnn->Execute($sql);
	header('Location: /downloads/'.basename($rs->fields['filename']));
	die();
} else {
	header('Location: '.$_SERVER['HTTP_REFERER']);
	die();
}
?>


Do you guys think it is ok? Any ideas are welcome.
Andres

--
Slds,
Andrés Santos, IIG

*****************************
cel: (593) 9 7026627
http://www.egobits.com
*****************************


PHP Data object relational mapping generator
http://www.metastorage.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux