Advertisement
Guest User

mensaje.php

a guest
Aug 9th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. <?php
  2. // Nos llega el POST desde el formulario de chat_pie.php...
  3. header('Content-Type: text/html; charset=UTF-8');
  4. ini_set('display_errors',1);
  5. ini_set('display_startup_errors',1);
  6. error_reporting(-1);
  7.  
  8. $bd_hostname = 'localhost';
  9. $bd_username = 'root';
  10. $bd_password = '16032201';
  11. $bd_basename = 'gusanonet';
  12.  
  13. $con =  mysql_connect($bd_hostname, $bd_username, $bd_password);
  14. mysql_select_db($bd_basename,$con)or die ($sqldb_err.': '.mysql_error());
  15. mysql_set_charset('utf8');
  16.  
  17.  
  18. $mensaje = preg_match(ā€œ^[p{L}a-z0-9s]+$/uā€, $_POST['mensaje']);
  19.  
  20.  
  21.  
  22. $sql = "INSERT INTO `gusanonet`.`historialchat` (`id`, `nick`, `mensaje`) VALUES (NULL, '".$_POST['nick']."', '".$mensaje."');";
  23. mysql_query($sql)or die ($sqldb_err.': '.mysql_error());
  24. echo $sql;
  25. echo $mensaje;
  26. /*if (isset($_SERVER["HTTP_REFERER"])) {
  27.     header("Location: " . $_SERVER["HTTP_REFERER"]."?nick=".$_POST['nick']);
  28. }*/
  29.  
  30.  
  31.  
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement