Por supuesto:
La pagina:
Código PHP:
<?php
session_start();
?>
<!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" />
<link rel="stylesheet" type="text/css" href="mystyle.css" />
<link rel="shortcut icon" href="favicon.ico" />
<title>mititulo</title>
</head>
<body background="images/background.jpg">
<?php
/* INCLUDE FILES !! */
include ("conect.php");
?>
<div class="container">
<div class="header">
<img class="logo" src="images/logo.png" />
<div class="login">
<?php
if (isset($_SESSION["username"])) {
} else {
?>
<table>
<form action="?op=login" method="POST">
<tr><td><label for="username">Username:</label></td><td><input size="15" type="text" name="username" tabindex="1" /></td></tr>
<tr><td><label for="password">Password:</label></td><td><input size="15" type="password" name="password" tabindex="2" /></td></tr>
<tr><td colspan="2"><center><input type="submit" value="Login" tabindex="3" /> <input type="reset" value="Reset" tabindex="4" /></center></td></tr>
</form>
</table>
</div>
<?php
}
?>
<div class="menudiv">
<center>
<a target="Content" href="main.html" class="menu">Home</a>
<a href="http://forum.lamia.es" target="_blank" class="menu">Forum</a>
<a target="Content" href="contact.html" class="menu">Contact</a>
<a href="about.html" target="Content" class="menu">About</a>
<?php
if (isset($_SESSION['username'])) {
echo '<a href="downloads.php" target="Content" class="menu">Download</a>';
echo '<a href="?op=logout" target="_top" class="menu">Logout</a>';
} else {
}
?>
</center>
</div>
</div>
<div class="ContentsRight">
<center></center>
</div>
<div class="contents">
<?php
if ( $_GET["op"] == "login" ) {
$user = $_POST['username'];
$pass = $_POST["password"];
if (trim($user) == "") {
die("ERROR: The USERNAME field has not been filled.");
}
if (trim($pass) == "") {
die("ERROR: The PASSWORD field has not been filled.");
}
$q = "SELECT * FROM `main_users` WHERE `username`='".$user."' AND `password`='".$pass."'";
$r = mysql_query($q);
if ( $res = @mysql_fetch_object($r) ) {
$_SESSION["username"] = $res->username;
$_SESSION["email"] = $res->email;
?>
<script language="javascript">
window.location="http://lamia.es";
</script>
<?php
} else {
die("ERROR: The login information you provided does not exist in out database.");
}
} else {
if ($_GET["op"] == "logout") {
session_destroy();
?>
<script language="javascript">
window.location="http://lamia.es";
</script>
<?php
}
}
?>
<iframe allowtransparency="1" frameborder="no" name="Content" src="main.html" height="99%" width="99%" marginheight="10px" marginwidth="10px"></iframe>
</div>
<div class="footer">
<center><br /><img src="images/banner.png" /></center>
<b class="credits">Skin: © </b>
<b class="copyright">© </b>
</div>
</div>
</body>
</html>
El archivo CSS:
Código CSS:
Ver originalbody {
font:Verdana, Arial, Helvetica, sans-serif;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-variant:small-caps;
}
.container {
width: 1400px;
height: 900px;
}
.header {
height: 15%;
border: 1px solid #000000;
background: #212121;
}
.contents {
border: 1px solid #000000;
height: 70%;
width: 85%;
background: #282828;
color: #079CFA;
}
.ContentsRight {
border: 1px solid #000000;
height: 70%;
width: 15%;
float: right;
clear: both;
background: #282828;
color: #079CFA;
}
.footer {
border: 1px solid #000000;
height: 15%;
background: #212121;
color: #FFFFFF;
}
.logo {
text-decoration: none;
color: #079CFA;
float:left;
margin: 1% 0 0 5%;
}
.login {
float: right;
}
.login label {
color: #636363;
}
.login input {
border: 1px solid #636363;
background: #212121;
color: #636363;
}
.menudiv {
text-decoration: none;
font-variant:small-caps;
clear: right;
margin: 1% 1% 0 0;
}
.menu {
text-decoration: none;
font-variant:small-caps;
color: #686868;
font-size: 24px;
margin: 0 2% 0 0;
}
.menu:hover {
text-decoration: overline underline;
color: #FFFFFF;
font-variant:small-caps;
}
.copyright {
text-decoration: none;
font-variant:small-caps;
color: #535353;
font-size: 12px;
float:right;
margin: 0 1% 0 0;
}
.copyright:hover {
color: #FFFFFF;
font-variant: small-caps;
}
.credits {
text-decoration: none;
font-variant:small-caps;
color: #535353;
font-size: 12px;
float:left;
margin: 0 0 0 1%;
}
.credits:hover {
color: #FFFFFF;
font-variant: small-caps;
}