0

I'm a relative newbie at PHP and OOP in general, and I have a questions relating to them.

I have two php files in different folders, in an OOP structured framework. This is the folder structure with their real names:

file1:

garratt/modules/garrattcustom/classes/garrattcustom_module.php

file2a:

garratt/themes/la_boutique_lite/pages/page_pay.php

File 2b:

garratt/themes/la_boutique_lite/pages/page_delayed_payment.php

file1 (garrattcustom_module.php) contains variables which is getting passed to file2a (page_pay.php), and I can use them there (I checked using isset() that they exist in that file). However in file2b (page_delayed_payment.php) which is in the same directory isn't getting those variables. Neither of file2a and file2b have codes that seem to get variable from file1 (like sessions or includes). How is file1 getting the variables across to file2a? I would post file1's contents but it's about 600 lines long. Does anyone have any idea what might be going on, and suggestion on what kind of code I should look for in file1 that might be doing it?

For those of you who know of it, I'm using Lemonstand eCommerce framework.

Thank you

4
  • how you are sending the variables???? Commented Mar 25, 2014 at 9:13
  • Those files must be included together somewhere; at least file1 and file2a if file2a is accessing variables from file1 without including it in its on file. It could be that the page you're on includes them all, but File 2b is included before the other two files. Hard to tell. Commented Mar 25, 2014 at 9:18
  • contents of file2a and file2b aren't very different, and both are trying to access the same variables. But only file2a is able to do so, and file2b is giving 'undeclared variable' error. Commented Mar 25, 2014 at 9:29
  • If anyone know a way to find out where a certain variable is being passed into a file that would be useful, since I would use it on the variable in file2a to see exactly how it is being passed into it. Commented Mar 25, 2014 at 9:33

1 Answer 1

1

Maybe this values are fed from a form thus using $_POST is very appropriate.

You could just do :

$_POST['myPay'] -> this method fetches the value of a form element with a name myPay.

Or

Another method would be by $_SESSION, you could add a session variable that holds the values you want to fetch.

NOTE: I recommend not to use $_GET (It is very manipulative)

Sign up to request clarification or add additional context in comments.

2 Comments

Just a quick note - $_GET is not more manipulative than $_POST, since both can be used by an attacker to send whatever data he wants. With $_GET he can directly manipulate the query string in the browser URL field, while with $_POST he has to send a raw HTTP request - the latter is a little harder, and will likely turn away script-kiddies, but nothing more. Raw HTTP requests are far from difficult to send.
With proper filtering, Cross-side scripting attacks can be prevented, compared to $_GET, your data is very visible on the browser.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.