Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/06/2011, 06:02
ofertasdiairias
 
Fecha de Ingreso: junio-2011
Mensajes: 39
Antigüedad: 12 años, 10 meses
Puntos: 2
sistema de registro y login

[COLOR="RoyalBlue"]HOLA QUISIERA SABER SI ALGUIEN ME PUEDE AYUDAR CON ESTE PROBLEMA.

LO QUE QUIERO ES LO SIGUIENTE :

ingresar.php

Código PHP:
Ver original
  1. <?php require_once('Connections/ofertas.php'); ?>
  2. <?php
  3. // *** Validate request to login to this site.
  4. if (!isset($_SESSION)) {
  5. }
  6.  
  7. $loginFormAction = $_SERVER['PHP_SELF'];
  8. if (isset($_GET['accesscheck'])) {
  9.   $_SESSION['PrevUrl'] = $_GET['accesscheck'];
  10. }
  11.  
  12. if (isset($_POST['Email'])) {
  13.   $loginUsername=$_POST['Email'];
  14.   $password=$_POST['Clave'];
  15.   $MM_fldUserAuthorization = "";
  16.   $MM_redirectLoginSuccess = "micuenta.php";
  17.   $MM_redirectLoginFailed = "no_usuario.php";
  18.   $MM_redirecttoReferrer = false;
  19.   mysql_select_db($database_ofertas, $ofertas);
  20.  
  21.   $LoginRS__query=sprintf("SELECT Email, Clave FROM usuarios WHERE Email='%s' AND Clave='%s'",
  22.     get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
  23.    
  24.   $LoginRS = mysql_query($LoginRS__query, $ofertas) or die(mysql_error());
  25.   $loginFoundUser = mysql_num_rows($LoginRS);
  26.   if ($loginFoundUser) {
  27.      $loginStrGroup = "";
  28.    
  29.     //declare two session variables and assign them
  30.     $_SESSION['MM_Username'] = $loginUsername;
  31.     $_SESSION['MM_UserGroup'] = $loginStrGroup;      
  32.  
  33.     if (isset($_SESSION['PrevUrl']) && false) {
  34.       $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; 
  35.     }
  36.     header("Location: " . $MM_redirectLoginSuccess );
  37.   }
  38.   else {
  39.     header("Location: ". $MM_redirectLoginFailed );
  40.   }
  41. }
  42. ?>
  43. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  44. <html xmlns="http://www.w3.org/1999/xhtml">
  45. <head>
  46. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  47. <title>Documento sin t&iacute;tulo</title>
  48. <style type="text/css">
  49. <!--
  50. #Layer1 {
  51.     position:absolute;
  52.     left:431px;
  53.     top:168px;
  54.     width:95px;
  55.     height:145px;
  56.     z-index:1;
  57. }
  58. -->
  59. </style>
  60. </head>
  61.  
  62. <body>
  63. <div id="Layer1">
  64.   <form method="POST" name="form1" action="<?php echo $loginFormAction; ?>">
  65.     <table width="382" align="center">
  66.       <tr valign="baseline">
  67.         <td width="38" align="right" nowrap>Email:</td>
  68.         <td width="269"><input type="text" name="Email" value="" size="30">
  69.         <img src="imagenes/Mail_16x16.png" width="16" height="16" /></td>
  70.       </tr>
  71.       <tr valign="baseline">
  72.         <td nowrap align="right">Clave:</td>
  73.         <td><input type="password" name="Clave" value="" size="30">
  74.         <img src="imagenes/candado.jpg" width="16" height="16" /></td>
  75.       </tr>
  76.       <tr valign="baseline">
  77.         <td nowrap align="right">&nbsp;</td>
  78.         <td>
  79.           <div align="center">
  80.             <input type="submit" value="Ingresar">
  81.             </div></td></tr>
  82.     </table>
  83.     <input type="hidden" name="id_usuario" value="">
  84.   </form>
  85.   </div>
  86. </body>
  87. </html>


lo que necesito es si alguien me ayuda con el login a validarlo.
con el registro a que solo se pueda registrar un mismo e-mail, nombre y clave en la base de datos y como hacer para que una ves que este logeado, si apreta en el login o registro este le indique que ya esta registrado o logeado?