What does a semicolon do at the beginning of a line?

This is a discussion on What does a semicolon do at the beginning of a line? within the PHP Language forums, part of the PHP Programming Forums category; Was browsing the documentation on reading a configuration file and found this. What does a semicolon do at the beginning ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-14-2003
Bruce W...1
 
Posts: n/a
Default What does a semicolon do at the beginning of a line?

Was browsing the documentation on reading a configuration file and found
this. What does a semicolon do at the beginning of a line?

; <?php DO NOT REMOVE THIS LINE
[first_section]
one = 1
five = 5
[second_section]
path = /usr/local/bin
; DO NOT REMOVE THIS LINE ?>
In order to protect your conf.php file, add these 2 lines, so it
will produce a PARSE ERROR if somebody wants to see your file !

Thanks for your help.
Reply With Quote
  #2 (permalink)  
Old 10-14-2003
Jochen Daum
 
Posts: n/a
Default Re: What does a semicolon do at the beginning of a line?

Hi Bruce!

On Mon, 13 Oct 2003 18:31:21 -0400, "Bruce W...1"
<bruce@noDirectEmail.com> wrote:

>Was browsing the documentation on reading a configuration file and found
>this. What does a semicolon do at the beginning of a line?
>
> ; <?php DO NOT REMOVE THIS LINE
> [first_section]
> one = 1
> five = 5
> [second_section]
> path = /usr/local/bin
> ; DO NOT REMOVE THIS LINE ?>
> In order to protect your conf.php file, add these 2 lines, so it
> will produce a PARSE ERROR if somebody wants to see your file !
>
>Thanks for your help.


Well, in theory, if your webserver ius configured correctly, no one
should be able to see the source code of a PHP file, nor the output,
if it inly contains functions.

But in this case, even if someone does some kind of injection of
parameters (via register globals or whatever) the file will not show
anything, because it produces a parse error.

As the routine reading the config file is quite complex I suppose (in
relation to the config file), the security problem now lies there.

Interesting idea, because I'm not sure, if I like it.

HTH, jochen




--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Reply With Quote
  #3 (permalink)  
Old 10-14-2003
Tiago Serafim
 
Posts: n/a
Default Re: What does a semicolon do at the beginning of a line?

"Bruce W...1" <bruce@noDirectEmail.com> wrote in message news:<3F8B27B9.319CEC8@noDirectEmail.com>...
> Was browsing the documentation on reading a configuration file and found
> this. What does a semicolon do at the beginning of a line?
>
> ; <?php DO NOT REMOVE THIS LINE
> [first_section]
> one = 1
> five = 5
> [second_section]
> path = /usr/local/bin
> ; DO NOT REMOVE THIS LINE ?>
> In order to protect your conf.php file, add these 2 lines, so it
> will produce a PARSE ERROR if somebody wants to see your file !
>
> Thanks for your help.


Semilcon is a commenting. It is used to ingore the entire line.
And if somebody try to access your file directly
http://yourhost/conf.php the tags "<?php" and "?>" will work and php
will thrown an error


Tiago Serafim
Reply With Quote
  #4 (permalink)  
Old 10-14-2003
Michael Willcocks
 
Posts: n/a
Default Re: What does a semicolon do at the beginning of a line?

Well it just parse errors.. being a config file makes me think thats why

but that isn't php code inside those tags..



"Bruce W...1" <bruce@noDirectEmail.com> wrote in message
news:3F8B27B9.319CEC8@noDirectEmail.com...
> Was browsing the documentation on reading a configuration file and found
> this. What does a semicolon do at the beginning of a line?
>
> ; <?php DO NOT REMOVE THIS LINE
> [first_section]
> one = 1
> five = 5
> [second_section]
> path = /usr/local/bin
> ; DO NOT REMOVE THIS LINE ?>
> In order to protect your conf.php file, add these 2 lines, so it
> will produce a PARSE ERROR if somebody wants to see your file !
>
> Thanks for your help.



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:37 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0