Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie + Php login: Passing host name

Status
Not open for further replies.

rennis

Programmer
Dec 6, 2006
80
CA
I currently have a login form, and the login form will ask for the host name of the database. I would like to pass this host/server to the connection string and then open the database.

the form action is to post another php document and in that php document it loads the information from the database.

i've tried
$dbhost = $ipAddress;
$dbhost = '$ipAddress';
$dbhost = "$ipAddress";

where ipaddress is the name of the textbox.
But neither of the above seem to work properly. I can hardcode the value for example $dbhost = XXX.XXX.XXX.XXX and this will work perfectly fine.

Any suggestions?
 
Are yu assuming that register-globals is on?? That's a very hazardous thing to do.

How do you access the other values of the login form???

Have you tried: $dbhost=$_POST['ipAddress'];

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Ok after more research, I managed to get it to work using the register-globals option and turning it on. Is this not the correct way to do this?
 
no. read the manual. and read vacunita's post.
 
As per jpaide: Read the manual entry for register-globals:


PHP online manual said:
When on, register_globals will inject your scripts with all sorts of variables, like request variables from HTML forms. This coupled with the fact that PHP doesn't require variable initialization means writing insecure code is that much easier. It was a difficult decision, but the PHP community decided to disable this directive by default. When on, people use variables yet really don't know for sure where they come from and can only assume. Internal variables that are defined in the script itself get mixed up with request data sent by users and disabling register_globals changes this.


----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top