473,893 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[function.requir e-once]: failed to open stream: Invalid argument

115 New Member
Hi there i'm having this error
Warning: require_once(C: \wamp\www ours\connection .php) [function.requir e-once]: failed to open stream: Invalid argument in C:\wamp\www\tou rs\header.php on line 2

Fatal error: require_once() [function.requir e]: Failed opening required 'C:\wamp\www ours\connection .php' (include_path=' .;C:\php5\pear' ) in C:\wamp\www\tou rs\header.php on line 2

could any one help me please !
this is the code of the index.php
Expand|Select|Wrap|Line Numbers
  1. <?php session_start(); ?>
  2. <table width="1000" height="377" border="1">
  3.   <tr>
  4.     <td height="56" colspan="2"><?php include("header.php"); ?></td>
  6.   </tr>
  8.  <tr>
  9.  <td width="215"> <?php include("left_menu.php"); ?> </td>
  11.  <td width="769">     
  12. Bordered on one side by the Mediterranean and on the other by two parallel mountain ranges, Lebanon seems a country suspended between the sky and the sea. Despite its small area (10,452 square km), this is a land resplendent in its diverse geography, landscape, culture and history. </td></tr>  
  13. </table>
and this one is for header.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. require_once("C:\wamp\www\tours\connection.php");
  3. Database::connect();
  4. ?>
  5. <?php
  6. if($_SESSION[user_id]){ ?>
  7.     <a href="logout.php">logout</a>
  9. <?php    }
  10.     else{
  12. ?>
  15. <form name="login" action="">
  17. <table><tr><td width="714">
  18. <table >
  19. <tr><td>Email</td><td><input type="text"  name="email"/></td></tr>
  20. <tr><td>Password</td><td><input type="password" name="password" /></td></tr>
  21. <tr><td colspan="2"><input type="submit" value="Login" /> </td></tr>
  22. </table>
  24. </td>
  25. <td width="161">
  26. Not a Member? <a href="register.php">Register</a>
  28. </td>
  30. </tr></table>
  32. </form> 
  33. <?php } ?>
Aug 24 '10 #1
10 9040
1,168 Recognized Expert Top Contributor
I found a similar problem with google:
If you get "failed to open stream" although you are sure your include_path is correct, check your open_basedir setting.
I spent 2 hours trying to figure out why although my inclusion path was good, php kept sending me the "failed to open" error.
It was simply because my included directory was outside the scope of the open_basedir which blocks php from accessing file outside you root directory(usual ly).
I think the error you send the "open_based ir restriction in effect" in this case.
Try remove "C:\wamp" and turn your \ into /:
Expand|Select|Wrap|Line Numbers
  1. require_once("/www/tours/connection.php");
