| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Registered User
Join Date: Jun 2006
Posts: 44
|
Sending PHP email when link clicked
Another little php question... I know how to send an email via php, however I would like to know how I can go about getting an email sent to me when a user clicks a particular download link on a website to tell me what files have been downloaded and roughly when. Any help much appreciated. |
|
|
|
|
|
#2 (permalink) |
|
Everything is fine.
|
You'd need to set up some form of redirection script that does the following: 1) Pulls in the filename of the download that the user is requesting 2) Sends out an e-mail with the filename and time/date stamp 3) Redirects the user to the physical file so they can download it For example, your link may look something like: download.php?file=siteTemplate.zip I'm sure there are plenty of free scripts that do this available at places such as hotscripts.com. Or if you wanted to do it yourself then it shouldn't be too hard. Just look in to sending e-mail via PHP and then issue the redirect() header. - Mike |
|
|
|
#3 (permalink) |
|
Registered User
Join Date: Jun 2006
Posts: 44
|
I had considered redirecting and using a query string as you suggest, but as there will be a list of download links I don't really want to move away from that page. Currently when the link is clicked, the download (open/save etc) box appears straight away and the download page remains in the background. My idea was to simply get it to fire off an email at the same time. Although... having said that, could I redirect back to the same page and process the query string with a php script which sends out the email and starts the download process? |
|
|
|
#4 (permalink) | |
|
Everything is fine.
|
Quote:
- Mike |
|
|
|
|
#6 (permalink) | |
|
Everything is fine.
|
Quote:
So if you download link is "/downloads/someData.zip" you would change it to "download.php?file=/downloads/someData.zip" where the "file" variable is now telling the php script where to send the user in the redirect() after the e-mail has been sent. - Mike |
|
|
![]() |