Registro.php
Código PHP:
<style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
}
body {
background-color: #000000;
}
-->
</style>
<link href="css.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryValidationCheckbox.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationCheckbox.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}
-->
</style>
<?
$titulo = 'Registrarse';
?><table width="100%" height="100%" border="0" align="center" cellpadding="0">
<tr>
<td><table width="100%" border="0" align="center">
<tr>
<td><div align="center">
<form name="form1" method="post" action="funcion_registro.php"><div align="left"><span class="letras1">Usuario:</span>
<input name="user" type="text" class="formu" id="user">
</label>
</div>
<div align="left"><span class="letras1">Contraseña:</span>
<input name="pass" type="password" class="formu" id="pass">
</label>
</div>
<div align="left"><span class="letras1">Repite Contraseña:</span>
<input name="pass2" type="password" class="formu" id="pass2">
</label>
</div>
<div align="left"><span class="letras1">E-Mail:</span>
<input name="mail" type="text" class="formu" id="mail">
</div>
<div align="left"></div>
<div align="left"><span id="sprycheckbox1">
<input type="checkbox" name="checkbox1" id="checkbox1" />
<span class="checkboxRequiredMsg">Realice una selección.</span></span> <span class="letras1">Acepto</span> <span class="olvide_contra"><a href="?pag=term_cond" target="_blank" class="olvide_contra">Terminos y condiciones</a></span><br />
</div>
</label>
<label>
<input name="reg" type="submit" class="formu" id="reg" value="Registrar">
</label>
<label>
<input name="button" type="reset" class="formu" id="button" value="Restablecer" />
</label>
</form>
</div></td>
</tr>
</table></td>
</tr>
</table>
<script type="text/javascript">
<!--
var sprycheckbox1 = new Spry.Widget.ValidationCheckbox("sprycheckbox1", {validateOn:["change"]});
//-->
</script>
funcion_login.php
Código PHP:
f<?php
include("conectar.php");
if(isset($_POST['Submit'])) {
$user = $_POST['user'];
$pass = $_POST['pass'];
if($pass != '') {
if($user != '') {
$sql = "SELECT * FROM usuarios WHERE user='$user' and pass='$pass'";
$result = mysql_query($sql, $conectar) or die(mysql_error());
if($row = mysql_fetch_assoc($result)) {
setcookie("User_reg",$user,time()+7776000);
setcookie("Pass_reg",$pass,time()+7776000);
?>
<SCRIPT LANGUAGE="javascript">
alert("Ingreso exitoso");
location.href = "index.php";
</SCRIPT>
<?
}else{
?>
<SCRIPT LANGUAGE="javascript">
alert("Usuario y/o Contraseña no reconosidos");
location.href = "login.php";
</SCRIPT>
<?
}
}else{
?>
<SCRIPT LANGUAGE="javascript">
alert("Usuario no reconosido");
location.href = "login.php";
</SCRIPT>
<?
}
}else{
?>
<SCRIPT LANGUAGE="javascript">
alert("Contraseñana no reconosida");
location.href = "login.php";
</SCRIPT>
<?
}
}else{
?>
<SCRIPT LANGUAGE="javascript">
alert("Error!");
location.href = "login.php";
</SCRIPT>
<?
}
?>
funcion_registro.php
Código PHP:
<?php
include('conectar.php');
include('config.php');
if(isset($txt3)) {
$user = $_POST['user'];
$sql2 = "SELECT * FROM usuarios WHERE user='".$user."'";
$result2 = mysql_query($sql2, $conectar) or die(mysql_error());
if(mysql_fetch_array($result2)) {
?>
<SCRIPT LANGUAGE="javascript">
alert("El usuario Ya esta registrado");
location.href = "index2.php?pag=registro";
</SCRIPT>
<?
}else{
$user = $_POST['user'];
$pass = $_POST['pass'];
$pass2 = $_POST['pass2'];
$mail = $_POST['mail'];
$city = $_POST['city'];
if(isset($reg)) {
if ($user != '' and $pass != '' and $pass2 != '' and $mail != '') {
if ($pass == $pass2) {
$sql = "INSERT INTO usuarios (`user`, `pass`, `mail`) VALUES ('$user', '$pass', '$mail')";
if(mysql_query($sql, $conectar) or die(mysql_error())) {
setcookie("User_reg",$user,time()+7776000);
setcookie("Pass_reg",$pass,time()+7776000);
$txt2 = $txt.
$txt3;
mail($mail,$asunto,$txt2,$mail2);
?>
<SCRIPT LANGUAGE="javascript">
alert("Usuario Registrado Con exito");
location.href = "login.php";
</SCRIPT>
<?
}else{
?>
<SCRIPT LANGUAGE="javascript">
alert("Error!");
location.href = "registro.php";
</SCRIPT>
<?
}
}else{
?>
<SCRIPT LANGUAGE="javascript">
alert("Las Contraseñas no son iguales");
location.href = "registro.php";
</SCRIPT>
<?
}
}else{
?>
<SCRIPT LANGUAGE="javascript">
alert("Has dejado un campo vacio");
location.href = "registro.php";
</SCRIPT>
<?
}
}else{
?>
<SCRIPT LANGUAGE="javascript">
alert("Error!");
location.href = "registro.php";
</SCRIPT>
<?
}
}
}else{
?>
<SCRIPT LANGUAGE="javascript">
alert("Los derechos del script han sido violados porfavor bajarlo de nuevo");
location.href = "www.allminisoft.uni.cc";
</SCRIPT>
<?
?>