Aug 24 '10 #2
115 New Member
I removed all the C:\
Now i'm getting this error
Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in C:\wamp\www\tou rs\DataMgmt\DbM gmt.php on line 6
Aug 24 '10 #3
431 Recognized Expert Contributor
If the string is enclosed in double-quotes (") than "\t" becomes horizontal tab. You have this:
Expand|Select|Wrap|Line Numbers
  1. require_once("C:\wamp\www\tours\connection.php");
Notice: \tours in your code.

Can you give us code for DbMgmt.php near and around line 6?
Aug 24 '10 #4
115 New Member
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. require_once("connection.php");
  3. Class UserDb {
  5.     private static $lastresult;
  6.                 Database::connect();
  7.     static public function checkUserID($usermail, &$fullname) {
  8.         $sql    = "SELECT full_name FROM users WHERE user_id = '".$usermail."'";
  9.         $result = mysql_query($sql, Database::getLink());
  11.         if (!$result) {
  12.             echo "Erreur DB, impossible d'effectuer une requête\n";
  13.             echo 'Erreur MySQL : ' . mysql_error();
  14.             exit;
  15.         }
  17.         $row = mysql_fetch_assoc($result);
  18.         if ($row){
  19.             $firstname   = $row['full_name'];
  20.              $trouve = true; 
  21.         } else {
  22.             $trouve = false;
  23.         }
  24.         mysql_free_result($result);
  25.         unset ($sql);
  26.         return $trouve;
  27.     }
  28. }
  29. ?>
Aug 25 '10 #5
431 Recognized Expert Contributor
Expand|Select|Wrap|Line Numbers
  1.  Database::connect();
inside the function.
Aug 25 '10 #6
8,658 Recognized Expert Moderator Expert
note: your Query is prone to SQL Injection. you need at least mysql_real_esca pe_string() to sanitize your input data.
Aug 25 '10 #7
115 New Member
What do you mean by that ? I didn't get your point ...

I removed the Database::conne ct(); and now i'm getting this:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\tou rs\DataMgmt\DbM gmt.php on line 9
Erreur DB, impossible d'effectuer une requête Erreur MySQL :
Aug 25 '10 #8
8,658 Recognized Expert Moderator Expert
What do you mean by that ? I didn't get your point ...
an illustrated example

I removed the Database::conne ct();
Zorgi didn’t say you should remove that line, he said you should move it inside the function body (line #8)
Aug 25 '10 #9
115 New Member
I read in the example that : (Do not create SQL statements that include outside data).
But how can i create the checkUserID function if i don't user the outside data ??
Aug 25 '10 #10

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

Similar topics

by: Keiron Waites | last post by:
Hi, I include the following function: <?php function login($members_only) { if (isset($_COOKIE)) { $login = explode("|split|",$_COOKIE); $login = array("username"=>$login,"password"=>$login); }
by: gustav04 | last post by:
hi all i have a question: what is the difference between a c-function and an c++ class method (both do exactly the same thing). lets say, i have a function called print2std() and a class called CUtils with a static method called print2std()
by: LineVoltageHalogen | last post by:
I have many stored procs in my database and I can call them just by their name uspMyProc with success always. However, I just created a user function ufnMyFunction as the same user that I created my procs but when I call ufnMyFunction it fails unless I preface it with dbo. . How come the stored proc does not require this but the stored function does? TFD
by: gamja | last post by:
Hi all. This is my first post on this group. Nice to meet you, cool guys~! I'm on system programming on various embedded systems and understand very well the byte alignment issues. When I write C code, especially design a structure, I pay attention to the order and size of member variables. Because, my boss always says that all variables should be aligned by 4byte boundary, if not a data abort will be occurred on a specific machine such...
by: Dov P | last post by:
hello everyone, i need to use api function named RegSetKeySecurity in my C# program. This function require ADVAPI32.DLL, but i cannot add this reference. I tried to use Microsoft.Win32.Registry Namespace but it doesn't give te ability to modify Security descriptors. Please help thanks.
by: Bill Pursell | last post by:
The following code generates a compiler warning when compiled with gcc -pedantic: typedef (*FUNC)(int); FUNC f; void * get_f(void) { return &f;
by: John Friedland | last post by:
My problem: I need to call (from C code) an arbitrary C library function, but I don't know until runtime what the function name is, how many parameters are required, and what the parameters are. I can use dlopen/whatever to convert the function name into a pointer to that function, but actually calling it, with the right number of parameters, isn't easy. As far as I can see, there are only two solutions: 1) This one is portable. If...
by: lowbotpro | last post by:
Hi, I am not very good at PHP and am trying to install a script but I have this problem that I just can't figure out... Code snippet: <?php // UTF-8 helper functions require(dirname(__FILE__) .'/includes/utf8.php'); include('Mail.php');
by: sumanthsclsdc | last post by:
Hello friends, I have a problem, I implemented a class which uses tkinter and displays the window as required, the class will create a window with listbox and inserts some items into it, I created the instance of this class and executed, I require the selected item to be sent back to the calling function, and the window should not be destroyed. When the button is pressed I require the control to get back to calling function and process...
by: Bunty | last post by:
When we want to call another file at that time we can use both include and require.Please tell me what's the difference between them?
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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...
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...
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...
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...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.