Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need a script to protect midi files

Status
Not open for further replies.

ffaucher

IS-IT--Management
Jul 31, 2000
102
CA
Hello,
My site contains thousands of midi files. In order to save bandwidth, I would like to find a script, preferably CGI script, that would allow a visitor to listen to a maximum of 5 midi files a day. Any help on that topic would be greatly appreciated.
 
You can use session to keep track of how many times a user dls a file. I have an ASP page that keeps track of how many time a person trys to login to my site. here's an exerpt;
Code:
		[COLOR=red]if session("trys") = 2 [/color]then 
	    Response.write "<p style='color: red; font-weight: bold; text-align: center;'>You will be removed to a terrible place if you fail the next attempt!</p>" 
	end if
	[COLOR=red]if session("trys") = 3 [/color] then 
	    Response.write "<script language='javascript'>top.location.href='[URL unfurl="true"]http://www.microsoft.com'</script>"[/URL]
	end if
and I increment the sesion with each failure to login Code to check db for un/pw, if not successful
Code:
      If UserID <> "" or Password <> "" then     
        If oRs.EOF or oRs.BOF then					   			
 	 varLogin = "unsuccessful"										
		[COLOR=red]  session("trys") = session("trys")+1 [/color]
You can see this in action at I've written the session variable to the screen you will be able to see it flash in the top left corner of the main frame. I hope this is understandable I'm sure you could do the same thing with javascript and cookies.

Glen
 
Session can expire, by just closing hte browser. You should set a cookie instead.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top