Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     $imoveis = array();
  3.     $quebra = chr(13).chr(10);
  4.     $arq = fopen("imo/imoveis.txt", "r");
  5.     while (!feof($arq)){
  6.        array_push($imoveis, explode(";", fgets($arq)));
  7.     }
  8.     fclose($arq);
  9.     $arq = fopen("imo/imoveis.txt", "w");
  10.     for ($imoveis as $imovel) {
  11.        if ($_POST['imovel'] === $imovel[0]) { // verifica se a posição 0 (endereço) é igual a digita no imovel
  12.            $imovel[2] = "locado"; // altera a posição 2 (status) pra locado
  13.        }
  14.        fputs($file, implode(";", $imovel) . ";$quebra"); // sobrescreve arquivo
  15.     }
  16.     fclose($arq);
  17.  ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement