Les adjunto el codigo de logueo, y el .inc que va en cada pagina
common.inc
Código PHP:
<?
session_start();
if (isset($_SESSION["user"]))
{
$user = $_SESSION["user"];
//echo "<h1>$user</h1>";
}
//else
//echo "<h1>NO HAY NADA</h1>";
if (!isset($_SESSION["language"]))
{
include "/Web/Chicas/languages/english.inc";
$language = "english_name";
}
else
{
if (($_SESSION["language"]) == "english")
{
include "/Web/Chicas/languages/english.inc";
$language = "english_name";
}
if (($_SESSION["language"]) == "spanish")
{
include "/Web/Chicas/languages/spanish.inc";
$language = "spanish_name";
}
}
?>
Código PHP:
<?
session_start();
require "db_connection.inc";
if (isset($_POST["txt_user"]))
{
$user = $_POST["txt_user"];
$password = $_POST["txt_password"];
$sSQL = "select * from register where login = '" .
$user . "' and password = '" .
$password . "'";
$result = mysql_query($sSQL);
if (mysql_num_rows($result) == 0)
{
$message = "Login failed";
}
else
{
$user_object = mysql_fetch_object($result);
$name = $user_object->name;
$_SESSION["user"] = $name;
$message = "Congratulations...¡¡¡";
}
$_SESSION["message"] = $message;
$_SESSION["link"] = "../index.php";
header("Location: alarm_message.php");
exit();
}
else
{
header("Location: forbidden.php");
exit();
}
?>
Saludos
Si hubiera otras cosas que desearia que se las mande por favor, avisenme. Ojala me puedan ayudar
Saludos
Rubén :si: