Advertisement
Guest User

Untitled

a guest
May 11th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <?php
  2.  
  3. function setCredentials() {
  4. echo 'Coloque agora as suas Credenciais Couchbase' . PHP_EOL;
  5.  
  6. echo 'Digite O IP do Couchbase: '. PHP_EOL;
  7.  
  8. $ip = fgets(STDIN);
  9.  
  10. echo 'Digite o Username do Couchbase: '. PHP_EOL;
  11.  
  12. $user = fgets(STDIN);
  13.  
  14. echo 'Digite a Senha do Couchbase: '. PHP_EOL;
  15.  
  16. $senha = fgets(STDIN);
  17.  
  18. return ['ip' => $ip, 'user' => $user, 'senha' => $senha];
  19. }
  20.  
  21. // Testar Conexao Couchbase
  22.  
  23. $credenciais = setCredentials();
  24.  
  25. $conectou = LibCouchBase->connect($credenciais);
  26.  
  27. while($coectou == false)
  28. echo 'Credenciais Invalidas, tente novamente...' . PHP_EOL;
  29.  
  30. setCredentials();
  31. }
  32.  
  33. $arquivoConfig = <<<CONFIG
  34.  
  35. <?php
  36. DB_IP = "$ip";
  37. DB_USERNAME = "$user";
  38. DB_PASS = "$senha";
  39.  
  40. ?>
  41. CONFIG;
  42.  
  43. file_put_contents('Config/Config.php', $arquivoConfig);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement