lobsterninja
03-17-2005, 10:08 PM
Ok, I'm making my own PHP powered plug board. It's all working, except for one part: I can't figure out how to trim any plugs after 8. In other words., it just adds more plugs without erasing the old ones. Here is the code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<table align="center">
<tr height="130" align="center">
<td width="180" align="center">
<?
$url = $_POST["url"];
$button = $_POST["button"];
$theFile = "plugs.txt";
$OpenFile = fopen ($theFile,"a");
fwrite ($OpenFile, "<a href=\"$url\"><img src=\"$button\" border=\"0\"></a> ");
fclose ($OpenFile);
function ReadTheFile ($url,$button) {
$url = $_POST["url"];
$button = $_POST["button"];
$theFile = "plugs.txt";
$OpenFile = fopen ($theFile, "r");
if ($OpenFile) {
$Data = file ($theFile);
for ($n = 0; $n < count($Data); $n++){
$Line = explode("\n", $Data[$n]);
print ("$Line[0]<br>\n$Line[1]<p>\n");
}
fclose ($OpenFile);
} else {
print ("3rr0r");
}
} //end da function
ReadTheFile($url,$button);
?>
</td>
</tr>
<tr align="center">
<td width="180" align="center">
<center>------------<br>
<form method="post" action="simpleBoard.php">
<input type="text" name="button" value="button">
<input type="text" name="url" value="http://">
<input type="submit" value="plug">
<input type="reset" value="dont">
</form>
</center>
</td>
</tr>
</table>
</body>
</html>
the link is http://operationorbit.com/phptests/simpleBoard.php
Also, how would I get it to check if the image is 88x31 pixels?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<table align="center">
<tr height="130" align="center">
<td width="180" align="center">
<?
$url = $_POST["url"];
$button = $_POST["button"];
$theFile = "plugs.txt";
$OpenFile = fopen ($theFile,"a");
fwrite ($OpenFile, "<a href=\"$url\"><img src=\"$button\" border=\"0\"></a> ");
fclose ($OpenFile);
function ReadTheFile ($url,$button) {
$url = $_POST["url"];
$button = $_POST["button"];
$theFile = "plugs.txt";
$OpenFile = fopen ($theFile, "r");
if ($OpenFile) {
$Data = file ($theFile);
for ($n = 0; $n < count($Data); $n++){
$Line = explode("\n", $Data[$n]);
print ("$Line[0]<br>\n$Line[1]<p>\n");
}
fclose ($OpenFile);
} else {
print ("3rr0r");
}
} //end da function
ReadTheFile($url,$button);
?>
</td>
</tr>
<tr align="center">
<td width="180" align="center">
<center>------------<br>
<form method="post" action="simpleBoard.php">
<input type="text" name="button" value="button">
<input type="text" name="url" value="http://">
<input type="submit" value="plug">
<input type="reset" value="dont">
</form>
</center>
</td>
</tr>
</table>
</body>
</html>
the link is http://operationorbit.com/phptests/simpleBoard.php
Also, how would I get it to check if the image is 88x31 pixels?