php src

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

nincha
Forum Contributor
Posts: 191
Joined: Fri Mar 28, 2003 12:30 pm
Location: CA, USA

php src

Post by nincha »

can any one see or read the php source or the php code? and is it possible to include a php file without having a php extension?
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

No, code cannot be viewed in a regular php page just by right clicking and then View Source.

Yes, it is possible to include a php file without the php extension.


Check this pageout for more info.


On my server i include .oro, .sam, and even .asp php pages in some scripts. It's just for fun though. :wink:
nincha
Forum Contributor
Posts: 191
Joined: Fri Mar 28, 2003 12:30 pm
Location: CA, USA

Post by nincha »

say u have a php code that echo "hello world"
when u include that php file into a html doc. , will the html doc show "hello world"?
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Yes you can include a php file without the php extension but (I only half remember this) I think this is LESS secure.

The server will be set up to parse php files: I think other extensions might be viewable with a "view source" in the browser.

I should know that but it's late here :)
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

when u include that php file into a html doc. , will the html doc show "hello world"?
No - if you have MS Word installed, the browser would launch it and display that file.
However, as McGruff said - e.g. if you have a file "db_connect.inc" which is say the php-file to establish the MySQL-connection AND your haven't set your server to parse files with the extension ".inc" it will be displayed just a normal ".txt"-file, everyone could see the source.
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

patrikG wrote:
when u include that php file into a html doc. , will the html doc show "hello world"?
No - if you have MS Word installed, the browser would launch it and display that file.
I don't understead that answer, he used a php file in a html file.
The php file is genarating "hello world", and it's opening MS Word for that?

I think the correct answer is Yes.
patrikG wrote:However, as McGruff said - e.g. if you have a file "db_connect.inc" which is say the php-file to establish the MySQL-connection AND your haven't set your server to parse files with the extension ".inc" it will be displayed just a normal ".txt"-file, everyone could see the source.
There are 2 way's to do it right.
1. Yust call your include files '.inc.php' instead of '.inc'
2. Put them in a .htaccess forbidden directory. This wil not allow web browser to show your .inc but php stil can access them.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

[]InTeR[], you're right. Too long in front of the computer and your brain fries. You end up seeing "doc" and "document" and the first thing you think of is a bloody MS Word file. :roll:
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

M$ is brainwasing you... 8O 8O 8O
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

resistance is futile :twisted:
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

...must resist...must...not...let...Billy...Boy...take...over...
8O

must...not...

8O
2 seconds later:

"Hello. And where do YOU want to go today?"
:twisted:
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Welcome to the club, you are Microsoft driod number 93,394,595! :D
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Just noticed your new pic Oromian.

This babe thing.. is that what happens when you become a "master"?
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

yup. It's a nessesary self transformation. 8)


...hehe
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Wot?! There really aren't any babes hanging out here? 8O

And I was working so hard to impress all these gorgeous creatures with my coding skills..

Well that's it I'm quitting php right now. :wink:
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

lol

don't do that, you'll see the big secret when you get here. :D
Post Reply