ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-db
php-db
[PHP-DB] Text file (rw) question...
by Rob W. other posts by this author
Mar 14 2006 6:11PM messages near this date
[PHP-DB] Text file (rw) question... | Re: [PHP-DB] Text file (rw) question...
It's all fixed and works. If anybody is wondering how this turned out, here's the begining o
f 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.
Attachments:
unknown1

Thread:
Rob W.
Rob W.
Chris
Rob W.
Rob W.
Rob W.
Chris
Rob W.
Chris
Rob W.
Chris
Rob W.
Chris
Peter Beckman
Rob W.
Chris
Dwight Altman

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved