Gjorde om ett Shoutbox script men när man uppdaterar eller bara ser shoutboxen för först ggn så öpnnas den i botten, asså men ser innehållet längst ner. Vill ju se överst... lustigt, säkert shitfel men ser ej på vad det är... strirrat mig blind....
shout.php
<body background="shout.jpg" onload="window.scrollTo(0,99999);">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td align="left" valign="top">
<font face="verdana" size="1">
<?php
$tempfile = "database.txt";
$handle = fopen($tempfile,"r+");
while (!feof ($handle)) {
$buffer = fgets($handle, 4096);
echo $buffer;
}
fclose($handle);
?>
</font>
</td>
</tr>
</table>
<form action="index.php?vad=ny" method="post">
<table width="140" border="0" cellspacing="0" cellpadding="0" height="65">
<tr>
<td align="right" valign="top" width="50%"><font face="verdana" size="1"><b>Namn: </b></font></td>
<td align="left" valign="top" width="266"><input type="text" name="name" size="10"></td>
</tr>
<tr>
<td align="right" valign="top" width="50%"><font face="verdana" size="1"><b>SHOUT: </b></font></td>
<td align="left" valign="top" width="266"><textarea rows="2" name="shout" cols="10"></textarea></td>
</tr>
<tr>
<td align="left" valign="top" width="81"></td>
<td align="left" valign="top" width="266"><input type="submit" value="Shout!"></td>
</tr>
</table>
</form>
</body>
index.php
<?
if ($_GET['vad'] == "ny") {
if(strlen($_POST['name']) < 1) {
header("location: index.php?error=name");
} elseif(strlen($_POST['shout']) < 1) {
header("location: index.php?error=shout");
} else {
$tempfile = "database.txt";
$handle = fopen($tempfile,"a+");
fwrite($handle,"<b>".$_POST['name']."</B>: ".$_POST['shout']."<hr>");
fclose($handle);
header("location: index.php");
}
}
?>
<meta http-equiv=refresh content="2;url=shouts.php">
<body leftmargin=0 topmargin=10 marginwidth=0 marginheight=0 background="shout.jpg">
<style type="text/css">
<table width="64" border="0" cellspacing="2" cellpadding="0" height="298" align="center">
<? if ((isset($_GET['error']))) {
if ($_GET['error'] == "name") { $error = "You have to write a name."; }
if ($_GET['error'] == "shout") { $error = "You have to write a shout."; }
?>
<tr height="10">
<td align="left" valign="top" height="10"><? echo "<font color='red' size='1' face='verdana'>".$error."</font>"; ?></td>
</tr>
<? } ?>
<form action="index.php?vad=ny" method="post">
<table width="140" border="0" cellspacing="0" cellpadding="0" height="65">
<tr>
<td align="right" valign="top" width="50%"><font face="verdana" size="1"><b>Namn: </b></font></td>
<td align="left" valign="top" width="266"><input type="text" name="name" size="10"></td>
</tr>
<tr>
<td align="right" valign="top" width="50%"><font face="verdana" size="1"><b>SHOUT: </b></font></td>
<td align="left" valign="top" width="266"><textarea rows="2" name="shout" cols="10"></textarea></td>
</tr>
<tr>
<td align="left" valign="top" width="81"></td>
<td align="left" valign="top" width="266"><input type="submit" value="Shout!"></td>
</tr>
</table>
</form>
<tr height="159">
<td align="left" valign="top" height="159"><iframe name="shoutbox" SCROLLING="NO" src="shouts.php" width="220" height="100%" frameborder="0"></iframe></td>
</tr>
<tr height="133">
<td align="left" valign="top" height="133">
</td>
</tr>
</table>