Jump to content

authentic url


contra10

Recommended Posts

I've allowed paypal to redirect to a page after a payment has been made to a particular page. How do i protect that page or find a way so that if the user is logged in he/she can't just type in the url and access the page.

 

My first idea is create a value in sql and one payment is made the redirection page changes that value to "true". But if i can allow a user to pay more than once and the variable is already set to true, wouldn't it cause problems?

Link to comment
Share on other sites

You can do this many ways. Ill just give you some methods.

 

Method 1: Cookies. I dont reccomend this because if a browser dont have cookies enable then it wont work...

 

Method 2: Sessions

Page not allowed to redirect

<?php
session_start();
if($_SESSION['is_redirected'] != true) {
        die("You have to be redirected to this page.");
}
?>

and on the other pages add

<?php
session_start();
if(! isset($_SESSION['is_redirected'])) {
        $_SESSION['is_redirected'] = true;
}
?>

 

Method 3: Check if the referer is empty?

$_SERVER['HTTP_REFERER']

I also don't recommend this way either.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.