Location: PHPKode > projects > Web Application Gateway > wagateway/admin/wagadmin.php
<?

/*************************************************************************************

    COPYRIGHT NOTICE

    This copyright notice must appear at the top of all scripts which are part of
    the Web Application Gateway package.

    Copyright (C) 2001-2008 Gregory Engel
    
    All rights reserved
    
    8547 E Arapahoe Rd, #J-504
    Greenwood Village, CO  80112 USA
    hide@address.com

    This program is free software; you can redistribute it and/or modify it under
    the terms of the GNU General Public License as published by the Free Software
    Foundation; either version 2 of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

    The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
    A copy is included with the WAG package and is found in the text file gpl.txt

    You should have received a copy of the GNU General Public License (gpl.txt, gpl.html)
    along with the WAG distribution package; if not, the GNU General Public License can
    be found at http://www.gnu.org/copyleft/gpl.html, or by writing to:
    
    Free Software Foundation, Inc.
    59 Temple Place - Suite 330
    Boston, MA  02111-1307, USA.

    This script is part of the Web Application Gateway (WAG) Project. The WAG software
    is free, subject to the terms of the GNU General Public License as published by the
    Free Software Foundation, either version 2 of the License, or (at your option) any
    later version.
    
    $Revision: 56 $
    $LastChangedDate: 2008-01-16 09:52:29 -0700 (Wed, 16 Jan 2008) $
    $LastChangedBy: gpeangel $
 
*************************************************************************************/

require("../common/access.php");
require("../common/dbconnect.php");

?>
<html>
<head>
<title><? echo $_SERVER["PHP_SELF"]; ?></title>
<script type="text/javascript" src="../js/ajax.js"></script>
<script type="text/javascript" src="../js/main.js"></script>
<script type="text/javascript" src="../js/admin.js"></script>
<script type="text/javascript" src="../js/wagsession.js"></script>
<link rel="stylesheet" type="text/css" href="../common/gateway.css" />
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">

<script type="text/javascript">
<!--

function enableEmailDB(var_checked)
    {
    if (var_checked == true)
        {
        document.getElementById('div_conf_sync_email').style.display = 'block';
        }
    else
        {
        document.getElementById('div_conf_sync_email').style.display = 'none';
        }
    }
    
/* function openWindow(var_file, var_width, var_height)
    {
    varWin = window.open(var_file, 'openWindow', 'scrollbars,resizable=no,toolbar=no,width=' + var_width + ',height=' + var_height + ',left=40,top=40,status=no');
    varWin.focus()
    } */

// -->
</script>

</head>

<body bgcolor="#ffffff" onload="setFocus('conf_site_name')">

<table bgcolor="#f5f5f5" border="0" cellpadding="4" cellspacing="0" style="margin-bottom: 15px;" width="100%">
    <tr>
        <td><b><a href="index.php" onmouseout="javascript:window.status=''; return true;" onmouseover="javascript:window.status=''; return true;" onmousemove="javascript:window.status='Administration';" target="_self">Administration</a></b></td>
        <td align="right"><a href="javascript:openHelpWindow('Help', '../help/wagadmin_help.php', '0');" onmouseout="javascript:window.status=''; return true;" onmouseover="javascript:window.status=''; return true;" onmousemove="javascript:window.status='Help';">Help</a></td>
    </tr>
</table>

<?

$query = "SELECT * FROM ".$_SESSION["WAGATEWAY"]["DB_TABLE_PREFIX"]."WAGConfig";
$result = mysql_query($query, $db_conn) or die (DBError($_SERVER["PHP_SELF"]."\n\n".$query."\n\n".mysql_errno().": ".mysql_error()));

if ($result)
    {
    
    $row = mysql_fetch_array($result);
    
    $conf_wag_version = $row["conf_wag_version"];
    $conf_site_name = $row["conf_site_name"];
    $conf_debug_on = $row["conf_debug_on"];
    $conf_require_ssl = $row["conf_require_ssl"];
    $conf_demo_mode = $row["conf_demo_mode"];
    $conf_session_lifespan = $row["conf_session_lifespan"];
    
    $conf_password_exp = $row["conf_password_exp"];
    $conf_password_length1 = $row["conf_password_length1"];
    $conf_password_length2 = $row["conf_password_length2"];
    $conf_password_alphanumeric = $row["conf_password_alphanumeric"];

    $conf_sync_email = $row["conf_sync_email"];
    $conf_email_db_server = $row["conf_email_db_server"];
    $conf_email_db_name = $row["conf_email_db_name"];
    $conf_email_table_name = $row["conf_email_table_name"];
    $conf_email_userid_field_name = $row["conf_email_userid_field_name"];
    $conf_email_userid_with_domain = $row["conf_email_userid_with_domain"];
    $conf_email_password_field_name = $row["conf_email_password_field_name"];
    $conf_email_field_encrypt = $row["conf_email_field_encrypt"];
    $conf_email_db_user_name = $row["conf_email_db_user_name"];
    $conf_email_db_user_password = $row["conf_email_db_user_password"];
    }

