Sh3ll



Directory :  /home/zjabogados/public_html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

Current File : /home/zjabogados/public_html/cambiar_clave.php
<?php

session_start();

$motorBD = $_SESSION['motorBD'];

$idusuario = $_SESSION['idusuario'];

require_once("../Connections/$motorBD.php"); 

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html><!-- InstanceBegin template="/Templates/Contenido.dwt.php" codeOutsideHTMLIsLocked="false" -->

<head>

<!-- InstanceBeginEditable name="doctitle" -->

<title>Documento sin t&iacute;tulo</title>

<!-- InstanceEndEditable --><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">

<!--

body {

	background-color: #FFFFFF;

	margin-left: 0px;

	margin-top: 0px;

}

body,td,th {

	font-family: Verdana, Arial, Helvetica, sans-serif;

	font-size: 9px;

}

-->

</style>

<!-- InstanceBeginEditable name="head" -->

<style type="text/css">

<!--

.Estilo1 {font-size: 12px}

.Estilo4 {

	font-size: 12px;

	font-weight: bold;

	color: #FF0000;

}

.Estilo5 {color: #FFFFFF}

.Estilo7 {font-size: 12px; font-weight: bold; color: #FFFFFF; }

-->

</style>

<!-- InstanceEndEditable -->

</head>



<body>

<table border="0" cellpadding="0" cellspacing="0">

  <tr>

    <td><table border="0" align="center" cellpadding="0" cellspacing="10">

      <tr>

        <td><!-- InstanceBeginEditable name="Contenido" -->

          <table border="0" cellspacing="0" cellpadding="0">

            <tr>

              <td><table width="100%" border="0" cellpadding="0" cellspacing="0">

                <tr>

                  <td width="28"><img src="img/tabla_tit_izq.jpg" width="28" height="40"></td>

                  <td valign="bottom" background="img/tabla_tit_med.jpg"><table border="0" cellspacing="8" cellpadding="1">

                      <tr>

                        <td><span class="Estilo5"><strong>CAMBIAR USUARIO Y CLAVE PERSONAL </strong></span></td>

                      </tr>

                  </table></td>

                  <td width="28"><img src="img/tabla_tit_der.jpg" width="28" height="40"></td>

                </tr>

              </table></td>

              </tr>

            <tr>

              <td><table width="100%" border="0" cellspacing="0" cellpadding="0">

                  <tr>

                    <td width="13" background="img/tabla_cont_izq.jpg">&nbsp;</td>

                    <td bgcolor="#80C9EC"><table width="100%" border="0" cellspacing="4" cellpadding="4">

                      <tr>

                        <td><form action="" method="post" name="form1" id="form1">

                          <table width="300" border="0" align="center" cellpadding="2" cellspacing="0">

    <tr bgcolor="#666666">

      <td colspan="2"><div align="center" class="Estilo7">CAMBIO DE CLAVE Y USUARIO </div></td>

    </tr>

    <tr bgcolor="#FFFFFF">

      <td><div align="right">USUARIO ACTUAL </div></td>

      <td><input name="usuario_a" type="text" id="usuario_a" /></td>

    </tr>

    <tr bgcolor="#FFFFFF">

      <td><div align="right">CLAVE ACTUAL </div></td>

      <td><input name="clave_a" type="password" id="clave_a" /></td>

    </tr>

    <tr bgcolor="#CCCCCC">

      <td><div align="right"></div></td>

      <td>&nbsp;</td>

    </tr>

    <tr bgcolor="#FFFFFF">

      <td><div align="right">NUEVO USUARIO </div></td>

      <td><input name="usuario_n" type="text" id="usuario_n" /></td>

    </tr>

    <tr bgcolor="#FFFFFF">

      <td><div align="right">NUEVA CLAVE </div></td>

      <td><input name="clave_n" type="password" id="clave_n" /></td>

    </tr>

    <tr bgcolor="#FFFFFF">

      <td><div align="right">REPETIR NUEVA CLAVE</div></td>

      <td><input name="clave_n2" type="password" id="clave_n2" /></td>

    </tr>

    <tr>

      <td colspan="2"><div align="center">

        <input type="submit" name="Submit" value="Cambiar" />

        <input name="paso" type="hidden" id="paso" value="1" />

      </div></td>

    </tr>

  </table>

</form>

                         

				<?php 

		  if ($_POST['paso'] == 1) {

		  	$usuario_a = $_POST['usuario_a'];

		  	$clave_a = md5($_POST['clave_a']);

		  	$usuario_n = $_POST['usuario_n'];

		  	$clave_n = md5($_POST['clave_n']);

		  	$clave_n2 = md5($_POST['clave_n2']);



			$mensaje = '';



			mysql_select_db($database_laprida, $conexion);

			$query_rs_usuario = "SELECT id_usuario FROM tb_usuario WHERE usuario = '$usuario_a' and clave = '$clave_a' and id_usuario = $idusuario";

			$rs_usuario = mysql_query($query_rs_usuario, $conexion) or die(mysql_error());

			$row_rs_usuario = mysql_fetch_assoc($rs_usuario);

			$totalRows_rs_usuario = mysql_num_rows($rs_usuario);

			

			if ($totalRows_rs_usuario == 1) {

				$id_usuario = $row_rs_usuario['id_usuario'];



				$query_rs_usuario2 = "SELECT id_usuario FROM tb_usuario WHERE usuario = '$usuario_n' and id_usuario <> $id_usuario";

				$rs_usuario2 = mysql_query($query_rs_usuario2, $conexion) or die(mysql_error());

				$row_rs_usuario2 = mysql_fetch_assoc($rs_usuario2);

				$totalRows_rs_usuario2 = mysql_num_rows($rs_usuario2);



				if ($totalRows_rs_usuario2 > 0) {

					$mensaje = 'EL NOMBRE DE USUARIO <b>'.$usuario_n.'</b> YA EXISTE EN LA BASE DE DATOS, INGRESE UN USUARIO DIFERENTE';

					}				

				else {

					if ($clave_n <> $clave_n2) {

						$mensaje = 'INGRESE CORRECTAMENTE LA CLAVE Y SU REPETICI&Oacute;N. LAS MISMAS NO COINCIDEN';

						}

					else {

						$query_rs_usuario3 = "UPDATE tb_usuario SET usuario = '$usuario_n', clave = '$clave_n' WHERE id_usuario = $id_usuario";

						$rs_usuario3 = mysql_query($query_rs_usuario3, $conexion) or die(mysql_error());					

						}

					}

				mysql_free_result($rs_usuario2);				

				}

			else {

				$mensaje = 'USUARIO O CLAVE INCORRECTO';

				}

			mysql_free_result($rs_usuario);			

			if ($mensaje == '') {

			?>

				<table width="100%" border="0" cellspacing="2" cellpadding="2">

                  <tr>

                    <td bgcolor="#009900"><div align="center" class="Estilo7"><strong>FELICITACIONES</strong></div></td>

                  </tr>

                  <tr>

                    <td bgcolor="#FFFFFF"><div align="center" class="Estilo1"><strong><?php echo "LOS CAMBIOS HAN SIDO EFECTUADOS CORRECTAMENTE"?></strong></div></td>

                  </tr>

                </table>

				<?php

				}

			else {

			?>

				

                          <table width="300" border="0" cellspacing="2" cellpadding="2">

                            <tr>

                              <td bgcolor="#000000"><div align="center" class="Estilo7">ERROR</div></td>

                            </tr>

                            <tr>

                              <td bgcolor="#FF0000"><div align="center"><span class="Estilo4"><span class="Estilo5"><?php echo $mensaje;?></span></span></div></td>

                            </tr>

                          </table>

                          <?php 

				}

		  	}

		   ?></td>

                      </tr>

                    </table></td>

                    <td width="13" background="img/tabla_cont_der.jpg">&nbsp;</td>

                  </tr>

                </table>

                </td>

              </tr>

            <tr>

              <td><table width="100%" border="0" cellpadding="0" cellspacing="0">

                <tr>

                  <td width="28"><img src="img/tabla_pie_izq2.jpg" width="28" height="19"></td>

                  <td background="img/tabla_pie_med2.jpg">&nbsp;</td>

                  <td width="28"><img src="img/tabla_pie_der2.jpg" width="28" height="19"></td>

                </tr>

              </table>

                </td>

              </tr>

          </table>

        <!-- InstanceEndEditable --></td>

      </tr>

    </table></td>

  </tr>

</table>

</body>

<!-- InstanceEnd --></html>


Sh3LL