Subversion Repositories ALCASAR

Rev

Rev 610 | Blame | Last modification | View Log

<?php
/*
Array
(
    [username] => s
    [User] => s
    [User-mdp] => ********
    [User-mdp-clear] => 
    [Expiration] => 23 April 2011
    [altExpirationDate] => 
    [bupdate] => Modifier
    [name] => 
    [email] => 
    [service] => 
    [phone] => 
    [bureau] => 
    [mobile] => 
    [Simultaneous-Use] => 1
    [Session-Timeout] => 
    [Session-Timeout_h] => 
    [Session-Timeout_mm] => 
    [Session-Timeout_s] => 
    [Max-Daily-Session] => 
    [Max-Daily-Session_h] => 
    [Max-Daily-Session_mm] => 
    [Max-Daily-Session_s] => 
    [Max-Monthly-Session] => 
    [Max-Monthly-Session_h] => 
    [Max-Monthly-Session_mm] => 
    [Max-Monthly-Session_s] => 
    [Login-Time] => 
    [ChilliSpot-Max-Input-Octets] => 
    [ChilliSpot-Max-Output-Octets] => 
    [ChilliSpot-Max-Total-Octets] => 
    [ChilliSpot-Bandwidth-Max-Up] => 
    [ChilliSpot-Bandwidth-Max-Down] => 
    [WISPr-Redirection-URL] => 
)
*/
require_once('includes/defines.inc.php');
require_once(ALCASAR_ADMIN_PATH_INC.'/session.inc.php');
//include(ALCASAR_ADMIN_PATH_LIB.'/user.class.php');
include(ALCASAR_ADMIN_PATH_LIB.'/radiusMysqlUser.class.php');

/*
Traitement des mises à jours
*/
if (isset($_POST['bupdate'])&&isset($_POST['username'])){
        
        $username = $_POST['username'];
                /*
                echo '<pre>';
                print_r($_POST);
                echo '</pre>';
                */
        //$validattribute = array('username','User-mdp','Expiration','name','email','service','phone','bureau','mobile','Simultaneous-Use','Session-Timeout','Max-Daily-Session','Max-Monthly-Session','Login-Time','ChilliSpot-Max-Input-Octets','ChilliSpot-Max-Output-Octets','ChilliSpot-Max-Total-Octets','ChilliSpot-Bandwidth-Max-Up','ChilliSpot-Bandwidth-Max-Down','WISPr-Redirection-URL');
        $ouser = new radiusMysqlUser();
        echo '<pre>';
        foreach ($_POST as $key => $val){
                if (in_array($key, $attrmap)){
                        /*
                        ATTENTION FAIRE UN TEST DE $VAL!!!
                        
                        METTRE EN FORME LES DATES
                        
                        */
                        echo $key.' '.$val;
                        $ouser->set($key,$val);
                }
        }
        echo '</pre>';
        $ouser->save();
} else {
        if (isset($_GET['username'])){
                $username = $_GET['username'];//faire fonction xss_clean        
        } else {
                header('Location: users.php');
        }
        $ouser = new radiusMysqlUser();
        $ouser->load($username, true);
}
$user = $ouser->get();
echo '<pre>';
                print_r($user);
                echo '</pre>';
/*
Affichage de la page
*/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Edit <?php echo $options['username']; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- include default CSS -->
<link rel="stylesheet" href="<?php echo ALCASAR_ADMIN_PATH_CSS; ?>/default/default.css" type="text/css">
<!--link rel="stylesheet" href="../css/style.css" type="text/css"-->
<!-- include JQUERY UI CSS -->
<link type="text/css"  rel="stylesheet" href="<?php echo ALCASAR_ADMIN_PATH_CSS; ?>/default/ui-lightness/jquery-ui-1.8.10.custom.css">
<!-- include custom page CSS -->

<!-- include JQUERY -->
<script type="text/javascript" language="javascript" src="<?php echo ALCASAR_ADMIN_PATH_JS; ?>/jquery-1.6.1.min.js"></script>
<!-- include JQUERY UI -->
<script type="text/javascript" language="javascript" src="<?php echo ALCASAR_ADMIN_PATH_JS; ?>/jquery-ui-1.8.10.all.min.js"></script>
<script type="text/javascript" language="javascript" src="<?php echo ALCASAR_ADMIN_PATH_JS; ?>/jquery-ui-i18n.min.js"></script>
<!-- include page javascript -->
<script type="text/javascript">
        function seconds2Hms(d) {
                d = Number(d);
                var h = Math.floor(d / 3600);
                var m = Math.floor(d % 3600 / 60);
                var s = Math.floor(d % 3600 % 60);
                //return ((h > 0 ? h + ":" : "") + (m > 0 ? (h > 0 && m < 10 ? "0" : "") + m + ":" : "0:") + (s < 10 ? "0" : "") + s);
                return new array(h,m,s);
    }
        function hms2Seconds(h, m, s) {
                h = Number(d);
                m = Number(d);
                s = Number(d);
                
                return Math.floor(h * 3600 + m * 60 + s);
    }
        
        $(function(){   
                // Tabs
                $('#tabs-user').tabs();
                // datepicker
                $.datepicker.setDefaults( $.datepicker.regional[ "fr" ] );
                //$( ".datepicker" ).datepicker( $.datepicker.regional[ "fr" ] );
                $( ".datepicker" ).datepicker(
                {
                        altFormat: 'yy-mm-dd',
                        altField: '#altExpirationDate', //pour mise à jour de ma bdd!
                        dateFormat: 'dd MM yy'
                });
                // button
                $( "button, input:submit, input:button, input:reset").button();
        });                     
