Das Problem ist, das du keinen neuen Header schicken kannst wenn bereits daten gesand wurden.
Das ist wie mit den Sessions. DU hast irgendwo vor Zeile 86 etwas an den Browser geschickt.
Es reicht schon ein Leerzeichen aus!
heatseeker
hallo leute,
ich habe eine linkliste installiert. die ging super, bis ich dan den header und den footer include habe. danach kamm dan eine fehlermeldung und zwar die :
PHP-Code:Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/mdd37937/link/linkster.php:8) in /www/htdocs/mdd37937/link/linkster.php on line 86
die zeile 86 des scriptes ist die :
so ich habe mich da schon etwas schlau gemacht, denke ich zu mindestens.PHP-Code:header("Location: $URL"); // send user to website
es müsste daran liegen, das ich den header irgendwie aus den link bekommen muss. also das der nicht den link den ich aufrufen will versaut.
sehen kann ich das, wen ich z.b. mit der maus über einen eingeragenen link fahre, da sehe ich es so : http://www.meineseite.de/page=/link/.../www.google.de.
das steht dan auch im firefoy wen ich den link anklicke.
daher dachte ich das man irgendwie den eigenen link weg machen muss mit einen script im header, so das er nicht mehr mit dazu zählt.
kann sein das ich da falsch liege, aber ich denke ich müsste da irgend was in den header kopiren damit er ihn ignoriert beim link aufrufe. oder ?
vieleicht weiss jemand einen rat für das problem...
danke schon mal ...
Geändert von kATARINA (13.05.2005 um 06:20 Uhr)
bis bald ...
KATARINA.B
Das Problem ist, das du keinen neuen Header schicken kannst wenn bereits daten gesand wurden.
Das ist wie mit den Sessions. DU hast irgendwo vor Zeile 86 etwas an den Browser geschickt.
Es reicht schon ein Leerzeichen aus!
heatseeker
danke für deine antwort.
mh es geht doch nur das ich einen link dahin geschickt habe. aber das will ich ja auch, wie kann man das in ordnung bringen. das der eigne link nicht vor dem link steht den man öffnen will.
hier mal das script mit weniger code, da liegt der fehler in der zeile : 21
Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/mdd37937/link/linkster.php:9) in /www/htdocs/mdd37937/link/linkster.php on line 21
das ist zeile 21 : header("Location: $URL"); // send user to websitePHP-Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Küchenseite -Linkliste</title>
</head>
<body>
<span class="content">
<?
#
# linkster.php
#
require("common.php");
######### CLICK COUNT #########
if ($QUERY_STRING && $LID && $URL) {
mysql_query("UPDATE $link_table SET Clicks = Clicks+1 WHERE ID = $LID"); // add 1 to click count
header("Location: $URL"); // send user to website
}
######### PRINT HEADER/MENU #########
require("$header_html");
if ($public_add == "yes" || $QUERY_STRING) {
echo "\n<p align=$tbl_align>\n";
echo "<table border=0 cellpadding=0 cellspacing=0 width=$tbl_width>\n";
echo " <tr>\n";
echo " <td>\n";
}
if ($public_add == "yes" && $action != "add_link") {
echo " <li><a href=$PHP_SELF?action=add_link>Add a link</a></li>\n";
}
if ($mode == "flat" && $action == "add_link") {
echo " <li><a href=$PHP_SELF>Back to links</a></li>\n";
}
if ($mode == "leveled" && $QUERY_STRING) {
echo " <li><a href=$PHP_SELF>Back to categories</a></li>\n";
}
if ($public_add == "yes" || $QUERY_STRING) {
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "</p>\n";
}
######### FLAT MODE #########
if ($mode == "flat" && !$QUERY_STRING) {
$query = "SELECT $link_table.ID AS LID, Clicks, Website, URL, $link_table.Description AS LDescription, $cat_table.ID AS CID, Category, $cat_table.Description AS CDescription FROM $cat_table, $link_table WHERE $cat_table.ID = $link_table.Cat_ID ORDER BY $cat_order, $links_order";
print_table ($query, $PHP_SELF, $tbl_border, $tbl_cellpadding, $tbl_cellspacing, $tbl_width, $tbl_align, $row1_color, $row2_color, $row3_color, $Category, $CDescription, $LID, $URL, $Website, $LDescription, $Clicks, $show_clicks, $show_credit, $credit_html, $new_window, $cat_table, $link_table);
}
######### LEVELED MODE #########
if ($mode == "leveled" && !$LID && !$URL) {
// print categories
if (!$QUERY_STRING) {
$query = "SELECT * FROM $cat_table ORDER BY $cat_order";
$result = mysql_query($query) or die("<p><b>Error:</b> No data exists.</p>\n</body>\n</html>\n\n");
echo "<p align='$tbl_align'>\n";
echo "<table border='$tbl_border' cellpadding='$tbl_cellpadding' cellspacing='$tbl_cellspacing' width='$tbl_width'>\n";
echo " <tr>\n";
echo " <td colspan=2 bgcolor='$row1_color'><div id=linkster-title-large>Categories</div></td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=center id=linkster-title-small bgcolor='$row2_color'>Category/Description</td>\n";
echo " <td align=center id=linkster-title-small bgcolor='$row2_color'> Links </td>\n";
echo " </tr>\n";
while (list($CID, $Count, $Category, $Description) = mysql_fetch_array($result)) {
if ($Count > 0) {
$Category = "<a href=$PHP_SELF?CID=$CID>$Category</a>";
}
if ($Description) {
$Description = "- $Description";
}
echo " <tr>\n";
echo " <td bgcolor='$row3_color' id=linkster-list>$Category $Description</td>\n";
echo " <td bgcolor='$row3_color' align=center id=linkster-count>$Count</td>\n";
echo " </tr>\n";
}
if ($show_credit == "yes") {
echo " <tr>\n";
echo " <td colspan=2><br>$credit_html</td>\n";
echo " </tr>\n";
}
echo "</table>\n";
echo "</p>\n";
}
// print links for specific category
if ($CID) {
$query = "SELECT $link_table.ID AS LID, Clicks, Website, URL, $link_table.Description AS LDescription, $cat_table.ID AS CID, Category, $cat_table.Description AS CDescription";
$query .= " FROM $cat_table, $link_table";
$query .= " WHERE $cat_table.ID = $link_table.Cat_ID AND $cat_table.ID = $CID";
$query .= " ORDER BY $links_order";
print_table ($query, $PHP_SELF, $tbl_border, $tbl_cellpadding, $tbl_cellspacing, $tbl_width, $tbl_align, $row1_color, $row2_color, $row3_color, $Category, $CDescription, $LID, $URL, $Website, $LDescription, $Clicks, $show_clicks, $show_credit, $credit_html, $new_window, $cat_table, $link_table);
}
}
######### ADD LINK (PUBLIC) #########
if ($action == "add_link" && $public_add == "yes") {
// process form
if ($submit) {
// check for errors
if (!$Website) {
$error = "<li>Website Name cannot be left blank</li>\n";
}
if (!$URL) {
$error .= "<li>Website URL cannot be left blank</li>\n";
}
if (eregi("http://", $URL) && eregi(".", $URL)) { // URL must contain <a href="http://" target="_blank">http://</a> and . to be valid
$validURL = 1;
}
if ($URL && !$validURL) {
$error .= "<li>Website URL is invalid</li>\n";
}
if (strlen($Description) > 200) {
$error .= "<li>Description cannot exceed 200 characters (length: " . strlen($Description) . ")</li>\n";
}
// add link to database
if (!$error) {
$Website = escape_quotes($Website);
$URL = escape_quotes($URL);
$Description = escape_quotes($Description);
mysql_query("INSERT INTO $link_table (Cat_ID, Website, URL, Description) VALUES ('$CID','$Website','$URL','$Description')");
UpdateCatCounts();
}
else {
$Website = strip_quotes($Website);
$URL = strip_quotes($URL);
$Description = strip_quotes($Description);
}
}
// print title and message
$title = "Add a Link";
$message = "Fill out the form below to add a link.";
if ($error) {
$title = "Error Adding Link";
$message = "The following error(s) occured:\n <ul>$error</ul>Please correct any errors and try again.";
}
if ($submit && !$error) {
$title = "Link Added";
$message = "Your link has been added.";
}
print_title_message($title, $message);
// print form
if (!$submit) { // sets URL before user touches it
$URL = "http://";
}
if (!$submit || $error) {
echo "<form method=post action=$PHP_SELF?$QUERY_STRING>\n";
link_form($db, $Cat_ID, $CID, $Website, $URL, $Description, $cat_table);
echo "<input type=submit name=submit value=' Add Link '>\n";
echo "</form>\n";
}
}
########### FOOTER/CLOSE DB ###########
require("$footer_html");
mysql_close($db); // close db connection
?>
</span>
</body>
</html>
vielen dank für eure hilfe...
Geändert von kATARINA (13.05.2005 um 07:55 Uhr)
bis bald ...
KATARINA.B
pack den Abschnitt ganz nach oben:
require("common.php");
######### CLICK COUNT #########
if ($QUERY_STRING && $LID && $URL) {
mysql_query("UPDATE $link_table SET Clicks = Clicks+1 WHERE ID = $LID"); // add 1 to click count
header("Location: $URL"); // send user to website
}
Sobald Du
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
...
schreibst, ist das schon eine Ausgabe.
TYPO3 · MySQLDumper · dislabs
·
manche Mühlen mahlen schneller ...
"Ich habe Rücken"
Horst Schlämmer
muss ich das dan so machen ?
<?php
require("common.php");
######### CLICK COUNT #########
if ($QUERY_STRING && $LID && $URL) {
mysql_query("UPDATE $link_table SET Clicks = Clicks+1 WHERE ID = $LID"); // add 1 to click count
header("Location: $URL"); // send user to website
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
bis bald ...
KATARINA.B
erlädigt, so geht es wie du gesagt hast.
habe es so gemacht wie oben drüber und es funzt super DANKE @St@eff.en THX
bis bald ...
KATARINA.B
Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)