
December 2nd, 2004, 11:42 AM
|
|
Registered User
|
|
Join Date: Oct 2003
Location: I live --->Here<---
Posts: 4
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
PHP ---> ASP?
Hi there, is it possible to change this to asp please.
As I have asp code in one page and I would like to implement this php as well, but I dont think you can use both in one page can you?
Code:
<?php
#########################################
# Download Counter V0.01 #
# Copyright 2004 Dark Angel #
# Download from: #
# http://www.stateofmind.me.uk #
# Edited by .-=Ronin=-. #
#########################################
$root = "thomh"; // location of the download folder where you keep your downloads.
$fileid = $_GET[fileid]; // The name of the file incuding the text.
$programlocation = $_GET[programlocation]; //The directory for the program downloads.
if ($fileid == "") {
// Check to see if a varable is emtpy and if so, it prints a warning
echo "Sorry but the value is empty";
}else{
// If the varable has a value then the script will continue here
$download = $fileid.".txt";
if (file_exists("dcount/$download")) {
// This is the part that adds a 1 to the total download of the file.
$fp = fopen("dcount/$download", "r") or die("Could not Read $download");
$number = fgets($fp, 1024);
$number ++;
$fp = fopen("dcount/$download", "w") or die("Could not Write to File");
fwrite($fp, "$number");
fclose($fp);
// This is the part that will let the download begin
header("Location: http://".$root."/".$programlocation."/".$fileid);
}else{
// If the txt file does not exist then it is created and then 1 count is added.
touch("dcount/".$fileid.".txt");
if (file_exists("dcount/$download")) {
$fp = fopen("dcount/$download", "w") or die("Could not Write to File");
fwrite($fp, "1");
fclose($fp);
// This is that part that will let the download begin
header("Location: http://".$root."/".$programlocation."/".$fileid);;
}
}
}
?>
And then this as the link...
Code:
<a href="download.php?fileid=yourfile.zip&programlocation=programs&url=/download/test/" target="_blank" onclick="refresh()">yourfile.zip</a>
|