PageRenderTime 38ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/sys/plugins/classes/user.mess.php

https://bitbucket.org/DESURE/dcms
PHP | 20 lines | 13 code | 7 blank | 0 comment | 1 complexity | 75a41286e416cab4593147cbd6d7f111 MD5 | raw file
  1. <?php
  2. function user_mess($user, $args) {
  3. if (!$user->id) {
  4. return false;
  5. }
  6. $msg = $args[0];
  7. $id_user = empty($args[1]) ? 0 : $args[1];
  8. mysql_query("UPDATE `users` SET `mail_new_count` = `mail_new_count` + '1' WHERE `id` = '" . $user->id . "' LIMIT 1");
  9. mysql_query("INSERT INTO `mail` (`id_user`,`id_sender`,`time`,`mess`)
  10. VALUES ('" . $user->id . "', '$id_user', '" . TIME . "', '" . my_esc($msg) . "' )");
  11. return true;
  12. }
  13. ?>