?>
<table bgcolor="#dcdcdc" border="0" cellpadding="4" cellspacing="0" style="border: solid black 1px; margin-bottom: 5px;" width="100%">
    <tr>
        <td align="center" width="1px"><img src="../common/images/admin.png" /></td>
        <td valign="middle"><b>Gateway Settings</b> - Version <? echo $conf_wag_version; ?></td>
    </tr>
</table>
<?

if ($_SESSION["WAGATEWAY"]["USR_ID"] == 1)
    {
    $bln_found = 0;
    $lng_key_counter = 0;
    $upgrade_message = "";

    require_once("../common/dbconnect.php");
    
    include("../install/upgrades_inc.php");
        
    foreach ($ary_upgrades as $ary_upgrade)
        {
        
        $str_notes = "";
        
        $ary_upgrade_version = explode(".", $ary_upgrade["VERSION"]);
        
        if (strlen($ary_upgrade["UPGRADE_NOTES"]) > 0)
            {
            $str_notes = " - <a href=\"javascript:openWindow('../install/".$ary_upgrade["UPGRADE_NOTES"]."', 500, 500);\" onmouseout=\"javascript:window.status=''; return true;\" onmouseover=\"javascript:window.status=''; return true;\" onmousemove=\"javascript:window.status='Upgrade Notes and Instructions';\">Upgrade Notes and Instructions</a>";
            }
        
        if ((int)$ary_upgrade_version[0] > (int)$ary_wag_version[0])
            {

            if ($bln_found == 0)
                {
                $upgrade_message .= "<li><a href=\"../install/upgrade.php?key=".$lng_key_counter."\">".$ary_upgrade["VERSION"]."</a>".$str_notes."</li>";
                $bln_found = 1;
                }
            else
                {
                $upgrade_message .= "<li>".$ary_upgrade["VERSION"].$str_notes."</li>";
                }
            }
        elseif((int)$ary_upgrade_version[0] == (int)$ary_wag_version[0] && (int)$ary_upgrade_version[1] > (int)$ary_wag_version[1])
            {
            if ($bln_found == 0)
                {
                $upgrade_message .= "<li><a href=\"../install/upgrade.php?key=".$lng_key_counter."\">".$ary_upgrade["VERSION"]."</a>".$str_notes."</li>";
                $bln_found = 1;
                }
            else
                {
                $upgrade_message .= "<li>".$ary_upgrade["VERSION"].$str_notes."</li>";
                }
            }
        elseif((int)$ary_upgrade_version[0] == (int)$ary_wag_version[0] && (int)$ary_upgrade_version[1] == (int)$ary_wag_version[1] && (int)$ary_upgrade_version[2] > (int)$ary_wag_version[2])
            {
            if ($bln_found == 0)
                {
                $upgrade_message .= "<li><a href=\"../install/upgrade.php?key=".$lng_key_counter."\">".$ary_upgrade["VERSION"]."</a>".$str_notes."</li>";
                $bln_found = 1;
                }
            else
                {
                $upgrade_message .= "<li>".$ary_upgrade["VERSION"].$str_notes."</li>";
                }
            }
        
        $lng_key_counter = $lng_key_counter + 1;
        
        }
    
    if (strlen($upgrade_message) > 0)
        {
        ?>
        <fieldset style="background-color: #f5f5f5;">
            <legend><b>Messages</b></legend>
            <table border="0" cellpadding="4" cellspacing="0" style="border: solid black 1px;" width="100%">
                <tr>
                    <td bgcolor="#dcdcdc" style="border-bottom: solid black 1px;"><b>Available Upgrade Versions</b></td>
                </tr>
                <tr>
                    <td>
                        <table border="0" cellpadding="4" cellspacing="0" width="100%">
                            <tr>
                                <td align="left"><? echo $upgrade_message; ?></td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td style="border-top: solid black 1px;">Click on version link to initiate upgrade process.<br><br>Note:  If multiple versions are listed, only the earliest version is available for installation to insure a smooth upgrade path to the latest version.</td>
                </tr>
            </table>
        </fieldset>
        <?
        }
    }

