PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : fehlersuche



heatshock
12.03.2008, 14:30
ich find den fehler nich... hab schon alles versucht...


<?php
include'mysql.php';
if(isset($_get["title"])) {
$title=$_get["title"];
$inhalt=$_get["inhalt"];
$autor=$_get["autor"];
}
echo $title.$inhalt.$autor;
if(isset($title) and isset($inhalt) and isset($autor)){
$ip = "tex";
$msql="INSERT INTO gaestebuch
(Titel,Inhalt,Datum,Ip,Autor)
VALUES
('$title',
'$inhalt',
NOW(),
'$ip'
'$autor');";

} else {

echo '<form action="gaestebuch.php" method="get">';
echo 'titel:<input type="text" name="title">
';
echo 'inhalt:<input type="text" name="inhalt">
';
echo 'autor:<input type="text" name="autor">
';
echo '<input type="Submit" value="Absenden">
';
echo '</form>';


$sql = "SELECT
Titel,
Inhalt,
Datum,
Autor,
Ip
FROM
gaestebuch
ORDER BY
Datum DESC;";
$result = mysql_query($sql) OR die(mysql_error());
while($row = mysql_fetch_assoc($result)) {
if(isset($_SESSION['admin'])){

echo "<table>";
echo "<tr>";
echo " <td>";
echo "Titel: ".$row[Titel];
echo " </td>";
echo " <td>";
echo "Datum: ".$row[Datum];
echo " </td>";
echo " <td>";
echo "Autor: ".$row[Autor];
echo " </td>";
echo " <td>";
echo $row[Ip];
echo " </td>";
echo " <td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan=\"4\">";
echo $row[Inhalt];
echo " </td>";
echo "</tr>";
echo "</table>";

} else {
echo "<table>";
echo "<tr>";
echo " <td>";
echo "Titel: ".$row[Titel];
echo " </td>";
echo " <td>";
echo "Datum: ".$row[Datum];
echo " </td>";
echo " <td>";
echo "Autor: ".$row[Autor];
echo " </td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan=\"3\">";
echo $row[Inhalt];
echo " </td>";
echo "</tr>";
echo "</table>";
}
}
}
?>

2called-chaos
12.03.2008, 15:11
Ganz einfach :)

$_get und $_post funktionieren nicht
$_GET und $_POST muss es sein (case sensitive)

zudem der Befehl für die IP ist
$_SERVER['REMOTE_ADDR'];

Mfg

Chaos

heatshock
12.03.2008, 15:36
$_SERVER['REMOTE_ADDR']; wusst ich schon...

wusst gar nich das das nen unterschied macht mit get GET post POST

naja ich bin mein ohost server gewohnt wo mann das nich erst wandeln muss...

und BIG THX..

2called-chaos
13.03.2008, 16:26
Also mir ist keine PHP Version bekannt die das auch klein akzeptiert der meinst du Register Globals?