Go Back   Sports Car Forum - MotorWorld.net > Hobbies and Leisure Time > Computers, Consoles, Gadgets And Gizmos



Reply
 
Thread Tools Display Modes
Old 09-04-2004, 02:39 AM   #1
5vz-fe
Regular User
 
Join Date: Jun 2003
Location: Toronto
Posts: 6,167
Default PHP Help Needed!!!

I am just playing with PHP with different webservers (IIS and Apache)
Running into one interesting probelm, I can't get html forms to pass variables into php script. Can anyone tell me if I did something wrong with the conf or ini files?

HTML:
<form method="POST" action="example18.php3">
<div align="left">

<font face="BankGothic Md BT">Admin password?</font>
<input type="password" name="pw" size="14"><input type="submit" value="Submit"></p>
</div></form>

PHP:
<?
$adminpass = "test123";
if ($pw == $adminpass)
{
print("Welcome to the administration area!");
}
else
{
print("Wrong password");
}
?>

When I run the html and submit it tells me undefined variable pw.

Anyone know why?
__________________
5vz-fe is offline   Reply With Quote
Old 09-04-2004, 04:18 PM   #2
5vz-fe
Regular User
 
Join Date: Jun 2003
Location: Toronto
Posts: 6,167
Default

Really?? No one?
__________________
5vz-fe is offline   Reply With Quote
Old 09-04-2004, 05:26 PM   #3
Overmind
Regular User
 
Join Date: Nov 2003
Location: Czech Republic, Europe
Posts: 667
Default

just a random guess, try:
if($_POST['pw'] == $adminpass)

if it works I can explain what is it you're doing wrong ...
__________________
<---- Look into my Eye and shiver.
Overmind is offline   Reply With Quote
Old 09-04-2004, 07:34 PM   #4
5vz-fe
Regular User
 
Join Date: Jun 2003
Location: Toronto
Posts: 6,167
Default

GREAT!!!!!! IT WORKS!!!!!!!! Thanx for the big help Overmind.

What did I do wrong exactly??..I was just copying and pasting the example on the webpage.
__________________
5vz-fe is offline   Reply With Quote
Old 09-04-2004, 08:12 PM   #5
blast
Guest
 
Posts: n/a
Default

well you had nothing declaring where $pw was coming from in what you posted first of all
  Reply With Quote
Old 09-04-2004, 08:25 PM   #6
5vz-fe
Regular User
 
Join Date: Jun 2003
Location: Toronto
Posts: 6,167
Default

ahhhhhh.................stupid website.....stupid me........
thx guys, always get what I needed to know here.
__________________
5vz-fe is offline   Reply With Quote
Old 09-05-2004, 06:12 PM   #7
Overmind
Regular User
 
Join Date: Nov 2003
Location: Czech Republic, Europe
Posts: 667
Default

Originally Posted by Dan\/6
well you had nothing declaring where $pw was coming from in what you posted first of all
well, that is the way PHP used to work by default settings... you could access http request parameters this way... very dangerous & stupid. Caused lots of tears and confusion to some "l33t hax0r PHP coders" either when their sites were being hacked or when this "feature" got disabled by default.

5vz-fe: it looks like you've been very unluky picking up the web site to learn from . Anyways for what you've been doing wrong read this: http://www.php.net/register_globals. Also reading through their PHP Manual is highly recommended (I know it's huge and long :shock:, but I'm unaware of any better source ).
__________________
<---- Look into my Eye and shiver.
Overmind is offline   Reply With Quote
Old 09-06-2004, 08:27 AM   #8
Ronster101
Guest
 
Posts: n/a
Default

Originally Posted by Overmind
Originally Posted by Dan\/6
well you had nothing declaring where $pw was coming from in what you posted first of all
well, that is the way PHP used to work by default settings... you could access http request parameters this way... very dangerous & stupid. Caused lots of tears and confusion to some "l33t hax0r PHP coders" either when their sites were being hacked or when this "feature" got disabled by default.

hahha well maybe, but damned if you'll see one of my servers ever running with register globals = On , even if it does mean that many of the pre coded things like commerce stores etc wont work.. just have to search harder for well coded scripts
  Reply With Quote
Old 09-06-2004, 01:46 PM   #9
5vz-fe
Regular User
 
Join Date: Jun 2003
Location: Toronto
Posts: 6,167
Default

Overmind, you are totally right, you cannot believe how much trobule that stupid webpage brought me. I keep changing the php.ini script thinking that I have set the variables wrong or something. I even wipe the Apache server clean and try the IIS server instead...and still the same results...that's y I turn to u guys. <sigh>
__________________
5vz-fe is offline   Reply With Quote
Reply


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

Forum Jump