itssami 0 Report post Posted April 9, 2006 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.... <? 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;}?> Notice from mayank: Dont forget to add CODE tag to the code you are pasting in the post Share this post Link to post Share on other sites
Inspiron 0 Report post Posted April 9, 2006 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. Share this post Link to post Share on other sites
Spectre 0 Report post Posted April 10, 2006 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. Share this post Link to post Share on other sites