Re: Re: [Q] Why does my php file gets displayed instead of executed

From: Date: Mon, 12 Jul 2004 00:54:28 +0000
Subject: Re: Re: [Q] Why does my php file gets displayed instead of executed
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-190206@lists.php.net to get a copy of this message
this all seems just fine to me, aren't you sending some Header: Content-type -s? could you post that init.php script source? and is that apache server working well for other scripts that are called from the forms? AND ... just to be sure,... are you calling that html which contains the form thru server? (like http://localhost/myform.html) ... ? because, when calling it directly from dreamweaver, it could be called like direct html file (eg. file://c:/myhtmls/myform.html) and then the script will be called as file://c:/myhtmls/my_authentication_script.php instead of http://localhost/my_authentication_script.php that's all what comes to my mind, regards, m. Michael T. Peterson wrote:
Here is some additional info: My other PHP scripts execute just fine, including the php script init.php which uses header(...) to dispatch to the member_login.htm page. Recall that the problem arises when validate_member_login.php is invoked from member_login.htm. When validate_member_login.php is invoked directly, it executes properly. I'm running the most recent production release of the Apache server on winxp. My ISP is running the same version. I've configured PHP identically with my ISP's Apache config. I use Dreamweaver MX for development and testing. I've not tested for this problem on my ISP's system, yet Once again, note that the php script, validate_member_login.php is executed properly in one case, yet is displayed in the browser in the other. Here is the code for validate_member_login.php: <?php include_once('../init.php'); /** * Variables set by member_login.htm are:
*      username -- contains the username of the member.
*      password -- contains the member's password.
*/ $username = trim($HTTP_POST_VARS['username']); $password = trim($HTTP_POST_VARS['password']); $result = authenticate_member_login( $username, $password ); if( $result == 0 ) {
    $HTTP_SESSION_VARS['session_id'] = crypt_password( $password );
    $HTTP_SESSION_VARS['username'] = $username;
    header( 'Location: '.MEMBER_HOME_PAGE );
} else {
    header( 'Location: '.MEMBER_LOGIN_PAGE );
} ?> 'init.php' executes session_start(), sets a bunch of constants (e.g., MEMBER_HOME_PAGE, etc.), sets an error handler, and includes a bunch of libraries. All standard stuff. Again, any help would be appreciated. Cheers, Michael "Michael T. Peterson" <mtp1032@comcast.net> wrote in message news:ccsfe8$liu$1@sea.gmane.org...
When a user first comes to my site, the user's session id is checked and validated. If no session id is present or the validation fails, the user
is
vectored to a second page containing a login form. When the user enters
the
username and password and then clicks the submit button the info is forwarded to a third page, a php script, validate_member_login.php, that checks the username and password against a database. Just for
completeness,
note that the php script, validate_member_login.php, is invoked via login form's action parameter, i.e.,
       <form action="validate_member_login.php" ... />
The problem is that the php script, validate_member_login.php, is
displayed
in the browser rather than being executed. This is my first attempt at designing a dynamic web site so I'm sure I've missed something really basic, but I have hardly any hair left to pull
out.
Thanks, in advance, Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#190206) next »