Location: PHPKode > projects > BBS_Bulletin_Board > bbs_bulletin_board/bbsconfig.php
  <title>bbs config </title>
  <link rel="stylesheet" type="text/css" href="bbs.css" />
<b style="color: red; font-weight: bold; font-size: x-large;">Manual steps:</b><br/>
<b> &nbsp; &nbsp; cp robopages.tgz &nbsp; /srv/www/htdocs</b> (for instance)  <br/>
<b> &nbsp; &nbsp; cd '/srv/www/htdocs/' </b> <br/>
<b> &nbsp; &nbsp; tar -xvzf robopages.tgz</b> <br/>
<b> &nbsp; &nbsp; chmod 777 sys_config.inc </b> <br/>
<b> &nbsp; &nbsp; mkdir /srv/www/htdocs/bbs</b> <br/>
<b> &nbsp; &nbsp; mkdir /srv/www/htdocs/bbs/2006</b> (2006 is the default forum, for instance)<br/>
<b> &nbsp; &nbsp; chmod -R 777 /srv/www/htdocs/bbs </b> <br/>
<b style="color: red; font-weight: bold; font-size: x-large;">Form notes:</b><br/>
<b> &nbsp; &nbsp;  file paths must end in '/'</b><br/>
<b> &nbsp; &nbsp;  home link urls should NOT end in '/'</b><br/>
<b> &nbsp; &nbsp;  set sys_realhome_link same as sys_home_link for most users'/'</b><br/>
<b> &nbsp; &nbsp;  sys_whoami</b> can be left blank<br/>
<b> &nbsp; &nbsp;  sys_keywords</b> can be left blank<br/>
<b> &nbsp; &nbsp; sys_quote</b> in 0,1<br/>
<b> &nbsp; &nbsp; sys_show_google_ads</b> in 0,1</td></tr><table><br/><br/>


$file_widget = "sys_config.inc";

function setVal($key, $default)
        $ret = $_POST[$key];
        $ret = $_GET[$key];
        $ret = $default;

function file_opener ($fp)
        print_msg($fp, '<?php');

function file_closer ($fp)
        print_msg ($fp, '?>');

function print_msg($fp, $msg)
        $msg = trim($msg);
        $msg = $msg."\n";
        fwrite ($fp, $msg);

function print_pair($fp, $label, $value)
        $label = trim($label);
        $value = trim($value);
        $line = sprintf("\$%s='%s';\n", $label, $value);
        fwrite ($fp, $line);

function cleanit ($msg)
        $value = trim ($msg);
        $value = ereg_replace (";", "", $value);
        $value = ereg_replace ("'", "", $value);
        $value = ereg_replace ('\$', "", $value);
        return ($value);

$mode = isset($_GET['mode']) ? $_GET['mode'] : '';
if ($mode == 'write')
        //global $file_widget;
        $fp = fopen ($file_widget, "w");
        while (list ($label, $value) = each ($_POST))
        $getstr = sprintf("%s?file_widget=%s", $_SERVER['PHP_SELF'], $file_widget);
////read the file
$lines = @file (trim($file_widget));
$dir = getcwd ();
$line = sprintf ("\$sys_this_dir_path='%s'", $dir);
$lines[] = $line;

////transfer file lines to a hashed array, to remove any duplicates
$sysvalues = array ();
while (list ($num, $line) = each ($lines))
        $tokens = array ();
        $line = cleanit ($line);
        $tokens = explode ("=", $line);
        $label = $tokens[0];
        $value = isset($tokens[1]) ? $tokens[1] : "";

        if (strstr ($line, '<?php') || strstr ($line, '?>') || !$label)

        if (strstr ($label, "path") || strstr ($label, "document_root"))
                $lastchar = strlen ($value) - 1;
                if ($value[$lastchar] != "/")
                $value .= "/";
        $sysvalues[$label] = $value;

////offer the write to file choice
echo "<form action=\"".$_SERVER['PHP_SELF']."?mode=write&file_widget=$file_widget\"  method=\"post\">\n";
//echo "<input type=hidden name=inc value=$posted_file>";
echo "<table border=\"0\">\n";

while (list ($label, $value) = each ($sysvalues))
        echo "<tr><td width=150 align=\"right\"> $label &nbsp; </td>\n";
        echo "<td colspan=4><input type=text size=64 name=\"$label\" value=\"$value\"></td></tr>\n";
echo "</table><br/>";
echo "<table style=\"width: 50%\"><tr><td colspan=2> <input type=submit style=\"color:black; background-color:#ccab99; border-width: 5px; border-color:#bbbbdd\" value=save_config> </td>";
echo "</form>";
echo '<td colspan="2"><a href="bbs.php"><b style="font-size: x-large;">start BBS</b></a></td></tr></table>';

Return current item: BBS_Bulletin_Board