Guest User

Untitled

a guest
Jan 19th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.98 KB | None | 0 0
  1. <?php require_once('Connections/config.php'); ?>
  2. <?php
  3. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  4. {
  5.   $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
  6.  
  7.   switch ($theType) {
  8.     case "text":
  9.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  10.       break;    
  11.     case "long":
  12.     case "int":
  13.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  14.       break;
  15.     case "double":
  16.       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  17.       break;
  18.     case "date":
  19.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  20.       break;
  21.     case "defined":
  22.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  23.       break;
  24.   }
  25.   return $theValue;
  26. }
  27.  
  28. $editFormAction = $_SERVER['PHP_SELF'];
  29. if (isset($_SERVER['QUERY_STRING'])) {
  30.   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  31. }
  32.  
  33. if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "register")) {
  34.   $insertSQL = sprintf("INSERT INTO microb (Nombre, Apellido, Pais, Ciudad, Usuario, Password, Email) VALUES (%s, %s, %s, %s, %s, %s, %s)",
  35.                        GetSQLValueString($_POST['Nombre'], "text"),
  36.                        GetSQLValueString($_POST['Apellido'], "text"),
  37.                        GetSQLValueString($_POST['Pais'], "text"),
  38.                        GetSQLValueString($_POST['Ciudad'], "text"),
  39.                        GetSQLValueString($_POST['Usuario'], "text"),
  40.                        GetSQLValueString($_POST['Password'], "text"),
  41.                        GetSQLValueString($_POST['Email'], "text"));
  42.  
  43.   mysql_select_db($database_config, $config);
  44.   $Result1 = mysql_query($insertSQL, $config) or die(mysql_error());
  45.  
  46.   $insertGoTo = "success.php";
  47.   if (isset($_SERVER['QUERY_STRING'])) {
  48.     $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
  49.     $insertGoTo .= $_SERVER['QUERY_STRING'];
  50.   }
  51.   header(sprintf("Location: %s", $insertGoTo));
  52. }
  53.  
  54. mysql_select_db($database_config, $config);
  55. $query_config = "SELECT * FROM microb";
  56. $config = mysql_query($query_config, $config) or die(mysql_error());
  57. $row_config = mysql_fetch_assoc($config);
  58. $totalRows_config = mysql_num_rows($config);
  59. ?><head>
  60. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  61. <title>Microblogging - Register</title>
  62. <link href="style.css" rel="stylesheet" type="text/css" />
  63. </head>
  64. <body class="body">
  65.  
  66. <div class="logo"></div>
  67.  
  68. <div class="register">
  69.  
  70. <div class="bienvenida" align="center"><a>
  71.   <p>Ingresa toda la informacion necesaria</p>
  72.   <p> para poder formar parte de nuestra red social  .</p>
  73. </div>
  74.  
  75. <div class="register2" align="right">
  76.   <form name="register" method="POST" action="<?php echo $editFormAction; ?>">
  77.     <label>Nombre:
  78.     <input type="text" name="Nombre" class="form2">
  79.     </label>
  80.     <p>
  81.       <label>Apellido:
  82.       <input type="text" name="Apellido" class="form2">
  83.       </label>
  84.     </p>
  85.     <p>
  86.       <label>Pais:
  87.       <input type="text" name="Pais" class="form2">
  88.       </label>
  89.     </p>
  90.     <p>
  91.       <label>Ciudad:
  92.       <input type="text" name="Ciudad" class="form2">
  93.       </label>
  94.     </p>
  95.     <p>
  96.       <label>Usuario:
  97.       <input type="text" name="Usuario" class="form2">
  98.       </label>
  99.     </p>
  100.     <p>
  101.       <label>Password:
  102.       <input type="text" name="Password" class="form2">
  103.       </label>
  104.     </p>
  105.     <p>
  106.       <label>Email:
  107.       <input type="text" name="Email" class="form2">
  108.       </label>
  109.     </p>
  110.     <p>
  111.       <label>
  112.       <input type="submit" name="submit" value="Registrarme" class="conectar">
  113.       </label>
  114.     </p>
  115.     <input type="hidden" name="MM_insert" value="register">
  116.   </form>
  117.   </div>
  118.  
  119. </div>
  120. <div class="footer">
  121.  
  122. <div class="copyright" align="center">Microblogging &copy; 2011 · Inicio | Acerca de | Terminos de uso | Privacidad | Contactenos</div>
  123.  
  124. </div>
  125. </body>
  126. </html><?php
  127. mysql_free_result($config);
  128. ?>
Add Comment
Please, Sign In to add comment