?>
<fieldset style="background-color: #f5f5f5;">
    <legend><b>Site</b></legend>
    <table border="0" cellpadding="4" cellspacing="0" width="100%">
        <tr>
            <td align="right" width="175px"><div id="div_conf_site_name"><b>Site Name:</b></div></td>
            <td align="left"><input maxlength="100" id="conf_site_name" name="conf_site_name" style="font-family: courier; width: 300px;" type="text" value="<? echo $conf_site_name; ?>" /></td>
        </tr>
        <tr>
            <td align="right" width="175px"><div id="div_conf_session_lifespan"><b>Session Timeout:</b></div></td>
            <td align="left"><input id="conf_session_lifespan" name="conf_session_lifespan" style="font-family: courier; text-align: right; width: 30px;" type="text" value="<? echo $conf_session_lifespan; ?>" />&nbsp;Minutes</td>
        </tr>
        <tr>
            <td align="right" width="175px">&nbsp;</td>
            <td align="left"><input id="conf_debug_on" name="conf_debug_on"<? if ($conf_debug_on == 1) { echo " checked"; } ?> type="checkbox" /><label for="conf_debug_on"><b>Debug On</b></label></td>
        </tr>
        <tr>
            <td align="right" width="175px">&nbsp;</td>
            <td align="left"><input id="conf_require_ssl" name="conf_require_ssl"<? if ($conf_require_ssl == 1) { echo " checked"; } ?> type="checkbox" /><label for="conf_require_ssl"><b>Require SSL</b></label></td>
        </tr>
        <tr>
            <td align="right" width="175px">&nbsp;</td>
            <td align="left"><input id="conf_demo_mode" name="conf_demo_mode"<? if ($conf_demo_mode == 1) { echo " checked"; } ?> type="checkbox" /><label for="conf_demo_mode"><b>Run Site as Demo</b></label></td>
        </tr>
    </table>
