Loading GPL2.sql +2 −2 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ CREATE TABLE IF NOT EXISTS `labsol2`.`alumno` ( `al_apP` VARCHAR(35) NOT NULL, `al_apM` VARCHAR(35) NULL, `al_correo` VARCHAR(85) NOT NULL, `al_conthash` VARCHAR(50) NOT NULL, `al_conthash` VARCHAR(65) NOT NULL, `al_idinstitucion` INT NOT NULL, PRIMARY KEY (`idalumno`, `al_idinstitucion`), INDEX `fk_alumno_institucion1_idx` (`al_idinstitucion` ASC) , Loading Loading @@ -277,7 +277,7 @@ CREATE TABLE IF NOT EXISTS `labsol2`.`administrador` ( `ad_apP` VARCHAR(35) NOT NULL, `ad_apM` VARCHAR(35) NULL, `ad_correo` VARCHAR(85) NOT NULL, `ad_conthash` VARCHAR(50) NOT NULL, `ad_conthash` VARCHAR(65) NOT NULL, PRIMARY KEY (`idadministrador`)) ENGINE = InnoDB; Loading pages/Register_student.php +2 −2 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ include "../php/registroAl.php"; <div class="box"> <span class="borderLine"></span> <form> <form method="POST"> <h2>Registro de Alumnos</h2> Loading Loading @@ -78,7 +78,7 @@ include "../php/registroAl.php"; <i></i> </div> <input type="submit" value="Inicia sesión"> <input type="submit" name="mandar" value="Inicia sesión"> </form> </div> Loading php/registroAl.php +47 −18 Original line number Diff line number Diff line Loading @@ -11,29 +11,58 @@ if (isset($_POST['mandar'])) { $corr = $_POST['correo']; if (isset($_POST['contraseña'])) { if (isset($_POST['institucion'])) { $sql1 = "SELECT * FROM `solicitante`"; $flag = false; $institucion = $_POST['institucion']; $sqlins = "SELECT * FROM `institucion` WHERE nombre_oficial = '$institucion' "; $resi = $con->query($sqlins); if ($resi->num_rows > 0) { while ($rowi = $resi->fetch_assoc()) { $idInstitucion = $rowi["idinstitucion"]; } $flag = true; } else { $sqlins = "SELECT * FROM `institucion`"; $resi = $con->query($sqlins); if ($resi->num_rows > 0) { while ($rowi = $resi->fetch_assoc()) { $idInstitucion = ($rowi["idinstitucion"]) + 1; } } else { $idInstitucion = 1; } $sqlinsins = "INSERT INTO `institucion` (idinstitucion, nombre_oficial) VALUES ('$idInstitucion','$institucion')"; if ($con->query($sqlinsins) == true) { $flag = true; } else { $flag = false; echo "<br><p style='color: red;'>Error al guardar la institucion de procedencia</p>"; } } if ($flag) { $sql1 = "SELECT * FROM `alumno`"; $res = $con->query($sql1); if ($res->num_rows > 0) { while ($row = $res->fetch_assoc()) { $IdUs = ($row["idusuarios"]) + 1; $IdUs = ($row["idalumno"]) + 1; } } else { $IdUs = 1; } $cont = $_POST['contraseña']; $conthash = password_hash($cont, PASSWORD_DEFAULT); $sql = "INSERT INTO `solicitante` (`idsolicitante`, `so_nombre`, `so_apP`, `so_apM`, `so_conthash`, `so_correo`)VALUES ($IdUs,'$usuario','$app','$apm','$conthash','$corr')"; $sql = "INSERT INTO `alumno` (`idalumno`, `al_nombre`, `al_apP`, `al_apM`, `al_conthash`, `al_correo`, `al_idinstitucion`)VALUES ($IdUs,'$usuario','$app','$apm','$conthash','$corr','$idInstitucion')"; echo $sql; if ($con->query($sql) == true) { header("Location:login.php"); } else { echo "<br><p style='color: red;'>Error al guardar</p>"; echo "<br><p style='color: red;'>Error al guardar usuario</p>"; } $con->close(); } } } else { echo '<p class="errorl">Error, porfavor llene todos los campos</p>'; } Loading Loading
GPL2.sql +2 −2 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ CREATE TABLE IF NOT EXISTS `labsol2`.`alumno` ( `al_apP` VARCHAR(35) NOT NULL, `al_apM` VARCHAR(35) NULL, `al_correo` VARCHAR(85) NOT NULL, `al_conthash` VARCHAR(50) NOT NULL, `al_conthash` VARCHAR(65) NOT NULL, `al_idinstitucion` INT NOT NULL, PRIMARY KEY (`idalumno`, `al_idinstitucion`), INDEX `fk_alumno_institucion1_idx` (`al_idinstitucion` ASC) , Loading Loading @@ -277,7 +277,7 @@ CREATE TABLE IF NOT EXISTS `labsol2`.`administrador` ( `ad_apP` VARCHAR(35) NOT NULL, `ad_apM` VARCHAR(35) NULL, `ad_correo` VARCHAR(85) NOT NULL, `ad_conthash` VARCHAR(50) NOT NULL, `ad_conthash` VARCHAR(65) NOT NULL, PRIMARY KEY (`idadministrador`)) ENGINE = InnoDB; Loading
pages/Register_student.php +2 −2 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ include "../php/registroAl.php"; <div class="box"> <span class="borderLine"></span> <form> <form method="POST"> <h2>Registro de Alumnos</h2> Loading Loading @@ -78,7 +78,7 @@ include "../php/registroAl.php"; <i></i> </div> <input type="submit" value="Inicia sesión"> <input type="submit" name="mandar" value="Inicia sesión"> </form> </div> Loading
php/registroAl.php +47 −18 Original line number Diff line number Diff line Loading @@ -11,29 +11,58 @@ if (isset($_POST['mandar'])) { $corr = $_POST['correo']; if (isset($_POST['contraseña'])) { if (isset($_POST['institucion'])) { $sql1 = "SELECT * FROM `solicitante`"; $flag = false; $institucion = $_POST['institucion']; $sqlins = "SELECT * FROM `institucion` WHERE nombre_oficial = '$institucion' "; $resi = $con->query($sqlins); if ($resi->num_rows > 0) { while ($rowi = $resi->fetch_assoc()) { $idInstitucion = $rowi["idinstitucion"]; } $flag = true; } else { $sqlins = "SELECT * FROM `institucion`"; $resi = $con->query($sqlins); if ($resi->num_rows > 0) { while ($rowi = $resi->fetch_assoc()) { $idInstitucion = ($rowi["idinstitucion"]) + 1; } } else { $idInstitucion = 1; } $sqlinsins = "INSERT INTO `institucion` (idinstitucion, nombre_oficial) VALUES ('$idInstitucion','$institucion')"; if ($con->query($sqlinsins) == true) { $flag = true; } else { $flag = false; echo "<br><p style='color: red;'>Error al guardar la institucion de procedencia</p>"; } } if ($flag) { $sql1 = "SELECT * FROM `alumno`"; $res = $con->query($sql1); if ($res->num_rows > 0) { while ($row = $res->fetch_assoc()) { $IdUs = ($row["idusuarios"]) + 1; $IdUs = ($row["idalumno"]) + 1; } } else { $IdUs = 1; } $cont = $_POST['contraseña']; $conthash = password_hash($cont, PASSWORD_DEFAULT); $sql = "INSERT INTO `solicitante` (`idsolicitante`, `so_nombre`, `so_apP`, `so_apM`, `so_conthash`, `so_correo`)VALUES ($IdUs,'$usuario','$app','$apm','$conthash','$corr')"; $sql = "INSERT INTO `alumno` (`idalumno`, `al_nombre`, `al_apP`, `al_apM`, `al_conthash`, `al_correo`, `al_idinstitucion`)VALUES ($IdUs,'$usuario','$app','$apm','$conthash','$corr','$idInstitucion')"; echo $sql; if ($con->query($sql) == true) { header("Location:login.php"); } else { echo "<br><p style='color: red;'>Error al guardar</p>"; echo "<br><p style='color: red;'>Error al guardar usuario</p>"; } $con->close(); } } } else { echo '<p class="errorl">Error, porfavor llene todos los campos</p>'; } Loading