Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.87 KB | None | 0 0
  1. <?php require_once('../Connections/Cursoweb.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. $currentPage = $_SERVER["PHP_SELF"];
  35.  
  36. $editFormAction = $_SERVER['PHP_SELF'];
  37. if (isset($_SERVER['QUERY_STRING'])) {
  38. $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  39. }
  40.  
  41. if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  42. $insertSQL = sprintf("INSERT INTO usuarios (Id, Nombre, Email, `Url Web`, Usuario, Contrasena) VALUES (%s, %s, %s, %s, %s, %s)",
  43. GetSQLValueString($_POST['Id'], "int"),
  44. GetSQLValueString($_POST['Nombre'], "text"),
  45. GetSQLValueString($_POST['Email'], "text"),
  46. GetSQLValueString($_POST['Url_Web'], "text"),
  47. GetSQLValueString($_POST['Usuario'], "text"),
  48. GetSQLValueString($_POST['Contrasena'], "text"));
  49.  
  50. $Result1 = mysqli_query($Cursoweb, $insertSQL) or die(mysqli_error());
  51. }
  52.  
  53. $maxRows_Recordset1 = 10;
  54. $pageNum_Recordset1 = 0;
  55. if (isset($_GET['pageNum_Recordset1'])) {
  56. $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
  57. }
  58. $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
  59.  
  60. $query_Recordset1 = "SELECT * FROM usuarios";
  61. $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
  62. $Recordset1 = mysqli_query($Cursoweb, $query_limit_Recordset1) or die(mysqli_error());
  63. $row_Recordset1 = mysqli_fetch_assoc($Recordset1);
  64.  
  65. if (isset($_GET['totalRows_Recordset1'])) {
  66. $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
  67. } else {
  68. $all_Recordset1 = mysqli_query($Cursoweb, $query_Recordset1);
  69. $totalRows_Recordset1 = mysqli_num_rows($all_Recordset1);
  70. }
  71. $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
  72.  
  73. $queryString_Recordset1 = "";
  74. if (!empty($_SERVER['QUERY_STRING'])) {
  75. $params = explode("&", $_SERVER['QUERY_STRING']);
  76. $newParams = array();
  77. foreach ($params as $param) {
  78. if (stristr($param, "pageNum_Recordset1") == false &&
  79. stristr($param, "totalRows_Recordset1") == false) {
  80. array_push($newParams, $param);
  81. }
  82. }
  83. if (count($newParams) != 0) {
  84. $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
  85. }
  86. }
  87. $queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
  88. ?>
  89. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  90. <html xmlns="http://www.w3.org/1999/xhtml">
  91. <head>
  92. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  93. <title>Documento sin título</title>
  94. <script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
  95. <link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
  96. </head>
  97.  
  98. <body>
  99. <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
  100. <table align="center">
  101. <tr valign="baseline">
  102. <td nowrap="nowrap" align="right">Id:</td>
  103. <td><input type="text" name="Id" value="" size="32" /></td>
  104. </tr>
  105. <tr valign="baseline">
  106. <td nowrap="nowrap" align="right">Nombre:</td>
  107. <td><input type="text" name="Nombre" value="" size="32" /></td>
  108. </tr>
  109. <tr valign="baseline">
  110. <td nowrap="nowrap" align="right">Email:</td>
  111. <td><input type="text" name="Email" value="@" size="32" /></td>
  112. </tr>
  113. <tr valign="baseline">
  114. <td nowrap="nowrap" align="right">Url Web:</td>
  115. <td><input type="text" name="Url_Web" value="http://" size="32" /></td>
  116. </tr>
  117. <tr valign="baseline">
  118. <td nowrap="nowrap" align="right">Usuario:</td>
  119. <td><input type="text" name="Usuario" value="" size="32" /></td>
  120. </tr>
  121. <tr valign="baseline">
  122. <td nowrap="nowrap" align="right">Contrasena:</td>
  123. <td><input type="password" name="Contrasena" value="" size="32" /></td>
  124. </tr>
  125. <tr valign="baseline">
  126. <td nowrap="nowrap" align="right">&nbsp;</td>
  127. <td><input type="submit" class="textfieldFlashText" value="Registrarse" />
  128.  
  129. </tr>
  130. </table>
  131. <input type="hidden" name="MM_insert" value="form1" />
  132. </form>
  133. <form id="form2" name="form2" method="post" action="">
  134. <input type="radio" name="radio" id="radio" value="radio" />
  135. <label for="radio">Acepto <a href="Registrousuario.php" title="TERMINOS Y CONDICIONES" target="_top"><a href="terminosycondiciones.php" title="Terminos y Condiciones" target="_top"><a href="terminosycondiciones.php" title="Terminos y Condciones" target="_top">Terminos y condiciones</a></a></a></label>
  136. </form>
  137. <span id="sprytextfield1">
  138. <label for="text1"></label>
  139. <span class="textfieldRequiredMsg">Se necesita un valor.</span></span>
  140. <p>&nbsp;</p>
  141. <script type="text/javascript">
  142. var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
  143. </script>
  144. </body>
  145. </html>
  146. <?php
  147. mysqli_free_result($Recordset1);
  148. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement