From: "jarell" <[EMAIL PROTECTED]>
[snip]Here's my db_update function then your code with some mods:
<?php
function update_db($location) {
require_once('/usr/home/doc/mysqlconnect.php');
$query = "SELECT dl_count FROM downloads WHERE filelocation = '$location'";
$result = mysql_query($query);
$dl_count = mysql_result($result, 0, "dl_count");
$dl_count++;
$update = "UPDATE downloads SET dl_count = '$dl_count' WHERE filelocation = '$location'";
$result = mysql_query($update);
if(!$result) { mysql_close(); die(); }
mysql_close();
}
class onetime { var $fp = FALSE; function stream_open($path, $mode, $options, $opened_path) {
stream_wrapper_register("one","onetime") or die(); readfile("one://$filelocation");
I don't really understand why you're using a custom stream here or what you're hoping to accomplish. you're incrementing the download count, but not really checking it for any limit. It wouldn't really make sense to put the checks in the stream. Check them outside of it and either show an error message in HTML or send the file headers and the data with readfile() and the normal file:// stream.
---John Holmes...
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php