Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/03/2013, 06:54
edie8
 
Fecha de Ingreso: noviembre-2011
Mensajes: 516
Antigüedad: 12 años, 5 meses
Puntos: 10
Problemas con sessiones php

Buenas tengo un login con sessiones pero cuando las quiero recoger en otra pagina de php no me muestra nada es como si no entrara tal session este es el codigo:
Código PHP:
<?php
session_start
();
echo 
$_SESSION['email'];
include(
'conf/config.php');
if(isset(
$_SESSION['email']))
{
    echo 
"Ya estas logueado";
}
else
{
    if(
$_POST['entrar'])
    {
        
$email=$_POST['email'];
        
$contra=md5($_POST['contra']);
        
$consulta=mysql_query("SELECT COUNT(*) FROM usuarios WHERE email='$email' AND password='$contra'",$conexion);
        
$arr=mysql_fetch_array($consulta);
        
$_SESSION['id_logueado']=$arr['id'];
        
$_SESSION['email']=$email;
        
$_SESSION['nombre']=$arr['nombre'];
        
        if(
$_GET['return'])
        {
            echo 
'<script languaje="Javascript">location.href="'.$_GET["return"].'"</script>';
        }
        else
        {
             echo 
'<script languaje="Javascript">location.href="index.php"</script>';
        }
        
    }
}
if (!
$_GET["acc"]) {
?>
<!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>Facenty</title>
<link href="css/estilo.css" rel="stylesheet" />
<link rel="shortcut icon" type="image/x-icon" href="/images/favicon.ico" />

</head>

<body bgcolor="#DDE1E1"><div id="login">
<form action="login.php" style="margin-right:100px;" method="post">
<br />
  <p align="right" ><span id="logo">Facenty</span><span class="login">Email:</span>
    <input type="text" name="email" />
    <span class="login">Contraseña:</span>
    <input type="password" name="contra" />
    <input type="submit" name="entrar" value="Entrar" />
<?php }?>
y donde los quiero recoger esta en una carpeta y este es el codigo:
Código PHP:
<?php
session_start
();
$date_default_timezone_set date_default_timezone_set('Europe/Madrid');
$fechadate('H:i:s d-n-o',strtotime('+0hours'));
if(
$_SESSION['email']=="")
{
    
header ("Location: ../index.php");
    exit;
}
    
$id=$_SESSION['id_logueado'];
    
$nombre=$_SESSION['nombre'];
    
$invito=mysql_query("SELECT * FROM invitacion WHERE  de='$id'",$conexion);
    
$total_invi=mysql_num_rows($invito);
    if(
$total_invi == $cantidad)
    {
        echo 
'No tienes invitaciones';
    }
    
    
$email=htmlentities($_SESSION['email']);
    
$invito=mysql_query("SELECT * FROM usuarios WHERE email='$email'",$conexion);
    
$total_invi=mysql_num_rows($invito);
    if(
$total_invi 0)
    {
        echo 
"El email ya esta registrado";
    }
    
$ale=rand(1,1000000);
    
$clave=md5($ale);
    
    
$nombre=htmlentities('yo');
    
$web=$_SESSION['web'];
    
$headers .= "From:Invitación Facenty <[email protected]>\r\n"
    
    
$messaje="".$nombre." te ha invitado a formar parte de ".$web.
    .
    
    
    
    Pulsa en este enlace para poder formar parte de la web.
    http://"
.$web."/validar.php?clave=".$clave."&email=".$email;
    
    
$insertar=mysql_query("INSERT INTO invitacion (id, de,para,clave,fecha) VALUES ('null','$id','$email','true','$fecha')",$conexion);
    }
?>
Tengo algun error en las sessiones porque no me muestra el id logueado que saco en la pagina de login?? gracias un saludo.