Location: PHPKode > projects > Web Application Gateway > wagateway/admin/users_detail.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: 41 $
    $LastChangedDate: 2008-01-14 14:07:02 -0700 (Mon, 14 Jan 2008) $
    $LastChangedBy: gpeangel $
 
*************************************************************************************/

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

$action_type = "";

$usr_id = (int)trim(strip_tags($_REQUEST["usr_id"]));
    
if ($usr_id == 0)
    {
    $action_type = "Add";
    $usr_first_name = "";
    $usr_last_name = "";
    $usr_logon_id = "";
    $usr_password = "";
    $usr_password_exp = 0;
    $usr_password_force_change = 0;
    $usr_email = "";
    }
else
    {
    $action_type = "Modify";
    
    $query = "SELECT * FROM ".$_SESSION["WAGATEWAY"]["DB_TABLE_PREFIX"]."Users WHERE usr_id = ".$usr_id;
    $result = mysql_query($query, $db_conn) or die (DBError($_SERVER["PHP_SELF"]."\n\n".$query."\n\n".mysql_errno().": ".mysql_error()));
    
    if ($result)
        {
        $row_count = mysql_num_rows($result);
        
        $row = mysql_fetch_array($result);

        $usr_first_name = $row["usr_first_name"];
        $usr_last_name = $row["usr_last_name"];
        $usr_logon_id = $row["usr_logon_id"];
        $usr_password = $row["usr_password"];
        $usr_password_exp = $row["usr_password_exp"];
        $usr_password_force_change = $row["usr_password_force_change"];
        $usr_email = $row["usr_email"];
        }
    }

if (strlen($usr_password) == 0)
    {
    $usr_password = generatePassword();
    }
    
?>
<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">
</head>

<body bgcolor="#ffffff" onload="setFocus('usr_first_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> - <a href="users.php" onmouseout="javascript:window.status=''; return true;" onmouseover="javascript:window.status=''; return true;" onmousemove="javascript:window.status='Users';" target="_self">Users</a></b></td>
        <td align="right"><a href="javascript:openHelpWindow('Help', '../help/users_detail_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>

<table bgcolor="#f5f5f5" 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/users.png" /></td>
        <td valign="middle"><b><? echo $action_type; ?> User</b></td>
    </tr>
</table>

<fieldset style="background-color: #f5f5f5;">
    <legend><b>General</b></legend>
    <table border="0" cellpadding="4" cellspacing="0" width="100%">
    <?
    
    // Only allow members of the system administrators group to change user first name, last name and logon id
    
    if (in_array(1, $_SESSION["WAGATEWAY"]["GROUPS"]))
        {
        ?>
        <tr>
            <td align="right" width="125px"><div id="div_usr_first_name"><b>First Name:</b></div></td>
            <td><input class="formdata" id="usr_first_name" maxlength="50" name="usr_first_name" style="width: 40em;" type="text" value="<? echo $usr_first_name; ?>" /></td>
        </tr>
        <tr>
            <td align="right" width="125px"><div id="div_usr_last_name"><b>Last Name:</b></div></td>
            <td><input class="formdata" id="usr_last_name" maxlength="50" name="usr_last_name" style="width: 40em;" type="text" value="<? echo $usr_last_name; ?>" /></td>
        </tr>
        <tr>
            <td align="right" width="125px"><div id="div_usr_logon_id"><b>User ID:</b></div></td>
            <td><input class="formdata" id="usr_logon_id" maxlength="20" name="usr_logon_id" style="width: 15em;" type="text" value="<? echo $usr_logon_id; ?>" /></td>
        </tr>
        <?
        }

    // Do not allow installation system administrator to change it's password from this screen
    // Use "My Account" screen to change installation system administrator password
    
    if ($usr_id != 1)
        {
        ?>
        <tr>
            <td align="right" width="125px"><div id="div_usr_password".<b>Password:</b></div></td>
            <td>
                <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td width="1px"><input class="formdata" id="usr_password" name="usr_password" style="width: 15em;" type="text" value="<? if ($usr_id == 0) { echo $usr_password; } ?>" /></td>
                        <td width="1px" style="padding-left: 5px; padding-right: 5px;"><input type="button" style="width: 150px;" value="Generate Password" onclick="javascript:generatePassword('usr_password');"></td>
                    </tr>
                </table>
            </td>
        <tr>
        <tr>
            <td align="right" width="125px"><b>Expires:</b></td>
            <td><input<? if ($usr_password_exp == 1 || strlen($usr_password_exp) == 0) { echo " checked"; } ?> id="usr_password_exp" name="usr_password_exp" type="checkbox" /> Password expires as defined by Gateway passward expiration rule.</td>
        <tr>
        <tr>
            <td align="right" width="125px"><b>Force Change:</b></td>
            <td><input<? if ($usr_password_force_change == 1 || strlen($usr_password_force_change) == 0) { echo " checked"; } ?> id="usr_password_force_change" name="usr_password_force_change" type="checkbox" /> User is forced to change password on next logon.</td>
        <tr>
        <?
        }
    ?>
    <tr>
        <td align="right" width="125px"><div id="div_usr_email"><b>E-mail:</b></div></td>
        <td><input class="formdata" id="usr_email" maxlength="50" name="usr_email" style="width: 40em;" type="text" value="<? echo $usr_email; ?>" /></td>
    </tr>
    </table>
</fieldset>

<? require("getUserGroupsLists.php"); ?>

<? require("getUserAppLists.php"); ?>

<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" name="btn_save" onclick="javascript:saveUser(<? echo $usr_id; ?>);" style="width: 150px;">Save User</button><? if ($usr_id > 1) { ?>&nbsp;<button id="btn_delete" name="btn_delete" onclick="javascript:deleteUser(<? echo $usr_id; ?>, '<? echo $usr_first_name." ".$usr_last_name; ?>');" style="width: 150px;">Delete User</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