grivix Posted April 27, 2007 Share Posted April 27, 2007 Hi all, I'm a newby. I have installed PHP5 in my local computer (Windows 2000) as no web-server. I would like to execute several examples of php-code embeded in html documents that call .php files. Actually I succeed when I upload the files to a web server that runs php. But it fails if i try to run it in my computer. Sombody knows where am I wrong? The pieces of code that i'm testing are in the folowing two files: <!-- Forma.html --> <html> <head> <title> Example </title> </head> <body> <form method="POST" action="password.php"> Usuario: <input type="text" name="user" size="10"> <br>Password: <input type="password" name="password" size="10"> <br> <input type="submit" value="Send" name="private"> </body> </html> <? // Password.php if ($user=="abcde" && $password=="12345") { $valido="yes"; } else { $valido="no"; } ?> <html> <head> <title>private page</title> </head> <body> <? if ($valido=="yes") { ?> ' Our private page... <p>Welcome to the private page</p> <? } else { ?> <p>incorrect user or password</p> <? } ?> </body> </html> Thanks in advance, grivix Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted April 28, 2007 Share Posted April 28, 2007 Your code relies on setting called "register_globals" to be turned on in order for it to work. I do not recommend you code in this style as it can cause security exploits in your code. To make your code work change this line: if ($user=="abcde" && $password=="12345") to this: if ($_POST['user'] == "abcde" && $_POST['password'] == "12345") Quote Link to comment Share on other sites More sharing options...
grivix Posted April 28, 2007 Author Share Posted April 28, 2007 Thanks Wildteen88, but the effect is exactly the same in a local installation as no web server. When i fill the form and press the Send-button a screen for DOS-commands appears, quickly it inform or do something, and disappears. When i execute the same in a rented web-server, it puts a new html-page as it is embedded in the file "password.php". Please try it at www.esenios.org/estudio/php/forma_usuario.html Usuario: tuuser Password: tupass Maybe i am disattending somethig at the installation process. Thanks in advance grivix Quote Link to comment Share on other sites More sharing options...
trq Posted April 29, 2007 Share Posted April 29, 2007 I have installed PHP5 in my local computer (Windows 2000) as no web-server. What exactly does that mean? Have you installed a webserver or not? The code you have posted uses html forms with php. This needs to be submitted and processed using a webserver. Quote Link to comment Share on other sites More sharing options...
Koobi Posted May 1, 2007 Share Posted May 1, 2007 i think he means he's running a PHP as a CGI. grivix, if you're not sure how to answer us, please create a file (let's call it phpinfo.php, for example) and place the following code within it, access it via the browser and post it here as an attachment or however you want: <?php phpinfo(); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.