note 66518 added to function.include
| From: | (at_heath0tmai1dotcom) | Date: | Wed, 24 May 2006 23:00:08 +0000 |
| Subject: | note 66518 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-111972@lists.php.net to get a copy of this message | ||
.
it seems you can include any text file with valid php syntax (including the <?php ?> flags),
not only *.php ones
it seems you can delete a file just once included
example:
---------------------------
<?php
$configfile="/path/to/configfile.cfg"; #not only php ones
if(file_exists($configfile)){
include $configfile;
unlink($configfile); # for security and data consistency
# now you can still do something
# with already included
# vars and functions
}else{
echo "config file not found!";
}
?>
------------------------
example
configfile.cfg:
-------------------------
<?php
$retries=5;
$datafile="/path/to/datafile";
function writeline($message){
echo $message."<br>\r\n";
}
?>
-------------------------
saludos :)
.
----
Server IP: 200.24.234.70
Probable Submitter: 201.246.77.124
----
X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HTML_MESSAGE autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.include.php
Edit -- http://master.php.net/note/edit/66518
Del: integrated -- http://master.php.net/note/delete/66518/integrated
Del: useless -- http://master.php.net/note/delete/66518/useless
Del: bad code -- http://master.php.net/note/delete/66518/bad+code
Del: spam -- http://master.php.net/note/delete/66518/spam
Del: non-english -- http://master.php.net/note/delete/66518/non-english
Del: in docs -- http://master.php.net/note/delete/66518/in+docs
Del: other reasons-- http://master.php.net/note/delete/66518
Reject -- http://master.php.net/note/reject/66518
Search -- http://master.php.net/manage/user-notes.php