Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-14-2007, 09:27 AM   PM User | #1
cfructose
Regular Coder

 
Join Date: Feb 2007
Location: London
Posts: 225
Thanks: 16
Thanked 2 Times in 2 Posts
cfructose is an unknown quantity at this point
securing info visible in 'view source'

I'm trying to prevent users accessing a subscribe form until they've completed a payment through paypal.

My paypal form includes the line:

Code:
<input type="hidden" name="return" value="http://www.mysite.com/subscribe_step_2.php?id=12345&hash=completed=yes"/>
And subscribe_2.php says:

PHP Code:
$payment_received $_GET["completed"];

if (
$payment_received != "yes" && ($include_name == "subscribe_step_2.php" || $include_name == "subscribe_step_3.php")) {
        
//tell them that access is denied and to return to step 1 (paypal)
                
}
                elseif ($
$secure_ka != 1) {        // a variable variable to compare $secure_ka (the $secure variable name as data) with a variable name created from that data (which was already definied as either 0 or 1 in config). Prevents direct access to 'members only' files via URL.
                    //print article
}
                else {    
//the following is printed if direct access to any 'members only' files is attempted through URL
                    //advise that access is restricted, and please buy blah blah blah
                

The trouble is that clicking on 'view source' shows the "completed=yes" that's appended to the return URL upon completion of the paypal payment (and of course, it's visible in the URL, though that's not such a big deal).

How can I secure this?
Any thoughts?

Thanks a lot
cfructose is offline   Reply With Quote
Old 07-14-2007, 09:40 AM   PM User | #2
bazz
Master Coder

 
Join Date: Apr 2003
Location: in my house
Posts: 5,211
Thanks: 39
Thanked 201 Times in 197 Posts
bazz will become famous soon enoughbazz will become famous soon enough
I think you'll be better off if you look into using 'sessions', where such data can be stored in a server cookie for the duration of, well, the session.

bazz
bazz is offline   Reply With Quote
Old 07-14-2007, 10:09 AM   PM User | #3
cfructose
Regular Coder

 
Join Date: Feb 2007
Location: London
Posts: 225
Thanks: 16
Thanked 2 Times in 2 Posts
cfructose is an unknown quantity at this point
Thanx Bazz,

I am using sessions - I just simplified the code for the last post.
cfructose is offline   Reply With Quote
Old 07-14-2007, 10:28 AM   PM User | #4
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
I think you should use Paypal's IPN to get back the data from paypal to be sure the user has actually paid. It returns SUCCESS or FAILED. If SUCCESS then set a session and redirect the user to the form page. On the form page check for the session. If it exists display the form, if not display an error message. A good resource on the subject here. http://www.pdncommunity.com/pdn/boar...message.id=368

Unfortunately the PDT option doesn't support paypal subscriptions.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 07-14-2007, 10:34 AM   PM User | #5
cfructose
Regular Coder

 
Join Date: Feb 2007
Location: London
Posts: 225
Thanks: 16
Thanked 2 Times in 2 Posts
cfructose is an unknown quantity at this point
I searched the paypal site for something like that but didn't find it.
THANK U SO MUCH!!
cfructose is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:39 AM.


Advertisement
Log in to turn off these ads.