Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/04/2011, 07:50
cienporcientoweb
Usuario no validado
 
Fecha de Ingreso: febrero-2008
Ubicación: Montevideo
Mensajes: 142
Antigüedad: 16 años, 2 meses
Puntos: 7
De acuerdo manejar script de login php

Hola mi nombre es fernando, estoy desarrollando un sitio web, pero me encuentro trancado con este temita del login de usuario.

el login en si esta bien no tengo problemas con eso, pero lo que yo quiero es que cuando alguien se logea desaparezca el ingresar y aparezca otra información como Bienvenido fulanito, me entienden y esto en todas las paginas de mi web y que no me pida ingresar cada ves que estoy en el sitio. me entienden?

este es el escript del login :
Código PHP:
<?php require_once('Connections/ofertas.php'); ?>
<?php
// *** Redirigir nombre de usuario si existe
$MM_flag="MM_insert";
if (isset(
$_POST[$MM_flag])) {
  
$MM_dupKeyRedirect="micuenta.php";
  
$loginUsername $_POST['Email'];
  
$LoginRS__query "SELECT Email FROM registrarse WHERE Email='" $loginUsername "'";
  
mysql_select_db($database_ofertas$ofertas);
  
$LoginRS=mysql_query($LoginRS__query$ofertas) or die(mysql_error());
  
$loginFoundUser mysql_num_rows($LoginRS);

  
//si hay una fila en la base de datos, el nombre de usuario se encontró - no se puede agregar el nombre de usuario solicitado
  
if($loginFoundUser){
    
$MM_qsChar "?";
    
//añadir el nombre de usuario a la página de redireccionamiento
    
if (substr_count($MM_dupKeyRedirect,"?") >=1$MM_qsChar "&";
    
$MM_dupKeyRedirect $MM_dupKeyRedirect $MM_qsChar ."requsername=".$loginUsername;
    
header ("Location: $MM_dupKeyRedirect");
    exit;
  }
}

function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  
$insertSQL sprintf("INSERT INTO registrarse (id_registrar, Email) VALUES (%s, %s)",
                       
GetSQLValueString($_POST['id_registrar'], "int"),
                       
GetSQLValueString($_POST['Email'], "text"));

  
mysql_select_db($database_ofertas$ofertas);
  
$Result1 mysql_query($insertSQL$ofertas) or die(mysql_error());

  
$insertGoTo "micuenta.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}
?><?php
// *** Validar solicitud para ingresar a este sitio.
if (!isset($_SESSION)) {
  
session_start();
}

$loginFormAction $_SERVER['PHP_SELF'];
if (isset(    
$_GET['accesscheck'])) {
  
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset(
$_POST['Email'])) {
  
$loginUsername=$_POST['Email'];
  
$password=$_POST['Email'];
  
$MM_fldUserAuthorization "";
  
$MM_redirectLoginSuccess "micuenta.php";
  
$MM_redirectLoginFailed "no_usuario.php";
  
$MM_redirecttoReferrer false;
  
mysql_select_db($database_ofertas$ofertas);
  
  
$LoginRS__query=sprintf("SELECT Email, Email FROM registrarse WHERE Email='%s' AND Email='%s'",
    
get_magic_quotes_gpc() ? $loginUsername addslashes($loginUsername), get_magic_quotes_gpc() ? $password addslashes($password)); 
   
  
$LoginRS mysql_query($LoginRS__query$ofertas) or die(mysql_error());
  
$loginFoundUser mysql_num_rows($LoginRS);
  if (
$loginFoundUser) {
     
$loginStrGroup "";
    
    
//Declara dos variables de sesión y asignarlos 
    
$_SESSION['MM_Username'] = $loginUsername;
    
$_SESSION['MM_UserGroup'] = $loginStrGroup;          

    if (isset(
$_SESSION['PrevUrl']) && false) {
      
$MM_redirectLoginSuccess $_SESSION['PrevUrl'];    
    }
    
header("Location: " $MM_redirectLoginSuccess );
  }
  else {
    
header("Location: "$MM_redirectLoginFailed );
  }
}
?>
<!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" />
<title></title>
<script type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>
<style type="text/css">
<!--
#ingresar {
    position:absolute;
    left:410px;
    top:250px;
    width:350px;
    height:25px;
    z-index:1;
    font-family: "Times New Roman", Times, serif;
    font-size: 14px;
    font-style: normal;
    color: #0066FF;
}
-->
</style>
</head>

<body>
<div id="ingresar">
  <form method="POST" name="form1" action="<?php echo $loginFormAction?>">
    <table align="center">
      <tr valign="baseline">
        <td align="right" nowrap>Email:
          <input name="Email" type="text" onblur="MM_validateForm('Email','','RisEmail');return document.MM_returnValue" value="" size="10" />
          <input name="submit" type="submit" value="Ir" /></td>
      </tr>
    </table>
    <input type="hidden" name="id_registrar" value="">
    <input type="hidden" name="MM_insert" value="form1">
  </form>
</div>
</body>
</html>
<?php include("otromenu.php"); ?>
<?php 
include("menu.php"); ?>
Bueno espero me puedan ayudar
muchisimas graciasssss