Advertisement
Guest User

PHP

a guest
Dec 29th, 2013
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. <?php require_once('Connections/Eventos.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6. if (PHP_VERSION < 6) {
  7. $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8. }
  9.  
  10. $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12. switch ($theType) {
  13. case "text":
  14. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15. break;
  16. case "long":
  17. case "int":
  18. $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19. break;
  20. case "double":
  21. $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22. break;
  23. case "date":
  24. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25. break;
  26. case "defined":
  27. $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28. break;
  29. }
  30. return $theValue;
  31. }
  32. }
  33.  
  34. $editFormAction = $_SERVER['PHP_SELF'];
  35. if (isset($_SERVER['QUERY_STRING'])) {
  36. $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  37. }
  38.  
  39. if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form")) {
  40. $insertSQL = sprintf("INSERT INTO ``user`` (user_name, user_nick, user_email, user_pass) VALUES (%s, %s, %s, %s)",
  41. GetSQLValueString($_POST['user_name'], "text"),
  42. GetSQLValueString($_POST['user_nick'], "text"),
  43. GetSQLValueString($_POST['user_email'], "text"),
  44. GetSQLValueString($_POST['user_pass'], "text"));
  45.  
  46. mysql_select_db($database_Eventos, $Eventos);
  47. $Result1 = mysql_query($insertSQL, $Eventos) or die(mysql_error());
  48.  
  49. $insertGoTo = "index.php";
  50. if (isset($_SERVER['QUERY_STRING'])) {
  51. $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
  52. $insertGoTo .= $_SERVER['QUERY_STRING'];
  53. }
  54. header(sprintf("Location: %s", $insertGoTo));
  55. }
  56.  
  57. mysql_select_db($database_Eventos, $Eventos);
  58. $query_Recordset1 = "SELECT * FROM `user`";
  59. $Recordset1 = mysql_query($query_Recordset1, $Eventos) or die(mysql_error());
  60. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  61. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  62. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement