Jump to content

Recommended Posts

I have been reading several PHP books and I thought I run something by some of the experts here. Most books

show passwords to connect to databases, constants, configuration settings,etc. enclosed in an include.php file that is not in the root directory. I was wondering instead of using an include file, do some of you use a table to store these items to make your site data driven? If yes, what would be an example of how you use a table instead of an include file to control your program?

 

Another question I have is do any users alter system variables, such as a session variable or other system variables to store variable or user data so they can be accessible from any script. If yes, what would be an example of how you would use this strategy?

 

I am just thinking out loud as I am use to programming where a variable or constant set in the main opening program can be used by any other calling program (global). I was thinkng if there is a way to accomplish this by adding information to a session or system variable and then parse out when needed.

 

Thanks

Edited by phpjim

What exactly do you mean by storing those items in a table? If you are talking about a database table then that is just outright illogical. You would need to be authenticated in the first place to access that table.

 

To answer your second question, Yes.

 

Pretty much any server-side language will be able to store session data as well as create cookies. PHP offers $_SERVER variables as a means to get the information of the user. Data such as the user's IP, browser name, referring page, operating system, etcetera are all available in the $_SERVER superglobal. While this variable is not readonly, it is useless to store data in since each page refresh will, AFAIK, generate a rebooted array of values.

 

PHP is a very very well documented language, it is even safe to say that it is the BEST documented language. Take a look through it if you haven't already.

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.