php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2004

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 25.07.2004, 19:29  
Gast
 
Beiträge: n/a
Standard Cannot modify header information - headers already sent by

Hallo,

folgendes Problem:

ich habe mir das phpbb-Forum installiert und wollte da das pafiledb-download-script einbauen und anpassen. Das heißt ich wollte eigentlich nur den Header vom phpbb-Forum einbauen...

Ok, soweit habe ich das fertig, allerdings kann ich mich nicht in das Admin Center von pafiledb einloggen, da ich immer diese Header-Error-Meldung bekomme.
Zitat:
Cannot modify header information - headers already sent by
Diese Fehlermeldung ist mir schon ein paar Stunden vorher erschienen und zwar als meine download.php angepasst habe. Hier habe ich es allerdings in den Griff bekommen, mittels:



PHP-Code:
<?php
if (!headers_sent($filename$linenum)) {
   
header ("Location: $file[file_dlurl]");
   exit;

} else {

echo
" <script language=javascript>";
echo
" document.location.href = '$file[file_dlurl]';";
echo
"</script>";
echo
"<noscript>Du hast kein Java Script aktiviert! [url='$file[file_dlurl]']Klick hier[/url], um den Download manuell zu starten.";
echo
"</noscript>";
   exit;
}

?>
Nun wollte ich wie gesagt es genauso machen, doch hier funktioniert es nicht. Deshalb hier mal der Original Code:

PHP-Code:
<?php
/*
  paFileDB 3.1
  ©2001/2002 PHP Arena
  Written by Todd
  [email]todd@phparena.net[/email]
  [url]http://www.phparena.net[/url]
  Keep all copyright links on the script visible
  Please read the license included with this script for more information.
*/
if ($showerr == "1") {
        
?>
           <table width="100%" border="1" cellpadding="2" cellspacing="0" class="headertable" bordercolor="#000000">
               <tr><td width="100%" colspan="2" class="headercell"><center>[b]<?php echo $str[login]; ?>[/b]</center></td></tr>
               <tr><td width="5%" class="datacell" align="center" valign="middle">[img]styles/<?php echo $config[11]; ?>/images/error.gif[/img]</td>
               <td width="95%" class="datacell"><?php echo $str[loginerror]; ?></td></tr></table><table width="100%" border="1" cellpadding="2" cellspacing="0" class="headertable" bordercolor="#000000">
<form action="pafiledb.php" method="post">
<tr><td width="50%" align="right" class="datacell"><?php echo $str[username]; ?></td><td width="50%" align="left" class="datacell"><input type="text" size="50" name="formname" class="forminput"></td></tr>
<tr><td width="50%" align="right" class="datacell"><?php echo $str[password]; ?></td><td width="50%" align="left" class="datacell"><input type="password" size="50" name="formpass" class="forminput"></td></tr>
<tr><td width="50%" align="center" class="datacell" colspan="2"><input type="submit" value=">> <?php echo $str[login]; ?> <<" name="B1"><input type="hidden" name="action" value="admin"><input type="hidden" name="login" value="do"></td></tr>
</form>
</table>
    <?php
            
exit();
}
if (
$login == "do") {
    
$admin $pafiledb_sql->query($db"SELECT * FROM $db[prefix]_admin WHERE admin_username = '$formname'"1);
    
$formpw md5($formpass);
    if (
$formpw == $admin[admin_password]) {
        
$adminip getenv ("REMOTE_ADDR");
        
$ip md5($adminip);
        
$user $formname;
        
$pass $formpw;
        if (
$authmethod == "cookies") {
            
$cookiedata "$ip|$formname|$formpw";
            
setcookie("pafiledbcookie"$cookiedata);
        }
        
header("Location: admin.php");
} else {
    
header("Location: pafiledb.php?action=admin&ad=login&showerr=1");
        }
} else {
?>
<table width="100%" border="1" cellpadding="2" cellspacing="0" class="headertable" bordercolor="#000000">
<form action="pafiledb.php" method="post"><tr><td width="100%" colspan="2" class="headercell"><center>[b]<?php echo $str[login]; ?>[/b]</center></td></tr>
<tr><td width="50%" align="right" class="datacell"><?php echo $str[username]; ?></td><td width="50%" align="left" class="datacell"><input type="text" size="50" name="formname" class="forminput"></td></tr>
<tr><td width="50%" align="right" class="datacell"><?php echo $str[password]; ?></td><td width="50%" align="left" class="datacell"><input type="password" size="50" name="formpass" class="forminput"></td></tr>
<tr><td width="50%" align="center" class="datacell" colspan="2"><input type="submit" value=">> <?php echo $str[login]; ?> <<" name="B1"><input type="hidden" name="action" value="admin"><input type="hidden" name="login" value="do"></td></tr>
</form>
</table>
<?php    
}
?>
Und hier, wie ich es geändert habe:

