Jump to content

Newby trying to configure PHP5


Recommended Posts

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

Link to comment
Share on other sites

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")

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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();
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.