Location: PHPKode > projects > PHPSiteStats > phpsitestats/setup.php
<?php include("inc.header.php"); ?>


<?php

        // set vars
        $msg = '<b>PHPSiteStats setup page.<img src=gfx/ico_info.gif align=absmiddle
        alt="On this page you can setup the databse and PHPSiteStats settings"
        title="On this page you can setup the databse and PHPSiteStats settings"></b>';

        // check if form is submitted
        if (isset($_POST['submit_o'])) {

                do_dbopt();

                $msg = "<img src=gfx/ico_yes.gif> Database was optimised successfully.";

        }

        // check if form is submitted
        if (isset($_POST['submit_c'])) {

                //make sure file is writable if not chmod it
                fl_chmod("inc.conf.php");

                foreach ($_POST as $name => $value){
                        if ($name != "action" && $name != "submit_c"){
                        conf_replace("inc.conf.php","$name='${$name}'","$name='$value'");
                        }
                }

                $msg = "<img src=gfx/ico_yes.gif> Configuration was updated successfully.";

        }

        // check if form is submitted
        if (isset($_POST['submit_d'])) {

                //make sure file is writable if not chmod it
                fl_chmod("inc.conf.php");

                foreach ($_POST as $name => $value){
                        if ($name != "action" && $name != "submit_d"){
                        conf_replace("inc.conf.php","$name='${$name}'","$name='$value'");
                        }
                }
                conf_replace("inc.conf.php","cfg_database='off'","cfg_database='on'");

                $msg = "<img src=gfx/ico_yes.gif> Configuration was updated successfully.";

        }

?>

<form action='setup.php' method='post'>
<?php echo "<p>$msg</p>"; ?>
        <table>
        <th width='300'>Configuration option</th>
        <th width='100'>status</th>
        <th width='100'>info</th><br>
                <tr>
                        <td class=tdd><b>Database Support:<b>
                        <a href="javascript:alert('Only turn on database suport if you have one that is working and you have set it up');">
                        <img src=gfx/ico_notice.gif align=absmiddle border=0
                        alt="Only turn on database suport if you have one that is working and you have set it up"
                        title="Only turn on database suport if you have one that is working and you have set it up"></a>
                        </td>
                        <td class=tdd align="center">
                        <select name='cfg_database'>
                        <option value=on <?if($cfg_database == "on"){echo "selected";}?> >On</option>
                        <option value=off <?if($cfg_database == "off"){echo "selected";}?> >Off</option>
                        </select>
                        </td>
                        <td class=tdd align=center>this is required for database logging type</td>
                </tr>
                <tr>
                        <td class=tdd><b>Show graphic at top:<b></td>
                        <td class=tdd align="center">
                        <select name='cfg_show_graph'>
                        <option value=on <?if($cfg_show_graph == "on"){echo "selected";}?> >On</option>
                        <option value=off <?if($cfg_show_graph == "off"){echo "selected";}?> >Off</option>
                        </select>
                        </td>
                        <td class=tdd align=center>this enables graphics to be included in reports</td>
                </tr>
                <tr>
                        <td class=tdd><b>Show log size in index:<b></td>
                        <td class=tdd align="center">
                        <select name='cfg_show_size'>
                        <option value=on <?if($cfg_show_size == "on"){echo "selected";}?> >On</option>
                        <option value=off <?if($cfg_show_size == "off"){echo "selected";}?> >Off</option>
                        </select>
                        </td>
                        <td class=tdd align=center>this enables display of the log size on index</td>
                </tr>
                <tr>
                        <td class=tdd><b>Show hits in index:<b></td>
                        <td class=tdd align="center">
                        <select name='cfg_show_visits'>
                        <option value=on <?if($cfg_show_visits == "on"){echo "selected";}?> >On</option>
                        <option value=off <?if($cfg_show_visits == "off"){echo "selected";}?> >Off</option>
                        </select>
                        </td>
                        <td class=tdd align=center>this enables display of hits on index</td>
                </tr>
                <tr>
                        <td class=tdd><b>Minimum hits from site:<b></td>
                        <td class=tdd align="center">
                        <input type='text' size='1' name='cfg_minhit' value='<?= $cfg_minhit ?>'>
                        </select>
                        </td>
                        <td class=tdd align=center>sites with fewer hits will be hidden</td>
                </tr>
                <tr>
                        <td class=tdd><b>Minimum hits from ip:<b></td>
                        <td class=tdd align="center">
                        <input type='text' size='1' name='cfg_minip' value='<?= $cfg_minip ?>'>
                        </select>
                        </td>
                        <td class=tdd align=center>ips with fewer hits will be hidden</td>
                </tr>
                <tr>
                        <td class=tdd><b>Ignore hits from these ip's:<b></td>
                        <td class=tdd align="center">
                        <input type='text' size='14' name='cfg_ignore' value='<?= $cfg_ignore ?>'>
                        </select>
                        </td>
                        <td class=tdd align=center>enter comma delimited list</td>
                </tr>
                <tr>
                        <td colspan=3 align="right"><input class=input type='submit' name='submit_c' value='Setup Configuration'>
                </tr>
        </table>
