Text file (rw) question...
| From: | Rob W. | Date: | Wed, 15 Mar 2006 02:11:47 +0000 |
| Subject: | Text file (rw) question... | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-41505@lists.php.net to get a copy of this message | ||
It's all fixed and works. If anybody is wondering how this turned out, here's the begining
of the results.
index.php
<?php
if (!($f=fopen("sc_serv.conf","r")))
exit("Unable to open file.");
while (!feof($f))
{
$x=fgets($f, 100);
list($variable, $data) = explode("=", $x);
echo "<form method=\"POST\" action=\"update.php\">";
if ($variable == "MaxUser") {
echo "Max Users: <input type=\"text\" value=\"$data\"
name=\"MaxUser\" size=\"3\"><br />";
}
if ($variable == "Password") {
echo "Password: <input type=\"text\" value=\"$data\"
name=\"Password\" size=\"15\"><br />";
}
// echo "$variable $data<br />";
}
fclose($f);
echo "<p /><input type=\"SUBMIT\" value=\"Submit\"
/></form>";
?>
update.php
<?
$newconfig = "";
$maxuser=$_POST['maxuser'];
$password=$_POST['password'];
foreach($_POST as $area => $value) {
$newconfig .= $area . "=" . $value . "\n";
}
$fp = fopen('sc_serv.conf', 'w');
fputs($fp, $newconfig);
fclose($fp);
exit();
?>
Thankyou to everyone who helped. Special thanks to Chris.