Hvis I vil prøve siden af, skal I bruge følgende:
Brugernavn: test
Password: test
---------------------------
Koden:
---------------------------
<?
if(($bruger) && ($password)){
$gemt_bruger = $bruger;
$gemt_password = $password;
$dage = 2;
$frist = time() + (60 * 60 * 24 * $dage);
setcookie("info_bruger", $gemt_bruger, $frist);
setcookie("info_password", $gemt_password, $frist);
}
?>
<!doctype html public "-//w3c//dtd html 4.0 Transitional//EN">
<html>
<head>
<title>Dot.Com Communication</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<?
$db = mysql_connect("localhost", "DATABASEN", "PASSWORD");
mysql_select_db("DATABASEN", $db);
if (($gemt_bruger) && ($gemt_password)){
$check = mysql_query("SELECT * FROM user WHERE bruger =
'$gemt_bruger' AND password = '$gemt_password' ");
while($data = mysql_fetch_row($check)){
?>
<div align="center">
<center>
<table width="740" cellspacing="0" cellpadding="0" style="border: 1
solid #000000">
<tr>
<td class="top" valign=top colspan="2"><font
color="#ADBEA3">Bruger:</font> <? echo "$data[6]" ?></td>
</tr>
<tr>
<td class="menu" colspan="2">
<?
include "menu.php";
?>
</td>
</tr>
<tr>
<td class="content" valign=top>
<?
include $content;
?>
</td>
<td class="right" valign=top>
<font size="2"><b>Din konto</b></font><br><br>
<?
echo "Brugernavn: $data[6]<br><br>";
echo "<b>Navn:</b> $data[1]<br>";
echo "<b>E-mail:</b> <a href='mailto:$data[2]'>$data[2]</a><br>";
echo "<b>Website:</b> <a href='$data[3]'>$data[3]</a><br>";
echo "<b>Geografisk sted:</b> $data[4]<br>";
echo "<b>Beskæftigelse:</b> $data[5]<br>";
?>
</td>
</tr>
<tr>
<td class="copy" colspan="2">
<table width="100%" style="border-top: 1 solid #FFFFFF;
border-bottom: 1 solid #CFCB9A" cellspacing="0" cellpadding="0">
<tr>
<td class="indercopy">Copyright
© Jesper Holm 2003</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bottom" colspan="2"> </td>
</tr>
</table>
</center>
</div>
<?
}
} else {
?>
<div align="center">
<center>
<table width="740" cellspacing="0" cellpadding="0" style="border: 1
solid #000000">
<tr>
<td class="top" valign=top colspan="2"><font
color="#ADBEA3">Bruger:</font> Gæst</td>
</tr>
<tr>
<td class="menu" colspan="2">
<?
include "menu.php";
?>
</td>
</tr>
<tr>
<td class="content" valign=top>
<?
include "page0.php";
?>
</td>
<td class="right" valign=top>
<font size="2"><b>Din konto</b></font><br><br>
Du er <font color="FF0000">ikke</font> logget ind!
<form method="post" action=<? echo $PHP_SELF; ?>>
Brugernavn:<br>
<input type="text" name="content value="page1.php">
<input type="text" name="bruger"><br>
Password:<br>
<input type="password" name="password"><br>
<input type="submit" value="Log ind">
</form>
<a href=opret.php>Opret ny bruger</a><br>
<a href=glemt.php>Glemt password?</a>
</td>
</tr>
<tr>
<td class="copy" colspan="2">
<table width="100%" style="border-top: 1 solid #FFFFFF;
border-bottom: 1 solid #CFCB9A" cellspacing="0" cellpadding="0">
<tr>
<td class="indercopy">Copyright
© Jesper Holm 2003</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bottom" colspan="2"> </td>
</tr>
</table>
</center>
</div>
<?
}
?>
</body>
</html>
--
Vil du lære at kode HTML, XHTML, CSS, SSI eller ASP?
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! =>
http://www.html.dk/tutorials