27.04.2005, 13:10
Hy ich hab mir auf http://www.para-scripts.de das tutorial durchgelesen und darauf hin das script geschrieben . Hierbei handelt es sich um ein Login system mit mysql ! aber wenn ich mich jetzt ein logge dann kommt eine fehler meldung in der check.php (wo die formulareingabe ausgewehrtet wird) und darunter sie sind erfolgreich eingelogt ? wi das ? und wenn ich dort dann auf weiter gehe dann steht in der index (die passwort geschützte seite) dass ich mich nicht eingeloggt habe !
die fehler meldung heist :
die check.php :
[php:1]<?php
include("config.inc.php");
session_start();
//---Abfrage-includeende---//
if($login)
{
$name = $_POST['name'];
$pass = $_POST['pass'];
$pass = md5($pass);
//---vergleichen---//
$check = "SELECT * FROM `".$my_table."` WHERE name LIKE '".$name."' AND pass = '".$pass."'";
$check_result = mysql_query($check);
$result = mysql_num_rows($check_result);
//---prüfung---//
if($result > 0)
{
$logedin = TRUE;
session_register("logedin");
echo "Login erfolgreich!<br>Bitte klicken Sie <a href=\"./index.php\">hier</a> um zur Admin-Startseite zu gelangen.";
}
else
{
echo "Die Daten waren falsch.";
}
}
?> [/php:1]
und hier die index.php :
[php:1]<?php
session_start();
if(session_is_registered("logedin") && $_SESSION['logedin'])
{
echo '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Webmastguide.de - AdminControlPanel</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
a:link { text-decoration: none; color:#3C5A74; }
a:visited { text-decoration:none; color:#3C5A74; }
a:hover { text-decoration: none; color:#8DB0CD; }
<!--
.Stil1 {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
}
.Stil2 {font-size: 12px; font-family: Geneva, Arial, Helvetica, sans-serif;}
.Stil3 { font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
.Stil4 {font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #333333;
}
.Stil6 {color: #CCCCCC}
-->
</style>
</head>
<body background="../images/bg.gif">
<div align="center">
<table width="800" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
<tr>
<td height="80"><img src="images/header.jpg" width="800" height="80"></td>
</tr>
<tr>
<td height="16" bgcolor="#99CC00"><div align="left" class="Stil1">
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="552"><span class="Stil6">- <a href="index.php?action=news">News</a> | <a href="index.php?action=downloads">Downloads</a> | <a href="index.php?action=tutorials">Tutorials</a> | <a href="index.php?action=scripte">Scripte</a> | <a href="index.php?action=guestbook">Gästebuch</a> | <a href="index.php?action=forum">Forum</a> | <a href="index.php?action=links">Links</a> | <a href="index.php?action=member">Member</a> | <a href="index.php?action=statistik">Statistik</a> | <a href="index.php?action=werbung">Werbung</a></span> </td>
<td width="248"><div align="right" class="Stil6"><a href="logout.php" target="_blank">Logout</a> - </div></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><blockquote><?php
switch($action)
{
case "news": include("news/news.php"); break;
case "downloads": include("downloads.php"); break;
case "tutorials": include("tutorials.php"); break;
case "scripte": include("scripte.php"); break;
case "guestbook": include("guestbook.php"); break;
case "forum": include("forum.php"); break;
case "links": include("links.php"); break;
case "member": include("member.php"); break;
case "statistik": include("stat.php"); break;
case "werbung": include("werbung.php"); break;
default: include("start.php"); break;
}
?>
</blockquote></td>
</tr>
<tr>
<td bgcolor="#99CC00"><table width="800" height="16" border="0" cellpadding="0" cellspacing="0">
<tr class="Stil2">
<td width="552">- © by Webmastguide.de </td>
<td width="248"><div align="right"><span class="Stil3"><span class="Stil4">
<?php
$timestamp = time();
$datum = date("d.m.Y - H:i", $timestamp);
echo $datum." Uhr";
?>
</span></span> - </div></td>
</tr>
</table></td>
</tr>
</table>
</div>
</body>
</html>';
}
else
{
echo "Sie sind nicht eingeloggt.";
}
?> [/php:1]
was läuft hier falsch ? (irgendwas mit der session)
die fehler meldung heist :
Zitat:Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /srv/www/htdocs/web3/html/acp/config.inc.php:10) in /srv/www/htdocs/web3/html/acp/check.php on line 3Also hier mein script :
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /srv/www/htdocs/web3/html/acp/config.inc.php:10) in /srv/www/htdocs/web3/html/acp/check.php on line 3
die check.php :
[php:1]<?php
include("config.inc.php");
session_start();
//---Abfrage-includeende---//
if($login)
{
$name = $_POST['name'];
$pass = $_POST['pass'];
$pass = md5($pass);
//---vergleichen---//
$check = "SELECT * FROM `".$my_table."` WHERE name LIKE '".$name."' AND pass = '".$pass."'";
$check_result = mysql_query($check);
$result = mysql_num_rows($check_result);
//---prüfung---//
if($result > 0)
{
$logedin = TRUE;
session_register("logedin");
echo "Login erfolgreich!<br>Bitte klicken Sie <a href=\"./index.php\">hier</a> um zur Admin-Startseite zu gelangen.";
}
else
{
echo "Die Daten waren falsch.";
}
}
?> [/php:1]
und hier die index.php :
[php:1]<?php
session_start();
if(session_is_registered("logedin") && $_SESSION['logedin'])
{
echo '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Webmastguide.de - AdminControlPanel</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
a:link { text-decoration: none; color:#3C5A74; }
a:visited { text-decoration:none; color:#3C5A74; }
a:hover { text-decoration: none; color:#8DB0CD; }
<!--
.Stil1 {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
}
.Stil2 {font-size: 12px; font-family: Geneva, Arial, Helvetica, sans-serif;}
.Stil3 { font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
.Stil4 {font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #333333;
}
.Stil6 {color: #CCCCCC}
-->
</style>
</head>
<body background="../images/bg.gif">
<div align="center">
<table width="800" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
<tr>
<td height="80"><img src="images/header.jpg" width="800" height="80"></td>
</tr>
<tr>
<td height="16" bgcolor="#99CC00"><div align="left" class="Stil1">
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="552"><span class="Stil6">- <a href="index.php?action=news">News</a> | <a href="index.php?action=downloads">Downloads</a> | <a href="index.php?action=tutorials">Tutorials</a> | <a href="index.php?action=scripte">Scripte</a> | <a href="index.php?action=guestbook">Gästebuch</a> | <a href="index.php?action=forum">Forum</a> | <a href="index.php?action=links">Links</a> | <a href="index.php?action=member">Member</a> | <a href="index.php?action=statistik">Statistik</a> | <a href="index.php?action=werbung">Werbung</a></span> </td>
<td width="248"><div align="right" class="Stil6"><a href="logout.php" target="_blank">Logout</a> - </div></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><blockquote><?php
switch($action)
{
case "news": include("news/news.php"); break;
case "downloads": include("downloads.php"); break;
case "tutorials": include("tutorials.php"); break;
case "scripte": include("scripte.php"); break;
case "guestbook": include("guestbook.php"); break;
case "forum": include("forum.php"); break;
case "links": include("links.php"); break;
case "member": include("member.php"); break;
case "statistik": include("stat.php"); break;
case "werbung": include("werbung.php"); break;
default: include("start.php"); break;
}
?>
</blockquote></td>
</tr>
<tr>
<td bgcolor="#99CC00"><table width="800" height="16" border="0" cellpadding="0" cellspacing="0">
<tr class="Stil2">
<td width="552">- © by Webmastguide.de </td>
<td width="248"><div align="right"><span class="Stil3"><span class="Stil4">
<?php
$timestamp = time();
$datum = date("d.m.Y - H:i", $timestamp);
echo $datum." Uhr";
?>
</span></span> - </div></td>
</tr>
</table></td>
</tr>
</table>
</div>
</body>
</html>';
}
else
{
echo "Sie sind nicht eingeloggt.";
}
?> [/php:1]
was läuft hier falsch ? (irgendwas mit der session)