</fieldset>
<fieldset style="background-color: #f5f5f5;">
    <legend><b>Passwords</b></legend>
    <table border="0" cellpadding="4" cellspacing="0" width="100%">
        <tr>
            <td align="right" width="175px"><div id="div_conf_password_exp"><b>Expiration:</b></div></td>
            <td align="left"><input id="conf_password_exp" name="conf_password_exp" style="font-family: courier; text-align: right; width: 30px;" type="text" value="<? echo $conf_password_exp; ?>" /> Days</td>
        </tr>
        <tr>
            <td align="right" width="175px"><div id="div_conf_password_length1"><b>Shortest:</b></div></td>
            <td align="left"><input id="conf_password_length1" name="conf_password_length1" style="font-family: courier; text-align: right; width: 30px;" type="text" value="<? echo $conf_password_length1; ?>" /> Characters</td>
        </tr>
        <tr>
            <td align="right" width="175px"><div id="div_conf_password_length2"><b>Longest:</b></div></td>
            <td align="left"><input id="conf_password_length2" name="conf_password_length2" style="font-family: courier; text-align: right; width: 30px;" type="text" value="<? echo $conf_password_length2; ?>" /> Characters</td>
        </tr>
        <tr>
            <td align="right" width="175px">&nbsp;</td>
            <td align="left"><input id="conf_password_alphanumeric" name="conf_password_alphanumeric"<? if ($conf_password_alphanumeric == 1) { echo " checked"; } ?> type="checkbox" /><label for="conf_password_alphanumeric"><b>Force Alphanumeric Passwords</b></label></td>
        </tr>
        <tr>
            <td align="right" width="175px">&nbsp;</td>
            <td align="left"><input id="conf_sync_email" name="conf_sync_email" onclick="javascript:enableEmailDB(this.checked);"<? if ($conf_sync_email == 1) { echo " checked"; } ?> type="checkbox" /><label for="conf_sync_email"><b>Synchronize WAG Password with Email Password</b></lable></td>
        </tr>
        <tr>
            <td align="right" width="175px"></td>
            <td align="left">
                <div id="div_conf_sync_email" style="display:<? if ($conf_sync_email == 1) { echo " block"; } else { echo " none"; } ?>;">
                <fieldset style="background-color: #f5f5f5;">
                    <legend><b>Email Account Repository/Connectivity Information</b></legend>
                    <table border="0" cellpadding="4" cellspacing="0">
                        <tr>
                            <td align="right" width="150px"><div id="div_conf_email_db_server">Server Name/IP:</div></td>
                            <td align="left"><input class="formdata" id="conf_email_db_server" name="conf_email_db_server" type="text" value="<? echo $conf_email_db_server; ?>" /></td>
                        </tr>
                        <tr>
                            <td align="right" width="150px"><div id="div_conf_email_db_name">Database Name:</div></td>
                            <td align="left"><input class="formdata" id="conf_email_db_name" name="conf_email_db_name" type="text" value="<? echo $conf_email_db_name; ?>" /></td>
                        </tr>
                        <tr>
                            <td align="right" width="150px"><div id="div_conf_email_table_name">Table Name:</div></td>
                            <td align="left"><input class="formdata" id="conf_email_table_name" name="conf_email_table_name" type="text" value="<? echo $conf_email_table_name; ?>" /></td>
                        </tr>
                        <tr>
                            <td align="right" width="150px"><div id="div_conf_email_userid_field_name">User ID Field Name:</div></td>
                            <td align="left"><input class="formdata" id="conf_email_userid_field_name" name="conf_email_userid_field_name" type="text" value="<? echo $conf_email_userid_field_name; ?>" /></td>
                        </tr>
                        <tr>
                            <td align="right" width="150px"><div id="div_conf_email_password_field_name">Password Field Name:</div></td>
                            <td align="left"><input class="formdata" id="conf_email_password_field_name" name="conf_email_password_field_name" type="text" value="<? echo $conf_email_password_field_name; ?>" /></td>
                        </tr>
                        <tr>
                            <td align="right" width="150px"><div id="div_conf_email_field_encrypt">Field Encryption:</div></td>
                            <td align="left">
                                <select class="formdata" id="conf_email_field_encrypt" name="conf_email_field_encrypt">
                                    <option<? if ($conf_email_field_encrypt == 0) { echo " selected"; } ?> value=0>Clear Text</option>
                                    <option<? if ($conf_email_field_encrypt == 1) { echo " selected"; } ?> value=1>MD5 Hash</option>
                                    <option<? if ($conf_email_field_encrypt == 2) { echo " selected"; } ?> value=2>MySQL PASSWORD()</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" width="150px"><div id="div_conf_email_db_user_name">Database User Name:</div></td>
                            <td align="left"><input class="formdata" id="conf_email_db_user_name" name="conf_email_db_user_name" type="text" value="<? echo $conf_email_db_user_name; ?>" /></td>
                        </tr>
                        <tr>
                            <td align="right" width="150px"><div id="div_conf_email_db_user_password">Database User Password:</div></td>
                            <td align="left"><input class="formdata" id="conf_email_db_user_password" name="conf_email_db_user_password" type="text" value="<? echo $conf_email_db_user_password; ?>" /></td>
                        </tr>
                        <tr>
                            <td align="right" width="150px">&nbsp;</td>
                            <td align="left"><input<? if ($conf_email_userid_with_domain == 1) { echo " checked"; } ?> id="conf_email_userid_with_domain" name="conf_email_userid_with_domain" type="checkbox" /><label for="conf_email_userid_with_domain">Include domain when changing password</label></td>
                        </tr>
                    </table>
                </fieldset>
                </div>
            </td>
        </tr>
    </table>
</fieldset>

<table bgcolor="#dcdcdc" border="0" cellpadding="4" cellspacing="0" style="border: solid black 1px; margin-top: 10px;" width="100%">
    <tr>
        <td>
        <table bgcolor="#dcdcdc" border="0" cellpadding="4" cellspacing="0">
            <tr>
                <td align="center"><button id="btn_save_settings" name="btn_save_settings" onclick="javascript:saveSettings();" style="width: 150px;">Save Settings</button></td>
            </tr>
        </table>
        </td>
    </tr>
</table>

<div id="result_message" style="background-color: #f8f8ff;  left: 0px; position: absolute; text-align: center; top: 0px; visibility: hidden;"></div>

</body>
</html>
Return current item: Web Application Gateway