Jump to content

include file not working, IIS 6 Windows 2003


hc

Recommended Posts

I have a file called test.php. When I browse to it, I get the results for the browser test

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6

But, the included file (testinc.php) does not get included. The contents of testinc.php are simply

<!-- a general PHP test -->
<?php phpinfo(); ?>

If I take that out and put it in the body of the test.php file, it works fine. So, it is clearly include files that are not working. Can someone please help. I have been searching all afternoon.

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<!-- testing sessions -->
<?php session_start(); ?>

<!-- testing browscap.ini -->
<?php
echo $_SERVER['HTTP_USER_AGENT'] . "<br/><br/>";
$browser = get_browser(null, true);
print_r($browser);
echo "<br/><br/>";
?>

<?phpinclude 'inctest.php';?>
</body>
</html>
Link to comment
Share on other sites

I see a few errors on here
1: <?php session_start(); ?> needs to be on line 1 of your script, before HTM headers are sent (doctype, <html>)

B: <?phpinclude should be <?php include('inctest.php'); ?> (missing space, brackets should not matter
This would HAVE to be in the same folder as the file you are running

A little tip
make ur php code like the following
<?php
include("bla_file");
?>
So <?php is on its own line
and
?> is on its own line
Link to comment
Share on other sites

ok, while that was true, and subsequently worked,  :-[

how about about this one. That small test started because of this...

I have this file, pretty simple

<?php
/*
* logon.php
* Created on Dec 14, 2005 10:51:13 AM
* by Keith Swallow
*
* Updated on 12/20/05 - 16:38:59
* by Matthew Miller
*
* Script to handle logons
*/

$includePath = '../classes/';  // Should be in a global config file as a constant
require_once($includePath . 'dataobject.inc');
require_once($includePath . 'employee.inc');
require_once($includePath . 'passmgr.inc');
require_once($includePath . 'functions.inc');

$bodyID = "logon";  // sets body ID for the view, helps with navigation.  Move into view?

if($_POST['submit'])  // if this form has been submitted
{
//unset($_POST['submitted']);  // reset the global variable in case they use other forms.
$username = $_POST['logonUsername'];
$uPass = $_POST['logonPass'];

$user = new Employee;
$id = $user->UsernameExists($username);  // Get employee ID
if($id === 0) // if does not exist
{
$pageTitle = "Logon Error: Username";
$error = "Username not found.";
include('../views/logonform.inc');
exit;
}
$user->SetEmployee($id);  // populate employee from DB

$pm = new PassMgr;
if(!$pm->Validate($uPass, $user->GetPass()))  // check passwords
{
$pageTitle = "Logon Error: Password";
$error = "Password incorrect.";
include('../views/logonform.inc');
exit;
}

// if everything worked out
session_start();
$_SESSION['username'] = $user->username;
$_SESSION['user_id'] = $user->id;
$_SESSION['loggedOn'] = TRUE;

$clients = $user->GetEmployers(array('Official'));

if(is_array($clients) && $_SESSION['user_id'] != 1)
{
$_SESSION['officialonly'] = 0;
}
else
{
$_SESSION['officialonly'] = 1;
}

header("Location: index.php");
}
else
{
session_start();
include('../views/logonform.inc');
}
?>

When I submit the page, instead of presenting me with a login message or error, it goes to blank page. nothing in the

if($_POST['submit'])

seems to get processed. Any ideas? Thanks
Link to comment
Share on other sites

ok, this is the form. The real kicker here is that this code works on a UNIX server. But when I bring it down to my develpment environment (Windows 2003), it does not work anymore. That is why I think it is a setting or something. Any help would be greatly appreciated. Thanks

<?php include('basicheader.inc'); ?>
<h1>Welcome to OPP</h1>
<form action="logon.php" method="post">
<p>Username: <input type="text" name="logonUsername" maxlength="30" value="<?php echo $_POST['logonUsername']; ?>" /></p>
<p>Password: <input type="password" name="logonPass" maxlength="30" value="" /></p>
<p><input type="submit" name="submit" value="Login" /></p>
</form>
<div id="notRegistered">
<h6>Not registered?</h6>
<p><a href="register.php">Sign up here</a>.</p>
</div>
<?php include('footer.inc') ?>
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.