login.php
delphi
<?php session_start(); if (isset ($_POST['submit'] )){ $data_root = $_SERVER[DOCUMENT_ROOT]; include ($data_root . "/site/sec/funciones.php"); $nick = $_POST['email']; $nick = $_POST['nick']; $password = $_POST['password']; //CREACION DE VARIABALES - INICIO DE SESION $sql = mysql_query("SELECT * FROM registro WHERE nick='$nick' OR email='$nick' AND password='$password'"); $login_check = mysql_num_rows($sql); //CREACION DE SESION if($login_check > 0){ if($row = mysql_fetch_array($sql)){ $id = $row["id"]; session_register('id'); $_SESSION['id'] = $id; $usuario = $row["nick"]; session_register('usuario'); $_SESSION['usuario'] = $usuario; header("location: index.php"); exit(); } } else { ?> <script language="javascript" type="text/javascript"> alert ("Usuario No Registrado"); location.href='http://localhost/site/registro.php'; </script> <?php } }// close if post ?> <?php $fecha = date("d-m-Y"); ?> <!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=utf-8" /> <title>Inicio de Sesion</title> </head> <body> <div> <table align="center" cellpadding="5"> <form action="login.php" method="post" enctype="multipart/form-data" name="logform" id="logform"> <tr> <td>Fecha: <input type="text" name="fecha" id="fecha" value="<?php echo $fecha;?>"/></td> </tr> <tr> <td>Nick <input name="nick" type="text" id="nick" size="15" maxlength="15"/></td> </tr> <tr> <td>Contraseña <input name="password" type="password" id="password" size="15" maxlength="15" /> </td> </tr> <tr> <td align="center"><input name="submit" type="submit" value="Login" id="submit" /> </td> </tr> </form> </table> </div> </body> </html>