http://www.rydhave.frac.dk/PHP/indextest.php
Eli tuo on joku sisään kirjautumis juttu =)...
Mutta ongelma on ilmeisesti siinä että tuo ei tallenna tietoja tietokantaan...näkeekö joku koodissa virheitä?:
<?php session_start(); if ($_GET['logout'] == "yes") { $_SESSION = array(); header("Location: index.php"); } //localhost= host, tagwall = username, tagwall = password mysql_connect('xxxx', 'xxxx', 'xxxx') or die(mysql_error()); mysql_select_db('rydhave') or die(mysql_error()); if (($_POST['sendtag'])) { if ( ($_POST['navn'] != "") && ($_POST['emne'] != "") && ($_POST['kommentar'] != "") ){ $navn = $_POST['navn']; $emne = $_POST['emne']; $kommentar = $_POST['kommentar']; $sql = mysql_query ("INSERT INTO `posts` ( `id` , `navn` , `emne` , `kommentar` , `dato` ) VALUES ('$navn', '$emne', '$kommentar', NOW())") or die(mysql_error()); header("Location: send.php"); exit; }} else { echo "FEJL"; //header("Location: send.php"); exit; } if ($_POST['Delete']) { if ( ($_POST['ID'] !="") ){ $id = $_POST['ID']; $sql = mysql_query("DELETE FROM posts WHERE ID = '$id'") or die(mysql_error()); header("Location: index.php"); exit; } else { echo "FEJL"; exit; } } if ($_POST['login']) { $sql = mysql_query("SELECT bruger FROM bruger WHERE bruger = '$_POST[bruger]' AND password = '$_POST[password]'"); $num_rows = mysql_num_rows($sql); if ($num_rows > 0) { $_SESSION['bruger'] = $_POST[bruger]; } else { echo "Forkert user/pass"; } } if ($_POST['logout']) { $_SESSION = array(); } ?> <html> <head><title>Tagwall</title> </head> <body bgcolor="#666666"> <? $query = mysql_query('select id, emne, kommentar, dato, navn FROM posts order by dato desc') or die(mysql_error()); ?> <table> <tr> <td> <table> <? while ($row = mysql_fetch_array($query)) { $row[navn] = wordwrap($row[navn], 40, "<br />", 1); $row[emne] = wordwrap($row[emne], 40, "<br />", 1); $row[kommentar] = wordwrap($row[kommentar], 40, "<br />", 1); ?> <tr> <td valign="top"><font color="#FFFFFF">Navn:</font></td> <td><font color="#FFFFFF"><?=$row[navn]?></font></td> <tr> <td valign="top"><font color="#FFFFFF"><b>Emne:</b></font></td> <td><font color="#FFFFFF"><?=$row[emne]?></font></td> </tr> <tr> <td valign="top"><font color="#FFFFFF"><u>Kommentar</u>:</font></td> <td><font color="#FFFFFF"><?=$row[kommentar]?></font></td> </tr> <tr> <td valign="top"><font color="#FFFFFF">Dato:</font></td> <td valign="top"><font color="#FFFFFF"><?=$row[dato]?></font></td> </tr> <? if (isset($_SESSION['bruger'])) { ?> <tr> <td><h6><font color="#FFFFFF">ID <?=$row[id]?><h6></font></td> </tr> <? } ?> <? } ?> <a href="send.php" target="_blanket">Skriv en kommentar</a> </Form> </table> <? if (isset($_SESSION['bruger'])) { ?> <a href="index.php?logout=yes">logout</a> <form method="post"> <font color="#FFFFFF">ID:</font><br> <input type="text" name="ID"><br> <input type="submit" name="Delete" value="slet kommentar"><br> </Form> <? } ?> </td> </tr> <tr> <td></td> <td valign="top"><form method="post"> <font color="#FFFFFF">Brugernavn:</font><br> <input type="text" name="bruger"><br> <font color="#FFFFFF">Password:</font><br> <input type="text" name="password"><br> <input type="submit" name="login" value="Login"> <input type="submit" name="logout" value="logout"> </form> </td> </tr> </form> </table> </body> </html>
lomakkeella on <input name="Navn" ... ja if-ehtolauseessa on $_POST["navn"], että johtuiskohan siitä
Aihe on jo aika vanha, joten et voi enää vastata siihen.