Pass Session Variable to WE in php

I have a php script that passes a session variable to another php script with reads the value to see if the user has paid, Yes or No.

I know I could do it in the url but then that exposes it to the user.

Of course the other option is to use cookies, which I have never used in favor of session variables.

Thanks

Sessions in PHP are not the same as Sessions in the web framework. In PHP, they are stored on disk and accessed with a cookie. In the web framework, all of that is stored in memory. You’ll need to either pass the actual values or write some code in your app to parse the php session files.

[quote=119495:@Richard Albrecht]I have a php script that passes a session variable to another php script with reads the value to see if the user has paid, Yes or No.

I know I could do it in the url but then that exposes it to the user.

Of course the other option is to use cookies, which I have never used in favor of session variables.[/quote]

To communicate between php or Perl and WE, I simply use a text file that the Web app opens and look what is inside. That way I control the format of data the way I want and the user never sees anything.

Are you wanting to direct focus from the payment script to the web-application or are you trying to just notify the web-application that the user has paid?

You can notify the web-application from PHP by making a request to the SpecialHandler

<?php $user = "whatever username is"; $item= "item# or whatever"; $paid = file_get_contents("http://webapplicationdomain.com:8080/special/paiditem?user=".$user."&item=".$item); Do a php if statement to test the webapplication output ?>

Otherwise, it’s probably best practices to store the customer purchase details in a database from PHP, then read the database from the web-application.

[quote=119502:@Matthew Combatti]Are you wanting to direct focus from the payment script to the web-application or are you trying to just notify the web-application that the user has paid?

You can notify the web-application from PHP by making a request to the SpecialHandler

<?php $user = "whatever username is"; $item= "item# or whatever"; $paid = file_get_contents("http://webapplicationdomain.com:8080/special/paiditem?user=".$user."&item=".$item); Do a php if statement to test the webapplication output ?>

Otherwise, it’s probably best practices to store the customer purchase details in a database from PHP, then read the database from the web-application.[/quote]
If youre going to do that, please add some sort of private hash to the url so it cant be called by just anyone.