Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   PHP (http://www.programmingforums.org/forum29.html)
-   -   Problem with include (http://www.programmingforums.org/showthread.php?t=10956)

leo1502 Aug 5th, 2006 4:09 PM

Problem with include
 
I've installed an apache server on my computer so I can learn and run some php.

I'm trying the following :

:

<?php

/**
 *
 *
 * @version $Id$
 * @copyright 2006
 */

echo "test one<br>";
include "sample.shtml";
//include ("http://www.google.com/index.html");
?>


and I get:
Warning: Failed opening 'http://www.google.com/index.html' for inclusion (include_path='.;C:/phpdev/php/includes;C:/phpdev/php/class') in c:\phpdev\www\index.php on line 12

It seems it won't include anything from the web.

What could be the problem?

Thanks.

DaWei Aug 5th, 2006 4:18 PM

Quote:

What could be the problem?
Your lack of understanding of what "include" does? Might one inquire if you've bothered to refer to the manual? It's an action that comes highly recommended, and particularly in regards to the PHP manual, which is very good.

mleonid Aug 5th, 2006 6:33 PM

Friendly as usual I see.
I understand what include does.
The problem is that my php version doesn't support what I'm doing.

Thanks for everything

DaWei Aug 5th, 2006 8:30 PM

Why are you using two user names? Have you read the forum's rules/FAQ? I will say that if you understand what "include" does, and you're trying to include Google's web-resident index page, you aren't paying any attention to yourself. That doesn't bode well for the outside help. Your php version may not support what you're trying to do, but it didn't promise to tie your shoes and cater to your every dream. It, like most other software, recalcitrantly insists that you play by its rules.

Arevos Aug 6th, 2006 3:57 AM

Quote:

Originally Posted by DaWei
I will say that if you understand what "include" does, and you're trying to include Google's web-resident index page, you aren't paying any attention to yourself.

DaWei is probably correct in this regard. The PHP manual page says:
Quote:

The include() statement includes and evaluates the specified file.
This means that any <?PHP ?> tags on Google's page will be executed by your server. Now, it's somewhat unlikely that Google would have such tags on their homepage, but you're essentially turning control of your server over to Google, or any other site you choose to include. Any of these sites with malicious intentions could then wipe your harddrive, or download your data, or conceivably anything at all.

Thus, including sites that you do not control is not a very good idea.

mleonid Aug 6th, 2006 6:07 AM

I was just trying something. I know including google doesn't look so good.

Thanks guys.
About the 2 users, I logged in from different computers and turns out one of them remembered a user I forgot existed.

Ade Aug 6th, 2006 7:39 AM

Is this include() function a potential security risk? I mean I've had php errors before that have displayed something such as my database password, could someone include a php file and potentially see any of the information between <?php .... ?>s ?

Jimbo Aug 6th, 2006 12:18 PM

I don't think it would be a risk, as they would be including your file (most likely) through HTTP, so you server would evaluate whatever the PHP was, and send the result (e.g. the HTML) and their page would then just be including the HTML. I'm pretty sure that's how it would go... :o

Xeoncross Aug 10th, 2006 2:20 PM

About PHP's Include...
 
Jimbo is right, PHP will process all external PHP files (meaning OUT SIDE of your server) and THEN give the result to the file that is including them. So there is NO risk in including google or anyone else’s page. (at lest in the PHP code that is :p)

If you want to learn more about PHP's include function I wrote a lesson on it at:
learnphpfree.com - PHP Include


All times are GMT -5. The time now is 12:22 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC