PHP - Ayuda !!! Cargar datos de usuario logueado

 
Vista:
sin imagen de perfil

Ayuda !!! Cargar datos de usuario logueado

Publicado por Luis (1 intervención) el 11/07/2017 18:51:25
Hola amigos, es la primera vez que utilizo estos medios para conseguir ayuda, espero me la puedan proporcionar, tengo un proyecto el cual tiene que ser parecido a outlook y la pagina esta casi terminada solo que hay un error el cual no me deja avanzar el cual es, como cargar los mensajes de un usuario logeado, bueno la pagina es algo sensilla pero esta es la unica parte que se me complica, espero puedan proporcionarme ayuda, este es mi codigo:

Login
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
session_start();
 
include_once 'conexionBD.php';
@mysqli_select_db("segumiento_de_oficios",$con);
 
if(isset($_POST['btn_enviar']))
{
	global $user;
	$user = $_POST['txt_user'];
	$pass = $_POST['txt_pass'];
	$_SESSION['otrou']=$_POST['txt_user'];
 
	if($user!='' && $pass!='')
	{
		$sql1="SELECT id_u FROM tbl_usuarios WHERE nombre_u='$user'";
		$buscaruser=@mysqli_query($con,$sql1) or die( "Error en " . mysql_error() );
 
 
		$sql2="SELECT * FROM tbl_usuarios WHERE nombre_u='$user'";
		$validaruser=@mysqli_query($con,$sql2);
 
		$row=mysqli_fetch_array($validaruser);
		$existe=mysqli_num_rows($buscaruser);
 
		$USUARIO="USUARIO";
		$ADMIN="ADMINISTRADOR";
		$SUPERU="SUPERUSUARIO";
 
		if($existe>0)
		{
			if($row['contrasena_u']==$pass)
			{
				if($row['tipousuario_u']==$USUARIO)
				{
					$_SESSION["tipousuario_u"==$USUARIO];
					header("Location:../index2_menuU.php");
				}
				if($row['tipousuario_u']==$ADMIN)
				{
					$_SESSION["tipousuario_u"==$ADMIN];
					header("Location:../index3_menuA.php");
				}
				if($row['tipousuario_u']==$SUPERU)
				{
					$_SESSION["tipousuario_u"==$SUPERU];
					header("Location:../index4_adminU.php");
				}
			}
			else
			{
				echo '<script language="javascript">alert("Contraseña incorrecta");</script>';
				header("Location:../index.php");
			}
		}
		else
		{
			echo '<script language="javascript">alert("El usuario no existe");</script>';
			header("Location:../index.php");
		}
	}
	else
	{
		echo '<script language="javascript">alert("Complete todos los campos");</script>';
		header("Location:../index.php");
	}
}
?>

Index
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<?php include_once 'php/login.php';?>
<meta charset="UTF-8" lan="">
<meta name="" content="HTML5, JavaScript, CSS3">
<link rel="stylesheet" type="text/css" href="css/tablaOficiosR.css">
<head>
	<h1></h1>
</head>
<body>
<h2 style="color:black">Bienvenido <?=$_SESSION['otrou']?></h2>
<table border=1 cellspacing=0 cellpadding=2 bordercolor="666633" style="border-collapse: collapse; text-align:center; border: 1px solid #ccc; ">
                    <tr bgcolor="#E6E6E6">
                    	<td WIDTH="110" HEIGHT="40">&nbsp;&nbsp;ID</td>
						<td WIDTH="110" HEIGHT="40">&nbsp;&nbsp;PROCEDENCIA</td>
                        <td WIDTH="110" HEIGHT="40">&nbsp;&nbsp;NO. DE OFICIO</td>
                        <td WIDTH="110" HEIGHT="40">&nbsp;&nbsp;FECHA</td>
                        <td WIDTH="110" HEIGHT="40">&nbsp;&nbsp;ASUNTO</td>
                        <td WIDTH="110" HEIGHT="40">&nbsp;&nbsp;FECHA DE RECIBIDO</td>
                        <td WIDTH="110" HEIGHT="40">&nbsp;&nbsp;NO. INTERNO</td>
                        <td WIDTH="110" HEIGHT="40">&nbsp;&nbsp;TURNADO A</td>
                        <td WIDTH="110" HEIGHT="40">&nbsp;&nbsp;RECIBIDO</td>
                        <td WIDTH="110" HEIGHT="40">&nbsp;&nbsp;ESTADO</td>
                        <td WIDTH="110" HEIGHT="40">&nbsp;&nbsp;COMENTARIO</td>
                        <td WIDTH="110" HEIGHT="40">&nbsp;&nbsp;OFICIO</td>
                        <td WIDTH="110" HEIGHT="40">&nbsp;&nbsp;OPCIONES</td>
                    </tr>
<?php
						$link = @mysql_connect("localhost", "root","") or die ("Error al conectar a la base de datos.");
                        @mysql_select_db("segumiento_de_oficios", $link) or die ("Error al conectar a la base de datos.");
                        $query = "SELECT * FROM tbl_oficios WHERE turnado_o ='$user'";
                        $result = mysql_query($query);
                        $numero = 0;
 
                          while($row = @mysqli_fetch_array($result)){
                          	echo "<tr><td width=\"110\">" . $row["id_o"] . "</td>";
                            echo "<td width=\"110\">" . $row["procedencia_o"] . "</td>";
                            echo "<td width=\"110\">"  . $row["noOficio_o"] . "</td>";
                            echo "<td width=\"110\">" . $row["fecha_o"] . "</td>";
                            echo "<td width=\"110\">" . $row["asunto_o"]. "</td>";
                            echo "<td width=\"110\">" . $row["fechaRecibo_o"]. "</td>";
                            echo "<td width=\"110\">" . $row["noInterno_o"]. "</td>";
                            echo "<td width=\"110\">" . $row["turnado_o"]. "</td>";
                            echo "<td width=\"110\">" . $row["recibido_o"]. "</td>";
                            echo "<td width=\"110\">" . $row["estado_o"]. "</td>";
                            echo "<td width=\"110\">" . $row["comentario_o"]. "</td>";
                            echo "<td width=\"110\">" . $row["oficio_o"]. "</td>";
                            echo "<td><a href='formTurnarO.php'><img src='img/editar.png' value='Turnar oficio'><a></td></tr>";
                      		$numero ++;
                          }
                        @mysqli_free_result($result);
                        mysql_close($link);
?>
</table>
 
</table>
</body>
</html>
espero me puedan proporcionar ayuda porfavor, no tengo ni idea de donde comenzar, ni como hacer la consulta, ayuda por favor
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de facundo

Ayuda !!! Cargar datos de usuario logueado

Publicado por facundo (185 intervenciones) el 13/07/2017 16:31:07
Explicate mejor y tal vez pueda ayudarte!!!!!!! que mensajes queres "cargar" y a donde?? Lo que decis es que queres que el usuario pueda dejar comentarios y cargarlos a la base de datos? si es eso es muy sencillo
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar