Bei meinem Login script möchte ich nach erfolgreichem Login eine header Weiterleitung duchführen.
Also habe ich folgendes eingegeben:
- Code: Select all
$_SESSION['user_id'] = $row['ID'];
$_SESSION['logged_in'] = TRUE;
header("Location:index.php?path=useracp.php$id=".$row['ID']."");
Jedoch kommt nun immer nach dem Login:
- Code: Select all
Warning: Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/bad/index.php:22) in /opt/lampp/htdocs/bad/login/login.php on line 21
Aus der Fehlermeldung, already sent by ... index.php:22 habe ich gedacht die 22 stellt die Code Zeile da, in der der Fehler in der index.php sein soll. Das hier ist der Inhalt aus der index.php:
- Code: Select all
<?php
if(!isset($_GET['path']))
{
$OPEN = 'content/ipsum.html';
}
else
{
$OPEN = $_GET['path'];
}
if(!file_exists($_GET['path']))
{
$OPEN = 'content/ipsum.html';
}
?>
<html>
<head>
<title>2bad4You</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link href="style/style.css" rel="stylesheet" type="text/css">
<link href="style/dropdown.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="style/dropdown.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
<form action="index.php?path=login/login.php" method="post">
<table id="baddy" width="476" height="332" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="13" width="476" height="40"><table width="467" height="20" border="0">
<tr>
<td width="119" height="20" class="nr4" align="center"><input type="text" name="username" value="username" onBlur="<?php if(value ==''){?> value='username'<?php }?>" onFocus="<?php if(value =='username'){?>value=''<?php }?>" class="login"></td>
<td width="2"></td>
<td width="119" height="20" class="nr4" align="center"><input type="password" name="password" value="password" onBlur="<?php if(value ==''){?>value='password'<?php }?>" onFocus="<?php if(value=='password'){?>value=''<?php }?>"class="login"></td>
<td width="2"></td>
<td width="170" class="nr1"><input type="submit" value="Login" name="login" style="background:none; color:#FFFFFF; border:none; font-size:11px; font-weight:bold"> | <a href="index.php?path=login/register.php">register</a> | <a href="index.php?path=login/forgotpw.php">passwort?</a></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td colspan="13"><img src="images/header.gif" width="476" height="153" alt=""> </td>
</tr>
<tr>
<td colspan="13" width="476" height="9"> </td>
</tr>
<tr>
<td colspan="13" background="images/index_04.gif" height="29">
<ul id="nav">
<li><img src="images/border01.jpg" />
</li>
<li>
<a href="#" onMouseOver="link1.src='images/link1_over.gif';" onMouseOut="link1.src='images/link1_out.gif';" >
<img name="link1" src="images/link1_out.gif" border="0"></a>
<ul>
<li><a href="index.php?path=news/news.php">Startseite</a></li>
<li><a href="index.php?path=contact/contact.php">Kontakt</a></li>
<li><a href="index.php?path=gb/showgb.php">Gästebuch</a></li>
<li><a href="index.php?path=impressum/impressum.php">Impressum</a></li>
</ul>
</li>
<li><img src="images/border01.jpg" />
</li>
<li>
<a href="#" onMouseOver="link2.src='images/link2_over.gif';" onMouseOut="link2.src='images/link2_out.gif';" >
<img name="link2" src="images/link2_out.gif" border="0"></a>
<ul>
<li><a href="index.php?path=content/aboutme.php">Über Mich</a></li>
<li><a href="index.php?path=content/friends.php">Friend`s </a></li>
<li><a href="index.php?path=admingallery/gallerycats.php">Bilder </a></li>
<li><a href="index.php?path=content/gaming.php">Gaming</a></li>
</ul>
</li>
<li><img src="images/border01.jpg" />
</li>
<li>
<a href="#" onMouseOver="link3.src='images/link3_over.gif';" onMouseOut="link3.src='images/link3_out.gif';" >
<img name="link3" src="images/link3_out.gif" border="0"></a>
<ul>
<li><a href="index.php?path=content/hostinggames.php">Game Server</a></li>
<li><a href="index.php?path=content/hostingwebspace.php">Webspace</a></li>
<li><a href="index.php?path=content/hostingvoice.php">Voice Server</a></li>
<li><a href="index.php?path=content/testserver.php">Test Server</a></li>
<li><a href="index.php?path=content/Kundeninterface.php">Kunden Login</a></li>
<li><a href="index.php?path=content/support.php">Support </a></li>
<li><a href="index.php?path=content/faq.php">FAQ</a></li>
</ul>
</li>
<li><img src="images/border01.jpg" />
</li>
<li>
<a href="blank.html" onMouseOver="link4.src='images/link4_over.gif';" onMouseOut="link4.src='images/link4_out.gif';" >
<img name="link4" src="images/link4_out.gif" border="0"></a>
</li>
<li><img src="images/border01.jpg" />
</li>
<li>
<a href="blank.html" onMouseOver="link5.src='images/link5_over.gif';" onMouseOut="link5.src='images/link5_out.gif';" >
<img name="link5" src="images/link5_out.gif" border="0"></a>
</li>
</ul>
</td>
</tr>
<tr>
<td colspan="13" width="476" height="8">
</td>
<tr>
<td colspan="13" width="476" height="8"> </td>
</tr>
<tr>
<td colspan="13" background="images/sub.gif" width="476" height="20" align="center"><table width="350" border="0">
<tr>
<td width="350" align="left" class="nr1"><a href="index.html">Subnavi</a> | <a href="index.html">Subnavi</a></td>
</tr>
</table> </td>
</tr>
<tr>
<td colspan="13" width="476" height="10"> </td>
</tr>
<tr>
<td width="476" height="16"></td>
<td colspan="11" width="457" height="16" class="nr2"><?php include($OPEN); ?></td>
<td width="9" height="16"> </td>
</tr>
<tr>
<td colspan="13" background="images/foot.gif" width="476" height="23"> </td>
</tr>
<tr>
<td colspan="13" width="476" height="7"> </td>
</tr>
<tr>
<td colspan="13" background="images/footer.gif" width="476" height="30" align="center"><table width="440" border="0">
<tr>
<td width="300" class="nr3" align="left"><a href="index.html">Home</a> | <a href="about.html">About</a> | <a href="hosting.html">Hosting</a> | <a href="impressum.html">Impressum</a></td>
<td width="140" class="nr3" align="center">Code © 2Bad4You<br>Design © <a href="http://www.spongeprodutions.com">sponge produtions</a></td></tr>
</table></td>
</tr>
</table>
</center>
</body>
</html>
Liegt es daran dass die Weiterleitung nicht geht weil sozusagen alle Seiten includiert werden?
Wie kann man das umgehen bzw lösen?
Ansehen kann man das ganze hier:
hier
und dort einfach oben einmal mit "test" und als pw: "testuser" einloggen.
Danke im Vorraus