</script>
<style type="text/css">
.datepicker{
        background:url(<?php echo ALCASAR_ADMIN_PATH_IMG; ?>/calendrier.gif) no-repeat 110px 3px;
}               
</style>
</head>
<body>
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
        <span class="ui-dialog-title" id="ui-dialog-title-dialog">Gestion des usagers</span>
</div>
<div id="usager">
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="hidden" name="username" value="<?php echo $username; ?>">
        <div id="">
        <br />
        <table class="ui-widget ui-widget-content" width="570">
        <tr>
                <td width="150">Usager (login):</td>
                <td width="100"><input type="text" name="User" id="User" value="<?php echo $username; ?>" readonly size="20"></td>
                <td width="150"></td>
                <td></td>
        <tr>
        <tr>
                <td>Mot de passe :</td>
                <td><input type="text" name="User-mdp" id="User-mdp" value="********" size="20"></td>
                <td><button>Générer MDP</button></td>
                <td></td>
        <tr>
        <tr>
                <td></td>
                <td><input type="text" name="User-mdp-clear" id="User-mdp-clear" value="" readonly size="20"></td>
                <td></td>
                <td></td>
        <tr>
        <tr>
                <td>Date d'expiration :</td>
                <td>
                <input type="text" value="<?php echo $user['expiration']; ?>" name="Expiration" id="Expiration" class="datepicker">
                <input type="text" value="" name="altExpirationDate" id="altExpirationDate">
                </td>
                <td></td>
                <td></td>
        </tr>
        <tr><td colspan="2"><br /></td><td></td><tr>
        <tr><td colspan="2"><input type="button" value="Supprimer" name="bdelete" id="bdelete"> <input type="submit" value="Modifier" name="bupdate" id="bupdate"></td><td></td><td></td><tr>
        </table>
        
        <br />
        </div>
        <div id="tabs-user">
                <ul>
                        <li><a href="#tabs1">Infos personnelles</a></li>
                        <li><a href="#tabs4">Caractéristiques</a></li>
                        <li><a href="#tabs2">Membre de</a></li>
                        <li><a href="#tabs5">Etats</a></li>
                        <li><a href="#tabs6">Sessions ouvertes</a></li>
                        <li><a href="#tabs7">Connexion</a></li>
                </ul>           
                
                <div id="tabs1">
                        <table class="ui-widget ui-widget-content" width="550">
                        <tr><td>Nom complet (NOM Prénom)</td><td><input type="text" name="Name" id="" size="50" value="<?php echo $user['name'];?>"></td><tr>
                        <tr><td>Mail</td><td><input type="text" name="Mail" id="Mail" size="50" value="<?php echo $user['mail'];?>"></td><tr>
                        <tr><td>Service</td><td><input type="text" name="Department" id="Department" size="50" value="<?php echo $user['department'];?>"></td><tr>
                        <tr><td>Téléphone personnel</td><td><input type="text" name="HomePhone" id="HomePhone" size="50" value="<?php echo $user['homephone'];?>"></td><tr>
                        <tr><td>Téléphone bureau</td><td><input type="text" name="WorkPhone" id="WorkPhone" size="50" value="<?php echo $user['workphone'];?>"></td><tr>
                        <tr><td>Téléphone mobile</td><td><input type="text" name="Mobile" id="Mobile" size="50" value="<?php echo $user['mobile'];?>"></td><tr>
                        <tr><td><br /></td><td></td></tr>
                        </table>
                </div>
                
                <div id="tabs2">
                        <button>Ajouter à un groupes</button>
                        <table id="groups_table" cellspacing="1" border="1" width="400">
                        <thead><tr><th width="20">#</th><th colspan="2">Groupes</th></tr></thead>
                        <tbody>
                        <tr><td width="20">#</td><td>testgroup</td><td width='10'><image src='<?php echo ALCASAR_ADMIN_PATH_IMG."/delete.png"; ?>'></td></tr>
                        <?php 
                        $groups = array(); // faire une boucle pour les groupes
                        foreach ($groups as $group){
                                echo "<tr><td></td><td>".$group['groupname']."</td><td width='10'><image src='".ALCASAR_ADMIN_PATH_IMG."/delete.png'></td> </tr>";
                        } ?>
                        </tbody>
                        </table>
                </div>
                        
                <div id="tabs4">
                <table class="ui-widget ui-widget-content" width="550">
                <!--thead><tr class="ui-widget-header"><td></td><td></td></tr></thead-->
                <tbody>
                <tr><td>Nombre de session simultanée</td><td><input type="text" value="<?php echo $user['simultaneous-use']; ?>" name="Simultaneous-Use" id=""></td></tr>
                <tr><td>Durée limite d'une session</td><td><input type="hidden" name="Session-Timeout" id="" value=""><input type="text" value="" name="Session-Timeout_h" id="" size="4">h<input type="text" value="" name="Session-Timeout_mm" id="" size="2">mm<input type="text" value="" name="Session-Timeout_s" id="Session-Timeout_s" size="2">s</td></tr>
                <tr><td>Durée limite journalière</td><td><input type="hidden" name="Max-Daily-Session" id="" value=""><input type="text" value="" name="Max-Daily-Session_h" id="" size="4">h<input type="text" value="" name="Max-Daily-Session_mm" id="" size="2">mm<input type="text" value="" name="Max-Daily-Session_s" id="Max-Daily-Session_s" size="2">s</td></tr>
                <tr><td>Durée limite mensuelle</td><td><input type="hidden" name="Max-Monthly-Session" id="" value=""><input type="text" value="" name="Max-Monthly-Session_h" id="" size="4">h<input type="text" value="" name="Max-Monthly-Session_mm" id="" size="2">mm<input type="text" value="" name="Max-Monthly-Session_s" id="Max-Monthly-Session_s" size="2">s</td></tr>
                <tr><td>Période hebdomadaire</td><td><input type="text" value="<?php echo $user['login-time']; ?>" name="Login-Time" id="Login-Time"></td></tr>
                <tr><td>Nombre d'octets max. en émission (en octets)</td><td><input type="text" value="<?php echo $user['chillispot-max-input-octets']; ?>" name="ChilliSpot-Max-Input-Octets" id="ChilliSpot-Max-Input-Octets"></td></tr>
                <tr><td>Nombre d'octets max. en réception (en octets)</td><td><input type="text" value="<?php echo $user['chillispot-max-output-octets']; ?>" name="ChilliSpot-Max-Output-Octets" id="ChilliSpot-Max-Output-Octets"></td></tr>
                <tr><td>Nombre d'octets max. total transmit (en octets)</td><td><input type="text" value="<?php echo $user['chillispot-max-total-octets']; ?>" name="ChilliSpot-Max-Total-Octets" id="ChilliSpot-Max-Total-Octets"></td></tr>
                <tr><td>Bande passante montante max. (en kbits/seconde) </td><td><input type="text" value="<?php echo $user['chillispot-bandwidth-max-up']; ?>" name="ChilliSpot-Bandwidth-Max-Up" id="ChilliSpot-Bandwidth-Max-Up"></td></tr>
                <tr><td>Bande passante descendante max. (en kbits/seconde)</td><td><input type="text" value="<?php echo $user['chillispot-bandwidth-max-down']; ?>" name="ChilliSpot-Bandwidth-Max-Down" id="ChilliSpot-Bandwidth-Max-Down"></td></tr>
                <tr><td>URL de redirection</td><td><input type="text" value="<?php echo $user['wispr-redirection-url']; ?>" name="WISPr-Redirection-URL" id="WISPr-Redirection-URL"></td></tr>
                <tr><td><br /></td><td></td></tr>
                </tbody>
                </table>
        
                </div>
                
                <div id="tabs5"></div>
                <div id="tabs6">
                Nb. sessions ouvertes : X<br />
                <br />
                <button>Déconnectet toutes les sessions ouvertes</button>
                <br /><br />
                <table class="ui-widget ui-widget-content">
                <thead><tr class="ui-widget-header"><td width="50">#</td><td width="100">MAC</td><td width="100">IP</td><td>Hôte</td><td>Date/heure</td><td>-</td></tr></thead>
                <tbody>
                <tr><td>1</td><td>exemple</td><td>exemple</td><td>exemple</td><td>exemple</td><td><a href="">déconnecter</a></td></tr>
                <tr><td>2</td><td>exemple</td><td>exemple</td><td>exemple</td><td>exemple</td><td><a href="">déconnecter</a></td></tr>
                </tbody>
                </table>
                </div>
                <div id="tabs7"></div>
        </div>
</form>
<div>

</body>
</body>

Generated by GNU Enscript 1.6.6.