Advertisement
Guest User

Untitled

a guest
Apr 29th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. <?php
  2. class chatController extends controller {
  3.  
  4. public function __construct() {
  5. parent::__construct();
  6. }
  7.  
  8. public function index() {
  9. $dados = array('nome'=>'');
  10.  
  11. $c = new Chamados();
  12.  
  13. if(isset($_GET['id']) && !empty($_GET['id'])) {
  14. $id = addslashes($_GET['id']);
  15. $c->updateStatus($id, '1');
  16.  
  17. $_SESSION['chatwindow'] = $id;
  18. }
  19. elseif(isset($_POST['nome']) && !empty($_POST['nome'])) {
  20. $nome = addslashes($_POST['nome']);
  21. $ip = $_SERVER['REMOTE_ADDR'];
  22. $data_inicio = date('H:i:s');
  23.  
  24. $_SESSION['chatwindow'] = $c->addChamado($ip, $nome, $data_inicio);
  25. }
  26.  
  27. if(!isset($_SESSION['chatwindow']) || empty($_SESSION['chatwindow'])) {
  28. $this->loadTemplate('newchamado', $dados);
  29. exit;
  30. }
  31.  
  32. $idchamado = $_SESSION['chatwindow'];
  33. $chamado = $c->getChamado($idchamado);
  34. $dados['nome'] = $chamado['nome'];
  35.  
  36. $this->loadTemplate('chat', $dados);
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement