hc Posted September 14, 2006 Share Posted September 14, 2006 I have a file called test.php. When I browse to it, I get the results for the browser testMozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6But, 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 https://forums.phpfreaks.com/topic/20780-include-file-not-working-iis-6-windows-2003/ Share on other sites More sharing options...
AdRock Posted September 14, 2006 Share Posted September 14, 2006 you haven't got a space between ?php and include Link to comment https://forums.phpfreaks.com/topic/20780-include-file-not-working-iis-6-windows-2003/#findComment-92014 Share on other sites More sharing options...
onlyican Posted September 14, 2006 Share Posted September 14, 2006 I see a few errors on here1: <?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 matterThis would HAVE to be in the same folder as the file you are runningA little tipmake ur php code like the following<?phpinclude("bla_file");?>So <?php is on its own lineand?> is on its own line Link to comment https://forums.phpfreaks.com/topic/20780-include-file-not-working-iis-6-windows-2003/#findComment-92016 Share on other sites More sharing options...
hc Posted September 14, 2006 Author Share Posted September 14, 2006 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 constantrequire_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 https://forums.phpfreaks.com/topic/20780-include-file-not-working-iis-6-windows-2003/#findComment-92018 Share on other sites More sharing options...
onlyican Posted September 14, 2006 Share Posted September 14, 2006 Again, session_start(); HAS to be on line 1This function sents HTM headers2, Please post the FORM only Link to comment https://forums.phpfreaks.com/topic/20780-include-file-not-working-iis-6-windows-2003/#findComment-92022 Share on other sites More sharing options...
hc Posted September 14, 2006 Author Share Posted September 14, 2006 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 https://forums.phpfreaks.com/topic/20780-include-file-not-working-iis-6-windows-2003/#findComment-92040 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.