PHP problem in Apache/PHP/MySQL

This is a discussion on "PHP problem in Apache/PHP/MySQL" within the PHP Forum section. This forum, and the thread "PHP problem in Apache/PHP/MySQL are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jan 16th, 2006, 22:35
New Member
Join Date: Jan 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question PHP problem in Apache/PHP/MySQL

I have just set up a local Apache/PHP/MySQL setup on my local PC to act as a tesing and development site for a remote web. In order to set a PHP variable from one page to the next I place the PHP variable in the URL to select the page content from a MySQL data base. Example:

http://www.mysite.co.uk/pages/main.php?page=0008

This works fine in the remote live site but the variables do not get passed on in my local test server. Everything else works just fine (Apache/PHP/MySQL), just this PHP variable fails to transfer. The setup is newly installed and copies closely the versions on the hosted site: WinXP/Apache 1.3.34/PHP 4.4.2/MySQL4.0.26.

Is there a setting to enable this in PHP or does anyone have an idea what is wrong?

Hope I have posted enough information. Thanks JohnI
Reply With Quote

  #2 (permalink)  
Old Jan 16th, 2006, 22:49
New Member
Join Date: Jan 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP problem in Apache/PHP/MySQL

Have I found the answer elsewhere in the Forum that "register_globals" needs to be "on" to make this happen? But you specialists consider this an insecure way of passing variables? Correct? Thanks John I
Reply With Quote
  #3 (permalink)  
Old Jan 17th, 2006, 01:36
Highly Reputable Member
Join Date: May 2005
Location: U.K
Age: 21
Posts: 739
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbramz
Re: PHP problem in Apache/PHP/MySQL

im no pro at installing such systems, so my advice here will most likely be wrong. but will it matter? like you say, its only for test purposes, and if its going up to a server which has been set up properly, would it be such a problem?
Reply With Quote
  #4 (permalink)  
Old Jan 17th, 2006, 02:40
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP problem in Apache/PHP/MySQL

It's certainly possible that a different setting of register_globals is leading to the different behaviour. With version 4.4.2 of PHP, you should be using the passed on variable in the new script from the incoming variable $_GET[page] or $_REQUEST[page] which will work for any setting or register_globals. If you use $page then it will only work if you have register_globals set to on.

Security? It's possible to write perfectly secure code whatever register_globals is set to. However, with it set off it's very easy to flawed code too which is why it's set to off by default in current versions.

If register_globals is off, you can't assume that any incoming variables are empty. You need to explicitly initialise them in order to prevent a user who knows or can guess what they're called from setting them in the URL browser-side.
Reply With Quote
  #5 (permalink)  
Old Jan 18th, 2006, 02:46
Junior Member
Join Date: Jan 2006
Age: 25
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP problem in Apache/PHP/MySQL

Hey, I thought register globals is what allowed you to send dynamic information, not what naming structure it allowed you to use it in. I could be wrong though, on my local set up I cant remember if I set it on or off and im to lazy to open my ini file to figure out. But regardless, you should allways access your dynamic variables via the object refference. It makes keeping track of them a lot easier, and makes other people able to find them a lot better.
Reply With Quote
  #6 (permalink)  
Old Jan 19th, 2006, 01:21
Tim356's Avatar
Reputable Member
Join Date: Nov 2003
Location: Australia
Age: 25
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Tim356
Re: PHP problem in Apache/PHP/MySQL

register globals just lets you do exactly that - register variables that are global. So you can send info from one page to another.

But if register_globals is off, then you need to grab the data via post or get methods and store it in a variable.

So if like you said you want to name it a certain way, then just:
PHP: Select all

$variable_name=($_GET['data']);

//or
$variable_name=($_POST['data']); 
Reply With Quote
Reply

Tags
php, problem, apachephpmysql

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trainer Required for PHP MYSQL & APACHE BBenson Job Opportunities 0 Feb 9th, 2007 16:43
PHP, MYSQL and Apache install brunette PHP Forum 3 Sep 14th, 2006 22:15
PHP configuration problem. (or it could be Apache or XAMPP!) Craigypoos PHP Forum 5 Jul 3rd, 2006 12:12
PHP-MySQL problem robertboyle PHP Forum 4 Jun 16th, 2006 13:02
PHP Developer - Linux, Apache, MySQL - 12 month contract! AN Agent Job Opportunities 0 Mar 8th, 2006 08:23


All times are GMT. The time now is 20:50.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43