PHP-Code:
<?php
/*
  paFileDB 3.1
  ©2001/2002 PHP Arena
  Written by Todd
  [email]todd@phparena.net[/email]
  [url]http://www.phparena.net[/url]
  Keep all copyright links on the script visible
  Please read the license included with this script for more information.
*/
if ($showerr == "1") {
        
?>
           <table width="100%" border="1" cellpadding="2" cellspacing="0" class="headertable" bordercolor="#000000">
               <tr><td width="100%" colspan="2" class="headercell"><center>[b]<?php echo $str[login]; ?>[/b]</center></td></tr>
               <tr><td width="5%" class="datacell" align="center" valign="middle">[img]pafiledb/styles/<?php echo $config[11]; ?>/images/error.gif[/img]</td>
               <td width="95%" class="datacell"><?php echo $str[loginerror]; ?></td></tr></table><table width="100%" border="1" cellpadding="2" cellspacing="0" class="headertable" bordercolor="#000000">
<form action="pafiledb/pafiledb.php" method="post">
<tr><td width="50%" align="right" class="datacell"><?php echo $str[username]; ?></td><td width="50%" align="left" class="datacell"><input type="text" size="50" name="formname" class="forminput"></td></tr>
<tr><td width="50%" align="right" class="datacell"><?php echo $str[password]; ?></td><td width="50%" align="left" class="datacell"><input type="password" size="50" name="formpass" class="forminput"></td></tr>
<tr><td width="50%" align="center" class="datacell" colspan="2"><input type="submit" value=">> <?php echo $str[login]; ?> <<" name="B1"><input type="hidden" name="action" value="admin"><input type="hidden" name="login" value="do"></td></tr>
</form>
</table>
    <?php
            
exit();
}
if (
$login == "do") {
    
$admin $pafiledb_sql->query($mydb"SELECT * FROM $mydb[prefix]_admin WHERE admin_username = '$formname'"1);
    
$formpw md5($formpass);
    if (
$formpw == $admin[admin_password]) {
        
$adminip getenv ("REMOTE_ADDR");
        
$ip md5($adminip);
        
$user $formname;
        
$pass $formpw;
        if (
$authmethod == "cookies") {
            
$cookiedata "$ip|$formname|$formpw";
            
setcookie("pafiledbcookie"$cookiedata);
        }
        if (!
headers_sent())
   {
       
header("Location: admin.php");
   }
   else
   {
        echo
" <script language=javascript>";
        echo
" document.location.href = 'admin.php';";
        echo
"</script>";
    exit;
   }
} else {
    
header("Location: pafiledb.php?action=admin&ad=login&showerr=1");
        }
} else {
?>
<table width="100%" border="1" cellpadding="2" cellspacing="0" class="headertable" bordercolor="#000000">
<form action="pafiledb/pafiledb.php" method="post"><tr><td width="100%" colspan="2" class="headercell"><center>[b]<?php echo $str[login]; ?>[/b]</center></td></tr>
<tr><td width="50%" align="right" class="datacell"><?php echo $str[username]; ?></td><td width="50%" align="left" class="datacell"><input type="text" size="50" name="formname" class="forminput"></td></tr>
<tr><td width="50%" align="right" class="datacell"><?php echo $str[password]; ?></td><td width="50%" align="left" class="datacell"><input type="password" size="50" name="formpass" class="forminput"></td></tr>
<tr><td width="50%" align="center" class="datacell" colspan="2"><input type="submit" value=">> <?php echo $str[login]; ?> <<" name="B1"><input type="hidden" name="action" value="admin"><input type="hidden" name="login" value="do"></td></tr>
</form>
</table>
<?php    
}
?>
Nun komme ich immer wieder zur LoginMaske, d.h. ich kann mich zwar einloggen und absenden, aber es springt immer wieder zurück und ich komme nicht in das Admin Center.

