Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/09/2012, 10:48
Zeroakzor
 
Fecha de Ingreso: mayo-2012
Mensajes: 13
Antigüedad: 12 años
Puntos: 0
Sistema de Login con Secion

AYUDA

Hola estoy teniendo ploblema con mi sistema de login de usuario sou nuevo en php...

nececito ayuda para mandar las variables a un pagina es decir nombre y cedula.

aqui estan los datos del sistema que estoy creando

Logincomite.php

<?php
session_start();
include_once "funciones/conexionacceso.php";

function verificar_login($user,$password,&$result)
{
$sql = "SELECT * FROM usuarios WHERE usuario = '$user' and password = '$password'";
$rec = mysql_query($sql);
$count = 0;
while($row = mysql_fetch_object($rec))
{
$count++;
$result = $row;
}
if($count == 1)
{
return 1;
}
else
{
return 0;
}
}
if(!isset($_SESSION['userid']))
{
if(isset($_POST['login']))
{
if(verificar_login($_POST['user'],$_POST['password'],$result) == 1)
{
$_SESSION['userid'] = $result->idusuario;
$_SESSION['username'] = $result->usuario;
$_SESSION['name'] = $result->nombres;
$_SESSION['type'] = $result->type;
header("location:index.php");
}
else
{
echo "<script language='JavaScript'>
alert('LOS DATOS INTRODUCIDOS SON INCORRECTOS');</script>";
}
}
?>


index.php


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> S G E C A - >> Sistema de Gestion Administrativo de Cajas de Ahorros + Bancos + Cheques + Caja Chica << </title>
<LINK REL="SHORTCUT ICON" HREF="logo_icono.ico">
</head>
<frameset rows="100,*,30" border="2" bordercolor="#00FF00">
<frame name="topFrame" scrolling="no" src= "../encabezado.php">

<frameset cols="200,*" border="2" bordercolor="#00FF00">
<frame name="menuFrame" scrolling="no" src= "Menu/MenuVL.html">
<frame name="centerframe" id="centerframe" src= "PantallaAdministrativa.php">
</frameset>
<frame name="topFrame" scrolling="no" src= "../baner_pblicitario.php">
</frameset><noframes></noframes>
<body>
</body>
</html>

Nota: este archivo no esta validado me gustaria restringirlo como aria en este caso????

ConexionAcceso.php

<?
$host = "localhost";
$usuario = "root";
$password = "root";
$db = "usuario";
$con = mysql_connect($host, $usuario, $password);
mysql_select_db($db,$con) or die (mysql_error());
?>

Logout.php

<?php

session_start();
session_destroy();
header('location:index.php');

?>


BASEDATA

CREATE TABLE `usuarios` (
`idusuario` int(11) NOT NULL AUTO_INCREMENT,
`usuario` varchar(20) NOT NULL,
`password` varchar(10) NOT NULL,
`cedula` varchar(15) NOT NULL,
`nombre` varchar(30) NOT NULL,
`apellido` varchar(30) NOT NULL,
`tipo_user` varchar(14) NOT NULL,
`fecharegristro` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`idusuario`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;


por favor si me pueden ayudar un esta duda que tengo se lo agradeseria...