|
|
|
|
![]() ![]() |
Apr 9 2006, 03:38 PM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 258 Joined: 13-November 05 Member No.: 14,234 |
I want to know , if we use some pre-made php script , there are often many files with other extension..i have been watching many times some files names ".lib" . what kind of files these are ... there's written C/C++ inline file.. why these kinds of files are needed in php scripts.. and are there some replacements for it ? (So that we can do things without it ?)... for example im pasting the coding of a file.. ban.lib ..i want to ask, why it is .lib file..why it cant be .php....
CODE <? function file2str($p){if($p=="") return ""; $f=@fopen($p,"r");if(!$f) return ""; $ch="";while(!feof($f)){$ch .=fgetc($f);}return $ch; } function get_ban($p){return file2str($p);} function def_credits($pre=""){global $DCRED_P;return @split("&",file2str($pre.$DCRED_P));} function def_rate($pre=""){global $DRATE_P; $drate=@split("/",file2str($pre.$DRATE_P)); if((!$drate[0]) || (!$drate[1]))return 1/2;return (float)sprintf("%0.2f", $drate[1]/$drate[0]);} function def_affi($pre=""){global $DAFFI_P;$def_affi=file2str($pre.$DAFFI_P);return $def_affi==""?20:$def_affi;}?> |
|
|
|
Apr 9 2006, 04:11 PM
Post
#2
|
|
|
Trap Grand Marshal Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 1,203 Joined: 25-March 05 Member No.: 4,883 |
I believe you can rename and change it to .php extention. It should still work because the content is just a php script regconised by the php engine. If I'm not wrong, you can actually rename and give your php scripts practically any types of extention and include into a real php file. I believe people do this so as any one who edits the script will less likely touch those files as they are usually used by many of the function in the entire program. Hence it is used as a virtually protected php script that is shared among all in the same program.
|
|
|
|
Apr 10 2006, 01:34 AM
Post
#3
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 873 Joined: 30-July 04 Member No.: 246 |
It is most likely that the program will reference the file with that extension - eg. include('file.lib'). As such, I wouldn't recommend changing the extensions unless you change all references to the files accordingly.
It makes no difference as to what extension you use (or if you use an extension at all) if the file is going to be called from within an existing script that has already been executed - it will take the file, and if it contains the appropriate tags (eg. <?php ?>), process that as code. The only potential problem is that if someone tries to access the file directly, it will not be executed, but most likely displayed as plain text, unless you have configured your server to treat that file's extension as a PHP script. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 11th October 2008 - 12:20 PM |