473,396 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help with 'failed to open stream: No such file or directory in ...'

Hie

I'm trying to pass variables between pages using URLs however I am encountering the following error when I do so:

Warning: main(jobSheetDisplay.php?id=20071403PB136CoA) [function.main]: failed to open stream: No such file or directory in /home/computio/public_html/gto/index.php on line 43

Warning: main() [function.include]: Failed opening 'jobSheetDisplay.php?id=20071403PB136CoA' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/computio/public_html/gto/index.php on line 43

My code for the index.php is:

<?php
if(isset($_SESSION['loginStatus']))
{
if($_SESSION['loginStatus'] == 1)
{
$page = $_GET['page'];
if($page)
{
include($page);
} else{
include("manageMain.php");
}
)
}
else
{
include("loginForm.php");
}
?>

The page that has got the hyperlink that leads to the stuffed up page is as follows:

<?php
$min = 15;
?>
<a href="index.php?page=jobSheetDisplay.php?id=
<?php displayEnteredInfo($t,$min);?> ">
<?php
echo displayEnteredInfo($t,$min);
?></a>

When I click this hyperlink it gives me the above error messages but if i remove the "index.php?page=" bit in the above URL it works perfectly, I however need to use some of the stuff on the index page so code some please help me on how to go about the problem..

Thanx simba
Mar 14 '07 #1
2 14045
You should probably user
<a href="index.php?page=jobSheetDisplay.php%3Fid=
Mar 18 '07 #2
And if you do what I wrote, you will probably include the correct .php-file, but you will not pass the id-parameter along. Includes work only on filenames, and not URLs.

So instead I suggest you do it something like:
[HTML]
<a href="index.php?page=jobSheetDisplay.php&id=
[/HTML]
When jobSheetDisplay.php is included it can read the same $_GET-variables as index.php - it ought to work just like that.

This said I must warn you: If you just issue an include to any and all $_GET['page'] variables, your website is wide open to an attack. It will take a hacker less than a minute to upload a .php file to your site, and get complete control. The hacker will then be able to put a phishing-page on your site.

Never trust input from users. May I suggest you do something like:
[HTML]
<a href="index.php?page=1&id=
[/HTML]
and then in PHP
[PHP]
switch($_GET['page']) {
case 1: include('jobSheetDisplay.php'); break;
case 2: include('someotherpage.php'); break;
}
[/PHP]
Mar 18 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: JDJones | last post by:
A friend just changed servers with her web site. The new server uses PHP 4.3.2 as opposed to the old server that had one of the 4.0.x's (don't remember exactly which one). Now I know all about the...
1
by: Barti | last post by:
After upgrading php from 4.2.3 to 4.3.4 I have problem with "failed to open stream" Warning: main(): Failed opening '...........inc.php' for inclusion...
8
by: MattP | last post by:
Ok, with the help of some examples found on the web and some minor modifications on our own, we have a simple and working encrypt and decrypt solution. It runs as a service, watches for files with...
6
by: cj | last post by:
Lets just take this example I'm looking at now. I'm looking at the help screen titled .NET Framework Class Library FolderBrowserDialog Class . It gives an example at the bottom that begins with:...
2
by: muchexie | last post by:
i have two scripts that are not running to reset a password that has been forgotten and the other to change old password. here are the scripts. change_passwd.php session_start();...
3
by: Simon Brooke | last post by:
As various people will have noticed, I've been having a lot of trouble with XSL lately. Brief history: I wrote myself an XML toolkit back in 2000, and it worked well enough for me, so it's been...
11
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package...
2
by: grozanc | last post by:
Hello, I keep getting the following erorrs when trying to use a PHP/MYSQL upload script. Can anyone tell me what's causing this error? I'm not a programmer, just an MFA student working on his...
6
by: Andy2500 | last post by:
Hi, I'd like to upload an image to a folder, then I have 3 diffrents examples but all of them give an error "failed to open stream: Permission denied", althrough the C:\Inetpub\wwwroot is not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.