Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(true && true){}
- include "../class/class.conexion.php";
- include "define.urls.php";
- $db = new Conexion();
- if (isset($_POST["name"])) {
- $name = $_POST["name"]; // Nombre real del usuario
- $username = $_POST["username"]; // Nombre de usuario o nickname
- $email = $_POST["email"]; // Email del usuario
- $password = password_hash($_POST["password"], PASSWORD_DEFAULT); // ContraseƱa del usuario
- $imagen_de_perfil = website_images."/profile-image-lyrians.png"; // Imagen de perfil por defecto
- $imagen_de_portada = website_images."/profile-cover-lyrians.png";
- $rango = "novato"; // Rango inicial del usuario
- $descripcion = NULL;
- $confirmacion = "no confirmado";
- // Notification
- $id_notification = NULL;
- $notificacion = htmlentities("http://unapagina.com;Gracias por formar parte de esta comunidad;Te recomiendo leer este post");
- $time = time(); // Tiempo exacto de la notificacion
- $idAdmin = 1;
- // Verifico si en la tabla users no hay ningun usuario con el mismo EMAIL o USERNAME
- if ($verify = $db->prepare("SELECT username, email FROM users WHERE username = ? OR email = ?")) {
- $verify->bind_param("ss", $username, $email);
- $verify->execute();
- $verify->store_result();
- $verify->bind_result($username, $email);
- if ($verify->num_rows > 0) {
- echo "0";
- $verify->close();
- } else{
- $user = $db->prepare("INSERT INTO users (user_image,
- user_cover_page,
- username,
- user_description,
- email,
- password,
- name,
- rango,
- email_confirmation,
- user_register_date) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
- $notification = $db->prepare("INSERT INTO notifications (notification_user,
- notification_send_user,
- notification_title,
- notification_datetime) VALUES (?, ?, ?, ?)");
- $user->bind_param("sssssssssi", $imagen_de_perfil,
- $imagen_de_portada,
- $username,
- $descripcion,
- $email,
- $password,
- $name,
- $rango,
- $confirmacion,
- $time);
- if ($user->execute()) {
- $userID = $user->insert_id;
- $notification->bind_param("iisi", $userID, $idAdmin, $notificacion, $time);
- if ($notification->execute()) {
- echo "1";
- } else{
- echo "notification";
- }
- $user->close();
- $notification->close();
- }
- }
- } else{
- echo $db->error;
- }
- }
Add Comment
Please, Sign In to add comment