On 5/29/2013 1:39 PM, Ron Piggott wrote:

Good morning all:

I have recently purchased a computer and am using it as a dedicated server.  A 
friend helped me install PHP and configure.  I am saying this because I wonder 
if using a newer version of PHP (compared to my commercial web host) may be the 
reasoning behind the error I am receiving.

I created a function to generate a form submission key.
- This created hidden variable for forms
- This is also session variable

With this function I have an ‘ include ‘ for the file containing the mySQL 
database, username and password.  I know this file is being accessed because I 

echo $mySQL_user;

following the login credentials.

But when I remove this line from mySQL_user_login.inc.php and place within the 
function on the line following the include the "echo” returns nothing.


echo $mySQL_user;

Can any of you tell me why this is happening?

Ron Piggott


#1 - it's not an "include error".  It's a programmer error

#2 - that said - why would you want to do this? The release of usernames/passwords is a dangerous practice - even in development. If all you want to do is verify that you passed thru this bit of code, echo some less sensitive message, such as "Connected successfully". Or even better have the connect function return true or false and check the return.

#3 - global
#4 - global
and #5 global. Anytime you want to use a var withing a function include it in a global statement.

I always forget too. But I'm getting pretty good at remembering how to resolve it.

PS - do you store your .inc file with this sensitive info on your server "outside" of the web-accessible path? I hope so.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to