Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- @Autor: SuYaNw Dácio
- @Função: Criar arquivos com formato "Tag=Valor"
- Agradecimento: Bruno da Silva.
- */
- function file_Set($filename, $tag, $val){
- $Internal_F = 0;
- if(file_exists($filename)) $Internal_F = 5;
- if(!file_exists($filename)) $Internal_F = 15;
- $Contend = "";
- if($Internal_F == 5)
- {
- $Arquivo = fopen($filename, "r");
- $Conteudo = fread($Arquivo, filesize($filename));
- $linha = explode("\n", $Conteudo);
- for($i = 0; $i != sizeof($linha); $i ++)
- {
- if(!(strpos($linha[$i], $tag) !== false)){
- if(!is_null($linha[$i])) $Contend .= $linha[$i]."\n";
- }
- }
- fclose($Arquivo);
- unlink($filename);
- $Internal_F = 15;
- }
- if($Internal_F == 15){
- $Contend .= $tag."=".$val;
- $Arquivo = fopen($filename, "w");
- fwrite($Arquivo, $Contend);
- fclose($Arquivo);
- }
- return true;
- }
- // Agradecimentos: Bruno Da Silva.
- function file_Get($fPlayer,$tag)
- {
- $fIni = parse_ini_file($fPlayer);
- return $fIni[$tag];
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement