D
D
Develm2016-01-25 21:58:59
PHP
Develm, 2016-01-25 21:58:59

From what the Russian characters as signs can be written down in a DB???

In general, in order not to invent a bicycle, so to speak, I downloaded boomchat but it does not have Russian, and so in the profile info, Russian norms are recorded, but question marks go into the chat.
What do you suggest to watch?

require_once("config_min.php"); 
$user_ip = $mysqli->real_escape_string($_SERVER['REMOTE_ADDR']);
if (isset($_POST['content']) && isset($_POST['bold']) 
  && isset($_POST['italic']) && isset($_POST['underline']) 
  && isset($_POST['color']) && isset($_POST['high']) && $user['user_access'] > 3){

  if ($_POST['content'] != null){
    
    $bold = $mysqli->real_escape_string(trim($_POST['bold']));
    $italic = $mysqli->real_escape_string(trim($_POST['italic']));
    $underline = $mysqli->real_escape_string(trim($_POST['underline']));
    $chigh = $mysqli->real_escape_string(trim($_POST['high']));
    $ccolor = $mysqli->real_escape_string(trim($_POST['color']));
    $content = $mysqli->real_escape_string(trim($_POST['content']));
    $content = htmlspecialchars($content);
    $content = "$content ";
    
    // clear bad word from content
    $words = $mysqli->query("SELECT * FROM `filter`");
    if ($words->num_rows > 0){
      while($filter = $words->fetch_assoc()){
      $content = str_replace($filter['word'], '****',$content);
      }
    }
    $name = $user['user_name'];
    $room = $user['user_roomid'];
    $user_id = $user["user_id"];
    $post_time = date("H:i", $time);
    $command = explode(' ',trim($content));
    $count = count($command);
    $color = $user["user_color"];
    $avatar = $user['user_tumb'];

    // check for the /away command that will set the user away till he/her type in chat
    if(substr($command[0], 0, 1) === '/')
    {	
    
      if ($command[0] == $cmdaway){	
        $mysqli->query("UPDATE `users` SET `user_action` = '2', `user_status` = '2' WHERE `user_id` = '$user_id'");
        echo 15;
        die();
      }				
      

      // Here the check for a command of kick before pasting a message to the chat
      
      elseif($command[0] == $cmdkick && $user['user_rank'] > 2){
        if($count != 1){
          
          $findtarget = $mysqli->query("SELECT `user_rank`, `user_access` FROM `users` WHERE `user_name` = '{$command[1]}'");
          
          if ($findtarget->num_rows > 0){
          
            $target = $findtarget->fetch_array(MYSQLI_BOTH);
            $target_rank = $target['user_rank'];
            
            if ($user['user_rank'] > $target_rank){
            
              $kickmessage = explode($command[1],trim($content));
              $displaykick = $msgkickreason;
              
              if($count > 2){
                $displaykick = $kickmessage[1];
              }
              if($target['user_access'] == 4){
                $kickreason = $displaykick;
                $kicknotice = $command[1] . " $msgkick " . $name . " ( $kickreason )";
                $mysqli->query("UPDATE `users` SET `user_access` = 2, `user_kick` = '$displaykick', `user_status` = '3' WHERE `user_name` = '{$command[1]}'");
                $mysqli->query("INSERT INTO `chat` (post_date, post_time, user_id, post_user, post_message, post_roomid, post_color, type, avatar) VALUES ('$time', '$post_time', '$user_id', '$lang_system', '$kicknotice', $room, 'csystem', 'system', 'default_system_tumb.png')");
              }
              else {
                echo 12;
              }
            }
            
            else{
              echo 3;
            }
            
          }
          
          else {
            echo 2;
          }
          
        }
        else{
          echo 1;
        }
        
      }

post_message is the chat message

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Develm, 2016-01-25
@Develm

I forgot to look at the base encoding)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question