473,387 Members | 3,821 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,387 software developers and data experts.

includes question

Hi Folk

I was just wondering ...

I use the following a lot:

include_once("connectToDB.php");
include_once("some_functions.php");
include_once("HTML_snippets.php");

etc...

Can I do this:

include_once(http://www.someotherurl.com/HTML_snippets.php);

and if so, it is a security risk to have my include files in an unprotected
(www or public) directory????

What is the usual setup in terms of access priveleges?

TIA

- Nicolaas
Sep 26 '05 #1
3 1237
windandwaves wrote:
Hi Folk

I was just wondering ...
Can I do this:

include_once(http://www.someotherurl.com/HTML_snippets.php);

and if so, it is a security risk to have my include files in an unprotected
(www or public) directory????

What is the usual setup in terms of access priveleges?

TIA

- Nicolaas


You can, but you will get the output from the code, not the code itself.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 26 '05 #2
Jerry Stuckle wrote:

You can, but you will get the output from the code, not the code
itself.


I just tried include_once("http://www.someotherurl.com/HTML_snippets.php");
but that did not seem to work.

I am also wondering if the file contains functions then it really needs to
write the underlying file and not just return the output from the file. How
exactly does this work?

TIA

Nicolaas
Sep 26 '05 #3
windandwaves wrote:
Jerry Stuckle wrote:

You can, but you will get the output from the code, not the code
itself.

I just tried include_once("http://www.someotherurl.com/HTML_snippets.php");
but that did not seem to work.

I am also wondering if the file contains functions then it really needs to
write the underlying file and not just return the output from the file. How
exactly does this work?

TIA

Nicolaas


Nicolaas,

When you access a file with just it's filename (and path), you're
accessing the file directly through the local file system. In this case
you fetch the contents of the file.

However, when you access a file using 'http://xxx', you are accessing
the file through a web server, just as if you were accessing it via a
browser. The web server will parse the file, and if it includes PHP (or
perl, java or other scripting language), the web server will execute the
code. You will get the output of the web page, just as if you accessed
it via your browser.

This access can be via include, include_once, require, require_once,
fopen, etc. The key here is the use of http://... which indicates the
file should come through the web server. Using just the file name (and
path) in PHP code indicates the file comes directly from the file
system, and is not parsed by the web server.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 26 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Tim Tyler | last post by:
A fairly simple question: I have a library A which depends on library B and C. Currently I have: <?php include("A.inc.php"); include("B.inc.php"); include("C.inc.php");
2
by: Joe Mowry | last post by:
First off, I'm posting this question for a friend that doesn't have access to the news groups. Problem: Using PHP as the base and has several PHP < includes > for various functions, all this...
5
by: Vilmar Brazão de Oliveira | last post by:
Hi, I know this kind of include <!--#include file="adovbs.inc"--> or <!-- #include file="conn_dbAT.asp" --> is put into my asp page, but this bellow let my slow too?? <script...
10
by: Chris Gordon-Smith | last post by:
I am currently revisiting the code of a C++ application and restructuring the code where appropriate to make it consistent with the overall logical design. As part of this, I am looking at the...
12
by: tshad | last post by:
I am not sure why I am getting this error: I have the following code I want to run from another include file that holds all my functions. functions.inc...
6
by: William F. Zachmann | last post by:
We've got a project going that involves moving an old web site with a massive dll written in C++ that produces most of the output from a SQL 7.0 data base on NT4 onto IIS on Windows 2003 Server...
3
by: Jeff | last post by:
I have an asp page. Now I know this is sortof OT, but I am not sure of the forum to get an answer. I have an include on this asp page <!-- #include file=\forum\includes\consts-inc.asp --> ...
6
by: Richard | last post by:
I am new to php and am looking for some quick "get up and go" help. What would the arguments for and against be for function declarations v simple include? e.g <?php include("myfunc.php");...
6
by: MaiyaHolliday | last post by:
Hello, I've recently installed apache on a new computer, and cannot figure out why my site will not process any includes. (it was working on my old one) There are no errors on the page such as...
4
by: Ron | last post by:
Hi all, Trying to work out a few problems in using php on my site. Partially this is a html question. I was reading a lot of the posts and it seems that some of the includes people are using are...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.