</form>

<p>&nbsp;</p>

<form action='setup.php' method='post'>

        <table>
        <th width='200' align="left">Database setting</th>
        <th width='200' align="left">Value</th>
        <th width='200' align="left">Info</th>
                <tr>
                        <td class=tdd><b>Database Name</b></td>
                        <td class=tdd><input class=input type='text' name='cfg_dbname' size='30' maxvalue='50' value='<?php echo $cfg_dbname; ?>'></td>
                        <td class=tdd align=center>whatever name you want the database to have</td>
                </tr>
                <tr>
                        <td class=tdd><b>Database Hostname</b></td>
                        <td class=tdd><input class=input type='text' name='cfg_dbhost' size='30' maxvalue='50' value='<?php echo $cfg_dbhost; ?>'></td>
                        <td class=tdd align=center>the ip or hostname of the mysql server</td>
                </tr>
                <tr>
                        <td class=tdd><b>Database Username</b></td>
                        <td class=tdd><input class=input type='text' name='cfg_dbuser' size='30' maxvalue='50' value='<?php echo $cfg_dbuser; ?>'></td>
                        <td class=tdd align=center>the name of the databse account to use</td>
                </tr>
                <tr>
                        <td class=tdd><b>Database Password</b></td>
                        <td class=tdd><input class=input type='text' name='cfg_dbpass' size='30' maxvalue='50' value='<?php echo $cfg_dbpass; ?>'></td>
                         <td class=tdd align=center>the password for the above account</td>
                </tr>
                <tr>
                        <td colspan="3" align="right"><input class=input type='submit' name='submit_d' value='Setup Database'>
                        <td>
                        <a href="javascript:alert('The script will create the database wich name you enter if it is not allready existant');">
                        <img src=gfx/ico_help.gif align=absmiddle border=0
                        alt="The script will create the database wich name you enter if it is not allready existant"
                        title="The script will create the database wich name you enter if it is not allready existant"></a>
                        </td>
                </tr>

                <tr>
                        <td colspan="3" align="right">
                        <input class=input type='submit' name='submit_o' value='Optimise Database'>
                        </td>
                        <td>
                        <a href="javascript:alert('This button will optimise the tables in your database fixing some problems if you have manually deleted records');">
                        <img src=gfx/ico_help.gif align=absmiddle border=0
                        alt="This button will optimise the tables in your database fixing some problems if you have manually deleted records"
                        title="This button will optimise the tables in your database fixing some problems if you have manually deleted records"></a>
                        </td>
                </tr>

        </table>

</form>

</center>
</body>
</html>
Return current item: PHPSiteStats