Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/02/2013, 10:49
daviss_88
 
Fecha de Ingreso: febrero-2013
Mensajes: 12
Antigüedad: 11 años, 9 meses
Puntos: 0
Exclamación Problema funcionalidad formulario php

Tengo en un php el codigo de un formulario de Login con los includes pertinentes:

Código PHP:
?php


                                        
                                                                                
echo' <div id="login" >
                            <form id="form-login" method="post">
                                <div class="">
                                    <div id="login-user">
                                        
                                        <input id="login-username" type="text" class="text" name="username" placeholder="Email" tabindex="1" maxlength="20" required >
                                    </div>
                                    <div id="login-pass">
                                        
                                        <input id="login-password" type="password" class="text" name="password" placeholder="Contrasenya" tabindex="2" maxlength="30" required >
                                    </div>
                                    <div id="btnlogin">
                                        <p><input id="botonlogin" class="submit" type="submit" name="login" value="Iniciar sessi&oacute"></p>
                                                                                
                                    </div>
                                    <div id="remember"> 
                                        <span id">
                                        <a href="#" id="pswd_missing_link" > Recupera la Contrasenya </a> | <a href="registre.php" id="registre_link"> Registrar-se </a>
                                        </span>
                                    </div>
                                </div>
                            </form>
                        </div>'
;
                                                
                                                
                                                
                                                
?> 
En mi página web tengo esto:

Código PHP:
<?php
                            
                            
if(!empty($_SESSION['s_username'])) {  
                              
$usuario$_SESSION['s_username'];
                              
?>
                            <div  style="margin: 10px; background-color: rgba(255,255,255,0.7); border-radius: 3px; height: 70px; width: 150px; float: right; font-weight: "> <span style="margin-left:5px">Benvingut:</span> <?echo $usuario;?>
                        
                            <div id="btnlogin">
                            <form method="POST">
                                <?php if($_SESSION['Rol']=='2'){
                                
?>
                                <a href="admin.php" style=" margin-left: 5px"> Administrar</a> |
                                <?php
                            
}?>
                            <a href="user_panel.php" style=" margin-left: 5px"> Zona Privada</a> |
                            <input type="submit" name="CerrarSesion" value="Sortir">
                            
                            </form>
                            </div></div>
                        <?php
                            
} else { 
                            include_once(
$_SERVER['DOCUMENT_ROOT']."/web/formulari_login.php");
                            
                        
                            }
Aquí básicamente compruevo si se ha iniciado sesión ponga _ "Bienvenido Usuario" y sinó que aparezca el formulario de inicio de sesión. La funcionalidad del boton de login es esta

Código PHP:
<?php
                                        
include_once($_SERVER['DOCUMENT_ROOT']."/web/query/classUser.php");
                                        include_once(
$_SERVER['DOCUMENT_ROOT']."/web/query/validation.php");
                                        include_once(
$_SERVER['DOCUMENT_ROOT']."/web/query/sessions.php");
                                        if (isset(
$_POST['login'])){
                                            
                                            if(isset(
$_POST['email']) && isset($_POST['password'])){
                                                
$email$_POST['email'];
                                                
$password $_POST['password'];
                                                
$user = new User();
                                                
$user->login($email,$password);
                                                
                                                if(
$_SESSION['Rol']=='1'){
                                                                                                
                                                }
                                            }
                                        }
                                        
?>
Esto funciona perfectamente por que si el formulario lo pongo en la web y no en un php externo funciona.. he probado meter la funcionalida dentro del php del formulario y nada y dejarlo en la web y nada...

Alguien sabe que puede ocurrir?

MUCHAS GRACIAS!