Wer hat eine Idee, wie man das realisieren könnte, um in das Admin Center zu kommen?

Wäre für jeden Vorschlag dankbar.
 
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 25.07.2004, 19:33  
Gast
 
Beiträge: n/a
Standard

1. Die Masse Quellcode sieht sich keiner an.
2. Warum postest Du nicht die komplette Fehlermeldung?
3. Da wird irgendwo schon etwas ausgegeben, aber das darf vor der header-, setcookie- oder session_start-Funktion nicht sein. Wo das genau passiert, zeigt Dir PHP sogar an (leider fehlt der Teil der Fehlermeldung), denn da steht sowas wie "output started....."
4. Ich wette, die Suchfunktion mit "Cannot modify" hätte Dir auch schon weiterhelfen können.

Gruß
phpfan
 
Alt 25.07.2004, 19:40  
Gast
 
Beiträge: n/a
Standard

Wie gesagt, die Fehlermeldung erscheint nur, wenn ich den Code ohne Veränderung laufen lassen (original von pafiledb); der Header Aufruf wird in der template.php Zeile 127 von phpbb gestartet.
 
 


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Cannot modify header information PHP-Fortgeschrittene 13 24.10.2006 20:01
Cannot modify header information...??? imported_FlasH PHP Tipps 2007 33 12.11.2005 11:58
Header already sent Chrisber PHP Tipps 2007 10 08.11.2005 20:33
Warning: Cannot modify header information - headers already LP PHP Tipps 2005-2 2 12.09.2005 19:28
Fehler: Warning: Cannot modify header information - headers PHP Tipps 2005-2 14 01.09.2005 15:02
Problem: Cannot modify header information Alpha Centauri PHP Tipps 2005 11 25.04.2005 13:05
cannot modify header information!?!?! Fraylman PHP Tipps 2005 14 18.03.2005 18:14
Cannot modify header information - headers already sent PHP Tipps 2005 2 15.03.2005 22:10
Warning: Cannot modify header information ... PHP Tipps 2005 24 15.02.2005 11:07
Cannot modify header information PHP Tipps 2004-2 6 05.12.2004 19:37
admincontrolpanel: Cannot modify header information ? phpfortgeschrittener PHP Tipps 2004 2 23.08.2004 19:17
Warning: Cannot modify header... einbinden nicht möglich? PHP Tipps 2004 2 07.08.2004 15:06
Cannot send session cookie - headers already sent... PHP Tipps 2004 12 23.07.2004 10:31
Warning: Cannot modify header information PHP Tipps 2004 8 22.07.2004 00:50
Warning: Cannot modify header information.... PHP Tipps 2004 4 18.06.2004 01:38

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
warning: cannot modify header information - headers already sent in download, cannot modify header information - headers already sent b, phpbb forum cannot modify header information - headers already sent by, <script language=\javascript\> headers already sent by, fehlermeldung cannot modify header information - headers already sent b, php cookie cannot modify header information - headers already sent b, headers already sent bei echo, cannot modify header information - headers already sent ohne echo, pafiledb, cannot modify header information - headers already sent echo

Alle Zeitangaben in WEZ +2. Es ist jetzt 03:41 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.