I recently posted the same question but it has stopped working! I'm trying to enter data into a table in MySql. but I get this error:
Notice: Undefined variable: username in H:\SERVER\htdocs\SITIO2\content\control_register_user.php on line 22
Notice: Undefined variable: apellido in H:\SERVER\htdocs\SITIO2\content\control_register_user.php on line 22
Notice: Undefined variable: email in H:\SERVER\htdocs\SITIO2\content\control_register_user.php on line 22
Notice: Undefined variable: telefono in H:\SERVER\htdocs\SITIO2\content\control_register_user.php on line 22
Notice: Undefined variable: usuario in H:\SERVER\htdocs\SITIO2\content\control_register_user.php on line 22
Notice: Undefined variable: password in H:\SERVER\htdocs\SITIO2\content\control_register_user.php on line 22
Success
the file is as follows:
if you know how to do it in PHP7?
is that I downloaded the latest version of XAMPP and brings this version of PHP
This is the file responsible for inserting everything in MySQL.
I would also like to implement some control that says that the user already exists (if it exists!)
I do not want to abuse you but if you help me with some control for the length of the password, that asks to enter some uppercase, it would be explendido.
Thank you very much in advance !!
control_register_user.php:
session_start();
<?php include_once('header.php'); ?>
<h1>Control Register Usuario</h1>
<?php
define ("MYSQLUSER", "jolunavi");
define ("MYSQLPASS", "688200");
define ("HOSTNAME", "localhost");
define ("MYSQLDB", "msf");
if ($coneccion = @new mysqli (HOSTNAME, MYSQLUSER, MYSQLPASS, MYSQLDB));
if (isset($_REQUEST['user_nombre']) && isset($_REQUEST['user_apellido']) && isset($_REQUEST['user_email']) && isset($_REQUEST['user_telefono']) && isset($_REQUEST['user_usuario']) && isset($_REQUEST['user_password']) && isset($_REQUEST['user_token']))
{
#Asignar a las variable
$nombre = isset($_REQUEST['user_nombre']) ? $_REQUEST['user_nombre'] : '';
$nombre = isset($_REQUEST['user_apellido']) ? $_REQUEST['user_apellido'] : '';
$nombre = isset($_REQUEST['user_email']) ? $_REQUEST['user_email'] : '';
$nombre = isset($_REQUEST['user_telefono']) ? $_REQUEST['user_telefono'] : '';
$nombre = isset($_REQUEST['user_usuario']) ? $_REQUEST['user_usuario'] : '';
$nombre = isset($_REQUEST['user_password']) ? $_REQUEST['user_password'] : '';
$nombre = isset($_REQUEST['user_token']) ? $_REQUEST['user_token'] : '';
$sql = "INSERT INTO usuarios (user_nombre,user_apellido,user_email,user_telefono,user_usuario,user_password) VALUES ('$username','$apellido','$email','$telefono','$usuario','$password')";
$query = mysqli_query($coneccion, $sql);
if (!$query) {
echo "Error</br>";
echo $sql;
}
else {
echo "Success";
}
}
mysqli_close($coneccion);
?>
<?php include_once('footer.php'); ?>
Could you please help me solve?
here is the form:
<?php include_once('header.php'); ?>
<h1>Registrate</h1>
<form action="control_register_user.php" method="post">
<div class="maintform">
<p class="formulario"><label for="name">Nombre: </label> <input placeholder="Ejm: Juan" type="text" name="user_nombre" id="user_nombre" /></p>
<p class="formulario"><label for="name">Apellido:</label> <input placeholder="Ejm: Gutierrez" type="text" name="user_apellido" id="user_apellido" /></p>
<p class="formulario"><label for="name">email: </label> <input placeholder="Ejm: [email protected]"type="text" name="user_email" id="user_email" /></p>
<p class="formulario"><label for="name">telefono:</label> <input placeholder="Ejm: 0931234567"type="text" name="user_telefono" id="user_telefono" /></p>
<p class="formulario"><label for="name">Usuario: </label> <input placeholder="Ejm: Pedrito1980"type="text" name="user_usuario" id="user_usuario" /></p>
<p class="formulario"><label for="name">Contraseña:</label> <input placeholder="Ejm: **************"type="password" name="user_password" id="user_password"/></p>
<p class="formulario">
<input class="ok" type="submit" name="testform" value="Terminado" />
<input class="no_ok" type="reset" name="testform" value="Restablecer" />
<input class="cancel" type="button" value="Cancelar" onclick="window.location.href='../index.php';"/></p>
<br />
<br />
<br />
<?php
$salt = 'SomeSalt';
$token = sha1(mt_rand(1,1000000) . $salt);
$_SESSION['token'] = $token;
?>
<input type="hidden" name="user_token" id="user_token" value="<?php echo $token; ?>"/>
</div>
</form>
<?php include_once('footer.php'); ?>
Thank you very much !!