473,669 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

7 New Member
Hie

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

Warning: main(jobSheetDi splay.php?id=20 071403PB136CoA) [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.includ e]: Failed opening 'jobSheetDispla y.php?id=200714 03PB136CoA' 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($_SESS ION['loginStatus']))
{
if($_SESSION['loginStatus'] == 1)
{
$page = $_GET['page'];
if($page)
{
include($page);
} else{
include("manage Main.php");
}
)
}
else
{
include("loginF orm.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=jobSheetD isplay.php?id=
<?php displayEnteredI nfo($t,$min);?> ">
<?php
echo displayEnteredI nfo($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 14070
erikjacobsen
2 New Member
You should probably user
<a href="index.php ?page=jobSheetD isplay.php%3Fid =
Mar 18 '07 #2
erikjacobsen
2 New Member
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=jobSheetD isplay.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('jobShe etDisplay.php') ; break;
case 2: include('someot herpage.php'); break;
}
[/PHP]
Mar 18 '07 #3

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

Similar topics

2
2152
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 register globals change but one of the pages is suddenly throwing me an error I can't figure out. It is not on a form. It is a script to include a random quote on a page once every 50 page loads. It worked fine on the old server but is throwing...
1
2373
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 (include_path='/usr/local/lib:/usr/local/lib/php') in /home/file.php on line 2 When I refersh browser everything is ok. Mentioned file exist and has correct rights. This happens in random places without any reason and regularity Can you advice something?
8
3013
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 a specific extension in a specific directory. The files are uploaded by FTP to this directory. The service then does the following steps: 1) Verify it can open the file (so we know it's fully uploaded). 2) Try to decrypt the file with known...
6
2322
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: ' The following example displays an application that provides the ability to ' open rich text files (rtf) into the RichTextBox. The example demonstrates ' using the FolderBrowserDialog to set the default directory for opening files. ' The...
2
2101
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(); do_html_header("Changing password"); //check_valid_user(); $new_passwd=($_POST);
3
4237
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 little changed since. However, it works only with an obsolete version of Saxon (6.2.2 I think), and it has a number of small bugs; and I've at last got to the point where I need to fix it. And I'm finding it, frankly, absurdly frustrating and...
11
26599
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 and PEAR is in c:\wamp\php\pear I modified php.ini in the c:\wamp\php directory to reflect the actual path, but even stopping and restarting my server shows the c: \php5\pear path. I can't change it no matter what I do I also tried the...
2
1577
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 thesis and needs to collect images from several thousand people. So far I have CMOD 777 the directory that uploads are going into and tried different directories but nothing has worked. Thanks in advance!
6
62731
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 protected. Any suggestions would be helpful, thank you for your time.
0
8894
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8803
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8587
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8658
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7407
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4384
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2792
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2029
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.