Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old December 2nd, 2004, 11:42 AM
.-=Ronin=-. .-=Ronin=-. is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: I live --->Here<---
Posts: 4 .-=Ronin=-. User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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>

Reply With Quote
  #2  
Old December 2nd, 2004, 08:38 PM
Lafinboy's Avatar
Lafinboy Lafinboy is offline
The Laughing Moderator
ASP Free Loyal (3000 - 3499 posts)
 
Join Date: Apr 2004
Location: Sydney, Australia
Posts: 3,267 Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)  Folding Points: 29199 Folding Title: Starter FolderFolding Points: 29199 Folding Title: Starter Folder
Time spent in forums: 2 Weeks 1 Day 10 h 48 m 12 sec
Reputation Power: 15
Send a message via ICQ to Lafinboy Send a message via AIM to Lafinboy Send a message via MSN to Lafinboy Send a message via Yahoo to Lafinboy Send a message via Skype to Lafinboy
The equivalent code using ASP would use the File System Object to change the count value in an existing .txt file, or create a new .txt file with a count value of 1 if the .txt file did not already exist.

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > PHP ---> ASP?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT