Código PHP:
<?php
if(isset($_REQUEST['welcome']))
{
if(($_REQUEST['nombre'] != "") && ($_REQUEST['ap_paterno'] != "") && ($_REQUEST['ap_materno'] != "") && ($_REQUEST['bol'] != "") && ($_REQUEST['correo'] != "") && ($_REQUEST['user'] != "") && ($_REQUEST['contra'] != "" ))
{
conect_database();
}else{
header("Location: index2.php?datos=false");
}
}
function conect_database()
{
$nombre = $_REQUEST['nombre'];
$paterno = $_REQUEST['ap_paterno'];
$materno = $_REQUEST['ap_materno'];
$boleta = $_REQUEST['bol'];
$correo = $_REQUEST['correo'];
$user = $_REQUEST['user'];
$contra = md5($_REQUEST['contra']);//PARA ENCRIPTAR LA CONTRASEÑA....
$conn = mysql_connect("localhost","kjdkasdj","jsdjaskdakl");
//selecciono la BDD
mysql_select_db("iubix_sisae",$conn);
//Sentencia SQL para dar de alta un nuevo usuario CUIDADO POR AHI OCURRIO ALGUN ERROR JEJEE...
//TODO QUEDO BN
$ssql = "SELECT * FROM `usuarioalumno` WHERE IdAlumno = '$user'";
$rs = mysql_query($ssql,$conn);
if(mysql_num_rows($rs) == 0)//no existe
{
$ssql = "INSERT INTO `usuarioalumno` (`IdAlumno`, `Nombre`, `Paterno`, `Materno`, `Boleta`, `Clave`, `Correo`) VALUES ('$user', '$nombre', '$paterno', '$materno', '$boleta', '$contra', '$correo')";
//Ejecuto la sentencia
$rs = mysql_query($ssql,$conn) or die("ERROR NO SE PUEDE INSERTAR EL ALUMNO");
if($rs != 0)
{
header("Location: index2.php?ready=yes");
}else
{header("Location: index2.php?ready=no"); }
}else
{
echo"el usuario ya existe";
header("Location: index2.php?user=no");
}
mysql_close($conn);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><!--eSTE Y EL TIPO DE DATO EN MYSQL-->
<title>Registrate</title>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<link href="../css/alta.css" rel="stylesheet" type="text/css" />
</head>
<body>
<center>
<h1>Formulario de Registo de Nuevo Usuario</h1>
<!--mi primera tabla que contienen otra tabla con texto e imagen-->
<table cellpadding="0" cellspacing="0">
<tr>
<td class="arribaizq"> </td>
<td class="centrotop"> </td>
<td class="arribader"> </td>
</tr>
<tr>
<td class="lateralizq"> </td>
<td>
<?php
if(isset($_GET['ready']))
{
switch($_GET['ready']){
case yes:
echo"<font color='#9C0'><h3>Usuario dado de alta correctamente</h3></font>";
break;
case no:
echo"<font color='#600'><h3>El usuario no ha podido ser dado de Alta por favor Intentelo de Nuevo mas Tarde</h3></font>";
break;
}
?>
<?php
}else{?>
<center>
<form id="form1" name="form1" method="post" action="<?php $_SERVER['PHP_SELF'];?>">
<table><tr><td>Nickname</td>
<td> <input type="text" name="user" id="user" />
<span class="rojo"><sup>*</sup></span></td>
</tr><tr>
<td>Contraseña</td>
<td> <input type="text" name="contra" id="contra" />
<sup class="rojo">*</sup></td></tr><tr>
<td> Nombre</td>
<td> <input type="text" name="nombre" id="nombre" />
<sup class="rojo">*</sup></td></tr><tr>
<td>Apellido Paterno</td>
<td> <input type="text" name="ap_paterno" id="ap_paterno" />
<sup class="rojo">*</sup></td></tr><tr>
<td>Apellido Materno</td>
<td> <input type="text" name="ap_materno" id="ap_materno" />
<sup class="rojo">*</sup></td></tr><tr>
<td> Boleta</td>
<td> <input type="text" name="bol" id="bol" />
<sup class="rojo">*</sup></td></tr><tr>
<td>Correo</td>
<td> <input type="text" name="correo" id="correo" />
<sup class="rojo">*</sup> <input name="welcome" type="hidden" id="welcome" value="welcome" /></td></tr></table>
<p>
<input type="submit" name="send" id="send" value="Enviar" class="button"/>
</p>
<p class="rojo"><sup>*</sup>Campos Obligatorios</p>
</form>
<?php
}
if(isset($_GET['user']))
{
echo"<font color='#600'><h3>El Usuario no esta Disponible</h3></font>";
}
if(isset($_GET['datos']))
{
echo"<font color='#600'><h3>Algun Dato esta vacio</h3></font>";
}
?>
</center>
</td>
<td class="lateralder"> </td>
</tr>
<tr>
<td class="abajoizq"> </td>
<td class="centrobot"> </td>
<td class="abajoder"> </td>
</tr>
</table><!-- Aqui termina-->
</center>
</body>
</html>
Este codigo es el que corre en internet