Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1. <?php
  2.  
  3.     function print_chat($mysqli, $query)
  4.     {      
  5.         if ($stmt = $mysqli->prepare($query))
  6.         {
  7.             $stmt->execute();
  8.             $stmt->bind_result($id, $username, $msg, $timestamp);
  9.            
  10.             while ($stmt->fetch())
  11.             {
  12.                 printf ("<span>%s</span> <b>%s</b>: %s\n\r", $timestamp, $username, htmlspecialchars($msg));
  13.                 print ("<br />");
  14.             }
  15.            
  16.             $stmt->close();
  17.         }      
  18.     }
  19.    
  20.     function post_msg($mysqli, $query)
  21.     {
  22.         $stmt = $mysqli->prepare($query);
  23.         $stmt->execute();
  24.     }
  25.    
  26.     function users($mysqli, $query)
  27.     {
  28.         if ($result = $mysqli->query($query)) {
  29.        
  30.             while ($row = $result->fetch_row()) {
  31.  
  32.                 if ($row[0] == $mysqli->real_escape_string($_POST['username']))
  33.                 {
  34.                     if ($row[1] == sha1($mysqli->real_escape_string($_POST['password'])))
  35.                     {
  36.                         $_SESSION['login'] = $row[0];
  37.                     }
  38.                 }
  39.            
  40.             }
  41.         }
  42.        
  43.     }
  44.    
  45. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement