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>
  5.  
  6.   </tr>
  7.  
  8.  <tr>
  9.  <td width="215"> <?php include("left_menu.php"); ?> </td>
  10.  
  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>
  14.  
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>
  8.  
  9. <?php    }
  10.     else{
  11.  
  12. ?>
  13.  
  14.  
  15. <form name="login" action="">
  16.  
  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>
  23.  
  24. </td>
  25. <td width="161">
  26. Not a Member? <a href="register.php">Register</a>
  27.  
  28. </td>
  29.  
  30. </tr></table>
  31.  
  32. </form> 
  33. <?php } ?>
Aug 24 '10 #1
10 9040
TheServant
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
hannoudw
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
zorgi
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
hannoudw
115 New Member
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. require_once("connection.php");
  3. Class UserDb {
  4.  
  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());
  10.  
  11.         if (!$result) {
  12.             echo "Erreur DB, impossible d'effectuer une requête\n";
  13.             echo 'Erreur MySQL : ' . mysql_error();
  14.             exit;
  15.         }
  16.  
  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. ?>
  30.  
Aug 25 '10 #5
zorgi
431 Recognized Expert Contributor
Move
Expand|Select|Wrap|Line Numbers
  1.  Database::connect();
  2.  
inside the function.
Aug 25 '10 #6
Dormilich
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
hannoudw
115 New Member
@Dormilich
What do you mean by that ? I didn't get your point ...

@zorgi
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
Dormilich
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
hannoudw
115 New Member
@Dormilich
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

2
2349
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); }
6
2554
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()
1
2093
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
14
1973
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...
2
5197
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.
12
5484
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;
18
4369
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...
2
2457
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');
2
2795
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...
7
1968
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?
0
9987
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, 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...
0
11245
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
10840
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...
0
10469
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
5859
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
6066
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4684
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
4281
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3293
bsmnconsultancy
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.