[SOLVED] Include_path - How?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nikkelei
Forum Newbie
Posts: 3
Joined: Wed Jun 30, 2004 10:26 am

[SOLVED] Include_path - How?

Post by nikkelei »

Ok, I've got a problem.....

I have a login and password screen. When I try to include a Htm file in my php the server can't read the file. It works fine on my localhost, but when I upload it to the server I get problems. I think that I will have to use "include_path" somehow, but I can't figure out how. You can see the script in question and the errormessage below. Locally I use PHP 4.0.4pl1

Code: Select all

<?php

$username=$HTTP_POST_VARS['username'];
$password=$HTTP_POST_VARS['password'];


$adminusername="Bob";
$adminpassword="1";
echo "$username<br>";
echo "$password<br>";
echo"hello";
$username=strtolower($username);


// check the username and quit if it doesn't match

if ($username !=$adminusername || $password !=$adminpassword) {
		print "Username or password not valid.....Try again!!";
		exit;
	} else {
		include("admin.htm");
		exit;
}

?>
The errormessage I get is as follows:

Warning: main(admin.htm): failed to open stream: No such file or directory in /customers/hanspetur.net/hanspetur.net/httpd.www/Admin_login.php on line 21

Warning: main(): Failed opening 'admin.htm' for inclusion (include_path='.:') in /customers/hanspetur.net/hanspetur.net/httpd.www/Admin_login.php on line 21

Any clue?

Bech100 | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
DaiWelsh
Forum Commoner
Posts: 36
Joined: Wed Jan 08, 2003 9:39 am
Location: Derbyshire, UK

Post by DaiWelsh »

Is the file admin.htm on the server in the same directory as the php script? Does it have the right name, including case. I will take a stab given that your php page is called "Admin_login.php" that the htm might be called "Admin.htm" ? If so that will work on Windoze where file names are not case sensitive but not on Linux where they are. If that does not help, what permissiions are set on the admin.htm, maybe it cannot be opened (doubtful for read though).

HTH,

Dai
nikkelei
Forum Newbie
Posts: 3
Joined: Wed Jun 30, 2004 10:26 am

You're right....

Post by nikkelei »

It works. It was just a case of "case sensitiviness". Thanks!!
nikkelei
Forum Newbie
Posts: 3
Joined: Wed Jun 30, 2004 10:26 am

Post by nikkelei »

And nice cat by the way......
Post Reply