Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- desde aqui es para iniciar session y guardad en la base de datos
- <?php
- require_once('../class/conexion.php');
- if($_SESSION['usuario'])
- {
- header("Location: ../index.php");
- }
- $usuario = $_POST['user'];
- $password = $_POST['pass'];
- $fecha = date("y-m-d");
- $hora = date("g:i:s a");//<-- variable de fecha que guardo
- $sql=mysql_query("SELECT * FROM user WHERE username='$usuario'",Conectar::con());
- if ($f= mysql_fetch_array($sql))
- {
- if($password == $f['pass'])
- {
- $qry1 = "insert into sesiones values ('null','".$f['username']."','".$f['nombre']." ".$f['apellido']."','".$fecha."','".$hora."','".$f['lugar']."','".$f['id_user']."','".$f['id_perfil']."')";
- if(mysql_query($qry1,Conectar::con()))
- {
- session_start();
- $_SESSION['usuario'] = $f['username'];
- $_SESSION['id_user'] = $f['id_user'];
- $_SESSION['perfil']=$f['id_perfil'];
- header("location: ../principal/");
- }else{
- header("location: ../index.php");
- }
- }else
- {
- header("location: ../index.php?msg=2");
- }
- }else
- {
- header("location: ../index.php?msg=1");
- }
- ?>
- y de aqui comienza el codigo donde tengo la consulta
- <table width="100%" class="resultbus">
- <tr>
- <th>Usuario</th>
- <th>Nombre</th>
- <th>Fecha</th>
- <th>Hora</th>
- <th>Lugar</th>
- </tr>
- <?php
- $s = "select * from user where id_perfil = '".$_SESSION['perfil']."'";
- $r = mysql_query($s,Conectar::con());
- while($g= mysql_fetch_assoc($r))
- {
- ?>
- <tr>
- <td align="center" class="t"><?php echo $g['username'];?></td>
- <td align="center" class="t"><?php echo $g['nombre'];?></td>
- <td align="center" class="t"><?php echo $g['fecha'];?></td>
- <!--esta es la que no me muestrsa-->
- <td align="center" class="t"><?php echo $g['time'];?></td>
- <td align="center" class="t"><?php echo $g['lugar'];?></td>
- </tr>
- <?php
- }
- ?>
- </table>
Add Comment
Please, Sign In to add comment