PageRenderTime 26ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/collectiveChat/Handlers/Exit.php

https://bitbucket.org/imasters/collectivesense
PHP | 24 lines | 19 code | 5 blank | 0 comment | 2 complexity | bc12bf6561d570c00206fda5bf1b4249 MD5 | raw file
  1. <?php
  2. require_once '../Config.php' ;
  3. require_once '../Replace.php';
  4. $uid = isset ( $_REQUEST [ 'uid' ] ) ? $_REQUEST [ 'uid' ] : false ;
  5. $nickname = isset ( $_REQUEST [ 'nickname' ] ) ? $_REQUEST [ 'nickname' ] : false ;
  6. if ( $uid !== false && $nickname !== false ) {
  7. $db = getDbConnection ( ) ;
  8. $stmt = $db->prepare ( 'UPDATE `users` SET `status` = 0 WHERE `uid` = ?' ) ;
  9. $stmt->execute ( array ( $uid ) ) ;
  10. $replace = replace ( array (
  11. 'uid' => $uid ,
  12. 'nickname' => $nickname
  13. ) , UserOut ) ;
  14. $stmt = $db->prepare ( 'INSERT INTO `messages`( `uid`, `text` ) VALUES ( ? , ? )' ) ;
  15. $stmt->bindValue ( 1 , $uid , PDO::PARAM_INT ) ;
  16. $stmt->bindValue ( 2 , $replace , PDO::PARAM_STR ) ;
  17. $stmt->execute ( ) ;
  18. exit ;
  19. }