problems with passing variables through command line

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
muab
Forum Newbie
Posts: 3
Joined: Thu May 08, 2003 3:38 pm

problems with passing variables through command line

Post by muab »

hiho =)

i wrote a web server and want to make it supporting php (as cgi for now).
now it works fine when it should interprete normal php with:

php.exe site\test.php

but if i want to pass eg stuff that was entered in some input form i have a problem:
the browser sends "test2.php?value1=suc&value2=cess"

now how could i "translate" that into command line? either the variables are "not defined" in test2.php or there is simply no output at all =(

so where is the trick?

thx in advance
muaB
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

What's your PHP code look like?

Mac
muab
Forum Newbie
Posts: 3
Joined: Thu May 08, 2003 3:38 pm

Post by muab »

actually i try:

the starting page:

<FORM ACTION="check.php" METHOD="GET" name="form1">
<p align="center">
User:<BR><input type="text" size="25" maxlength="50" name="name"><BR>
Passwort:<BR><input type="password" maxlength="50" name="passwort"><BR>
<input type="submit" value="Einloggen">
</form>

giving the values to check.php:

<?
$name=strtolower($name);
$passwort=strtolower($passwort);
$datei=fopen("pwd.dat.php","r");
while(feof($datei)==0):
$nme=chop(fgets($datei,110));
$pwd=chop(fgets($datei,110));
$seite=chop(fgets($datei,500));
if ($name==$nme):
if ($passwort==$pwd)
header("location: ".$seite."");
endif;
endwhile;
fclose($datei);
?>
User oder Passwort falsch!

but i dont want to change my code (well, if something wouldnt work on any server i would hehe), i want to change the behavior of my server to become a "normal" php server.

thx
muaB
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

same matter: viewtopic.php?t=8595 ;)
Post Reply