So ich hab mir mal ein kleines Login Script erstellt(teilweile online toturial teilweilse hilfe von kumpel) so nur will das mit den session nicht so ganz hinhauen.
die login.php
checkuser.php
accountverwaltung.html
login.html
€dit:Sorry gerade aufgefallen das das eig falsches forum ist bitte verschieben (hatte ja eig richtiges forum gewählt !?)
die login.php
PHP Code:
<?php
session_start ();
$Username=$_POST["Username"];
$Password=$_POST["Password"];
$Connect=mysql_connect ("localhost", "root", "");
mysql_select_db("account");
$Query="SELECT * FROM account WHERE login='$Username' and password=password('$Password')";
mysql_query("set names big5");
mysql_query("set CHARACTER big5");
$Result=mysql_query($Query) or die(mysql_error());
while($row=mysql_fetch_array($Result))
$data = mysql_fetch_array ($result);
$_SESSION["Username"] = $data["Username"];
$_SESSION["Password"] = $data["Password"];
header ("Location: accountverwaltung.html");
}
else
{
header ("Location: accountverwaltung.htmlfehler=1");
}
?>
PHP Code:
<?php
session_start ();
if (!isset ($_SESSION["Username"]))
if (!isset ($_SESSION["Password"]))
{
header ("Location: login.html");
}
?>
PHP Code:
<?php
include ("checkuser.php");
?>
Erfolg
PHP Code:
<?php session_start (); ?>
<html>
<head>
<title>Login</title>
</head>
<body>
<?php
if (isset ($_REQUEST["fehler"]))
{
echo "Die Zugangsdaten waren ungültig.";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<body>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<link rel="stylesheet" href="style/style.css" type="text/css" media="all" />
<title>PerfektMetin2 | German PServer</title>
<meta name="author" content="Tobias">
<meta name="editor" content="html-editor phase 5">
</head>
</body>
</html>
<body bgcolor="#FFFFFF">
</body>
<div id="header1">
<img src="style/images/Bannerweb.jpg" alt="" border="0" width="100%" height="100">
</div>
<div id="mbox">
<tr>
<META content="MSHTML 6.00.6000.16788" name=GENERATOR></HEAD>
<BODY>
<TABLE width="586" border=0 align="center" cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
</TR></TBODY></TABLE>
<TABLE width="586" height=250 border=0 align="center" cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD vAlign=top align=left>
<TABLE cellSpacing=0 cellPadding=0 width="96%" align=center border=0>
<TBODY>
<TR>
<TD height=30><table width="560" border="0" align="center" cellpadding="1" cellspacing="2" class="news">
<form id="form2" name="form2" method="post" action="login.php" onSubmit="return CheckValid(this)">
<tr>
<td height="23" colspan="2"><b><font color="#FF0000">Login</font></b>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="" height="1">
<tr>
<td></td>
</tr>
</table></td>
</tr>
<tr> </tr>
<tr>
<td width="110"><div align="right">User ID</div></td>
<td width="370" align="left"><input name="UserID" type="text" id="Username" size="16" maxlength="16" value="" class="inputbox2" onFocus="change(1)"><br>
</fon></td>
</tr>
<tr>
<td width="110"><div align="right">Password:</div></td>
<td width="370" align="left"><input name="Password" type="password" id="Password" size="16" maxlength="16" class="inputbox2" onFocus="change(2)">
</td>
</tr>
<td width="110"><b>
<input type="hidden" name="act" value="send">
</b></td>
<td width="370" align="left"><b>
<input type="image" border="0" name="imageField" src="http://www.elitepvpers.com/forum/images/submitbutton.gif" >
</b></td>
</tr>
</form>
</table></TD>
</TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
</BODY></HTML>
</div>
<div id="mleiste">
<a href="index1.html"><img src="style/images/Home.jpg" width="160" height="34" border="0"alt="Home"></a>
<a href="register.html"><img src="style/images/reg.jpg" width="160" height="34" border="0"alt="Registriern"></a>
<a href="login.html"><img src="style/images/login.jpg" width="160" height="34" border="0"alt="Login"></a>
<a href="down.html"><img src="style/images/down.jpg" width="160" height="34" border="0"alt="Download"></a>
<a href="Itemshop.html"><img src="style/images/IS.jpg" width="160" height="34" border="0"alt="Itemshop"></a>
<a href="/Forum"><img src="style/images/forum.jpg" width="160" height="34" border="0"alt="Forum"></a>
</div>
€dit:Sorry gerade aufgefallen das das eig falsches forum ist bitte verschieben (hatte ja eig richtiges forum gewählt !?)