la del loguin:
Código PHP:
<?PHP
session_start ();
$connexio=mysql_connect("localhost","root","")
or die ("No se ha podido conectar");
mysql_select_db("mediacion", $connexio)
or die ("No se ha podido selecciona la base de datos");
?>
<!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=utf-8" />
<title>Mediacion - Introduce Usuario</title>
<style type="text/css">
<!--
body {
background-color: #FFF;
}
-->
</style></head>
<body>
<?php
if(isset($_REQUEST['user'])){
$user = $_REQUEST['user'];
$pass = $_REQUEST['pass'];
$sql = "SELECT user, pass from usuarios Where user = '$user' and pass = '$pass'";
echo $sql;
$res = mysql_query($sql,$connexio) or die ("error en el login");
if($res ==1){
$_SESSION['var']= $user;
}
$_SESSION['var']= $user;
header("Location: panel.php");
}else{
?>
<form id="form1" name="login" method="post" action="index.php">
<table width="200" border="0" align="center" cellspacing="0">
<tr bgcolor="#FFFFFF">
<td><strong>Usuario:</strong></td>
<td><input type="text" name="user" id="user" /></td>
</tr>
<tr bgcolor="#FFFFFF">
<td><strong>Password: </strong></td>
<td><label>
<input type="text" name="pass" id="pass" />
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<br />
<input type="submit" name="envia" id="envia" value="Enviar" />
<br />
</label></td>
</tr>
</table>
</form>
<?php
}
?>
</body>
</html>
Código PHP:
<?php
session_start ();
$connexio=mysql_connect("localhost","root","")
or die ("No se ha podido conectar");
mysql_select_db("mediacion", $connexio)
or die ("No se ha podido selecciona la base de datos");
?>
<!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=utf-8" />
<title>Documento sin título</title>
</head>
<?php
if (isset($_SESSION['var'])) {
echo "Bienvenido <b> ".$_SESSION['var']."</B>, gracias por la visita!";
}else{
echo "Tu no estas autentificado dirígete a login.php o registrate en register.php";
echo $_SESSION['var'];
}
?>
<body>
</body>
</html>
saludos amigos!!!