Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

php refferer script

Featured Replies

I have a client selling an e-book and he is not expecting huge downloads but still wants protection...

 

The system Im settin up is a simple --- domain.com -- paypal payment --- return user to download page

 

What I want help with is writing some php to go in the download page that means it is only accessible if someone accesses it via paypal/ a referrer - As in people cannot pass around the download link easily... I have also suggested more trivial means like changing the link of the download page once every month or so etc

 

help?

The code to get a referrers url

 

$ref=getenv("HTTP_REFERER");

 

In terms of changing the URL, how about just changing the id of the page instead. So the URL might look like this the first month:

 

http:// www.domain.com/ Download.php?id=12345

 

And then might look like this the second month:

 

http:// www.domain.com/ Download.php?id=54321

 

And then if you combine that with mod_rewrite you could rewrite the urls like this:

 

1st Month: http:// www.domain.com/ Download/12345.php

2nd Month: http:// www.domain.com/ Download/54321.php

 

Edit: Spaces added to URLs to remove auto linking.

The best solution would be to use Paypal IPN (Instant Payment Notification) that way you could email or force the download only after a successful payment.

 

IPN can be a challenge to get your head around but it's certainly the best way to go if you are using Paypal.

 

Edit: Just thought I would give a bit more detail. Paypal posts back to you after a payment is made and there are ways for you to check and confirm a valid payment. After checking, you would serve up the download!

You can fake the details supplied from PHP's $_SERVER['HTTP_REFERER'] variable.

 

Why don't you use a .htaccess file in the directory, and do something with the {HTTP_REFERER} variable in there instead? A quick Google search has brought up loads of results for info on how to set it up.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.