Subversion Repositories ALCASAR

Rev

Rev 610 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
610 stephane 1
<?php
2
/*
703 stephane 3
Array
4
(
5
    [username] => s
6
    [User] => s
7
    [User-mdp] => ********
8
    [User-mdp-clear] => 
9
    [Expiration] => 23 April 2011
10
    [altExpirationDate] => 
11
    [bupdate] => Modifier
12
    [name] => 
13
    [email] => 
14
    [service] => 
15
    [phone] => 
16
    [bureau] => 
17
    [mobile] => 
18
    [Simultaneous-Use] => 1
19
    [Session-Timeout] => 
20
    [Session-Timeout_h] => 
21
    [Session-Timeout_mm] => 
22
    [Session-Timeout_s] => 
23
    [Max-Daily-Session] => 
24
    [Max-Daily-Session_h] => 
25
    [Max-Daily-Session_mm] => 
26
    [Max-Daily-Session_s] => 
27
    [Max-Monthly-Session] => 
28
    [Max-Monthly-Session_h] => 
29
    [Max-Monthly-Session_mm] => 
30
    [Max-Monthly-Session_s] => 
31
    [Login-Time] => 
32
    [ChilliSpot-Max-Input-Octets] => 
33
    [ChilliSpot-Max-Output-Octets] => 
34
    [ChilliSpot-Max-Total-Octets] => 
35
    [ChilliSpot-Bandwidth-Max-Up] => 
36
    [ChilliSpot-Bandwidth-Max-Down] => 
37
    [WISPr-Redirection-URL] => 
38
)
610 stephane 39
*/
40
require_once('includes/defines.inc.php');
41
require_once(ALCASAR_ADMIN_PATH_INC.'/session.inc.php');
42
//include(ALCASAR_ADMIN_PATH_LIB.'/user.class.php');
43
include(ALCASAR_ADMIN_PATH_LIB.'/radiusMysqlUser.class.php');
44
 
703 stephane 45
/*
46
Traitement des mises à jours
47
*/
48
if (isset($_POST['bupdate'])&&isset($_POST['username'])){
49
 
50
	$username = $_POST['username'];
51
		/*
52
		echo '<pre>';
53
		print_r($_POST);
54
		echo '</pre>';
55
		*/
56
	//$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');
57
	$ouser = new radiusMysqlUser();
58
	echo '<pre>';
59
	foreach ($_POST as $key => $val){
60
		if (in_array($key, $attrmap)){
61
			/*
62
			ATTENTION FAIRE UN TEST DE $VAL!!!
63
 
64
			METTRE EN FORME LES DATES
65
 
66
			*/
67
			echo $key.' '.$val;
68
			$ouser->set($key,$val);
69
		}
70
	}
71
	echo '</pre>';
72
	$ouser->save();
610 stephane 73
} else {
703 stephane 74
	if (isset($_GET['username'])){
75
		$username = $_GET['username'];//faire fonction xss_clean	
76
	} else {
77
		header('Location: users.php');
78
	}
79
	$ouser = new radiusMysqlUser();
80
	$ouser->load($username, true);
610 stephane 81
}
82
$user = $ouser->get();
703 stephane 83
echo '<pre>';
84
		print_r($user);
85
		echo '</pre>';
86
/*
87
Affichage de la page
88
*/
610 stephane 89
?>
90
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
91
<html>
92
<head>
93
<title>Edit <?php echo $options['username']; ?></title>
94
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
95
<!-- include default CSS -->
96
<link rel="stylesheet" href="<?php echo ALCASAR_ADMIN_PATH_CSS; ?>/default/default.css" type="text/css">
97
<!--link rel="stylesheet" href="../css/style.css" type="text/css"-->
98
<!-- include JQUERY UI CSS -->
99
<link type="text/css"  rel="stylesheet" href="<?php echo ALCASAR_ADMIN_PATH_CSS; ?>/default/ui-lightness/jquery-ui-1.8.10.custom.css">
100
<!-- include custom page CSS -->
101
 
102
<!-- include JQUERY -->
703 stephane 103
<script type="text/javascript" language="javascript" src="<?php echo ALCASAR_ADMIN_PATH_JS; ?>/jquery-1.6.1.min.js"></script>
610 stephane 104
<!-- include JQUERY UI -->
105
<script type="text/javascript" language="javascript" src="<?php echo ALCASAR_ADMIN_PATH_JS; ?>/jquery-ui-1.8.10.all.min.js"></script>
703 stephane 106
<script type="text/javascript" language="javascript" src="<?php echo ALCASAR_ADMIN_PATH_JS; ?>/jquery-ui-i18n.min.js"></script>
610 stephane 107
<!-- include page javascript -->
108
<script type="text/javascript">
703 stephane 109
	function seconds2Hms(d) {
110
		d = Number(d);
111
		var h = Math.floor(d / 3600);
112
		var m = Math.floor(d % 3600 / 60);
113
		var s = Math.floor(d % 3600 % 60);
114
		//return ((h > 0 ? h + ":" : "") + (m > 0 ? (h > 0 && m < 10 ? "0" : "") + m + ":" : "0:") + (s < 10 ? "0" : "") + s);
115
		return new array(h,m,s);
116
    }
117
	function hms2Seconds(h, m, s) {
118
		h = Number(d);
119
		m = Number(d);
120
		s = Number(d);
121
 
122
		return Math.floor(h * 3600 + m * 60 + s);
123
    }
610 stephane 124
 
703 stephane 125
	$(function(){	
610 stephane 126
		// Tabs
127
		$('#tabs-user').tabs();
128
		// datepicker
703 stephane 129
		$.datepicker.setDefaults( $.datepicker.regional[ "fr" ] );
130
		//$( ".datepicker" ).datepicker( $.datepicker.regional[ "fr" ] );
131
		$( ".datepicker" ).datepicker(
132
		{
133
			altFormat: 'yy-mm-dd',
134
			altField: '#altExpirationDate', //pour mise à jour de ma bdd!
135
			dateFormat: 'dd MM yy'
136
		});
610 stephane 137
		// button
138
		$( "button, input:submit, input:button, input:reset").button();
703 stephane 139
	});			
610 stephane 140
</script>
141
<style type="text/css">
142
.datepicker{
703 stephane 143
	background:url(<?php echo ALCASAR_ADMIN_PATH_IMG; ?>/calendrier.gif) no-repeat 110px 3px;
610 stephane 144
}		
145
</style>
146
</head>
147
<body>
148
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
149
	<span class="ui-dialog-title" id="ui-dialog-title-dialog">Gestion des usagers</span>
150
</div>
151
<div id="usager">
703 stephane 152
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
153
<input type="hidden" name="username" value="<?php echo $username; ?>">
610 stephane 154
	<div id="">
155
	<br />
703 stephane 156
	<table class="ui-widget ui-widget-content" width="570">
610 stephane 157
	<tr>
703 stephane 158
		<td width="150">Usager (login):</td>
159
		<td width="100"><input type="text" name="User" id="User" value="<?php echo $username; ?>" readonly size="20"></td>
160
		<td width="150"></td>
161
		<td></td>
162
	<tr>
163
	<tr>
164
		<td>Mot de passe :</td>
165
		<td><input type="text" name="User-mdp" id="User-mdp" value="********" size="20"></td>
166
		<td><button>Générer MDP</button></td>
167
		<td></td>
168
	<tr>
169
	<tr>
170
		<td></td>
171
		<td><input type="text" name="User-mdp-clear" id="User-mdp-clear" value="" readonly size="20"></td>
172
		<td></td>
173
		<td></td>
174
	<tr>
175
	<tr>
176
		<td>Date d'expiration :</td>
610 stephane 177
		<td>
703 stephane 178
		<input type="text" value="<?php echo $user['expiration']; ?>" name="Expiration" id="Expiration" class="datepicker">
179
		<input type="text" value="" name="altExpirationDate" id="altExpirationDate">
610 stephane 180
		</td>
703 stephane 181
		<td></td>
182
		<td></td>
610 stephane 183
	</tr>
184
	<tr><td colspan="2"><br /></td><td></td><tr>
703 stephane 185
	<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>
610 stephane 186
	</table>
187
 
188
	<br />
189
	</div>
190
	<div id="tabs-user">
191
		<ul>
703 stephane 192
			<li><a href="#tabs1">Infos personnelles</a></li>
193
			<li><a href="#tabs4">Caractéristiques</a></li>
194
			<li><a href="#tabs2">Membre de</a></li>
195
			<li><a href="#tabs5">Etats</a></li>
196
			<li><a href="#tabs6">Sessions ouvertes</a></li>
197
			<li><a href="#tabs7">Connexion</a></li>
198
		</ul>		
610 stephane 199
 
703 stephane 200
		<div id="tabs1">
201
			<table class="ui-widget ui-widget-content" width="550">
202
			<tr><td>Nom complet (NOM Prénom)</td><td><input type="text" name="Name" id="" size="50" value="<?php echo $user['name'];?>"></td><tr>
203
			<tr><td>Mail</td><td><input type="text" name="Mail" id="Mail" size="50" value="<?php echo $user['mail'];?>"></td><tr>
204
			<tr><td>Service</td><td><input type="text" name="Department" id="Department" size="50" value="<?php echo $user['department'];?>"></td><tr>
205
			<tr><td>Téléphone personnel</td><td><input type="text" name="HomePhone" id="HomePhone" size="50" value="<?php echo $user['homephone'];?>"></td><tr>
206
			<tr><td>Téléphone bureau</td><td><input type="text" name="WorkPhone" id="WorkPhone" size="50" value="<?php echo $user['workphone'];?>"></td><tr>
207
			<tr><td>Téléphone mobile</td><td><input type="text" name="Mobile" id="Mobile" size="50" value="<?php echo $user['mobile'];?>"></td><tr>
208
			<tr><td><br /></td><td></td></tr>
209
			</table>
610 stephane 210
		</div>
211
 
703 stephane 212
		<div id="tabs2">
213
			<button>Ajouter à un groupes</button>
214
			<table id="groups_table" cellspacing="1" border="1" width="400">
215
			<thead><tr><th width="20">#</th><th colspan="2">Groupes</th></tr></thead>
216
			<tbody>
217
			<tr><td width="20">#</td><td>testgroup</td><td width='10'><image src='<?php echo ALCASAR_ADMIN_PATH_IMG."/delete.png"; ?>'></td></tr>
218
			<?php 
219
			$groups = array(); // faire une boucle pour les groupes
220
			foreach ($groups as $group){
221
				echo "<tr><td></td><td>".$group['groupname']."</td><td width='10'><image src='".ALCASAR_ADMIN_PATH_IMG."/delete.png'></td> </tr>";
222
			} ?>
223
			</tbody>
610 stephane 224
			</table>
225
		</div>
703 stephane 226
 
227
		<div id="tabs4">
228
		<table class="ui-widget ui-widget-content" width="550">
610 stephane 229
		<!--thead><tr class="ui-widget-header"><td></td><td></td></tr></thead-->
230
		<tbody>
703 stephane 231
		<tr><td>Nombre de session simultanée</td><td><input type="text" value="<?php echo $user['simultaneous-use']; ?>" name="Simultaneous-Use" id=""></td></tr>
232
		<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>
233
		<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>
234
		<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>
235
		<tr><td>Période hebdomadaire</td><td><input type="text" value="<?php echo $user['login-time']; ?>" name="Login-Time" id="Login-Time"></td></tr>
236
		<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>
237
		<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>
238
		<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>
239
		<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>
240
		<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>
241
		<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>
610 stephane 242
		<tr><td><br /></td><td></td></tr>
243
		</tbody>
244
		</table>
245
 
246
		</div>
247
 
703 stephane 248
		<div id="tabs5"></div>
249
		<div id="tabs6">
610 stephane 250
		Nb. sessions ouvertes : X<br />
251
		<br />
252
		<button>Déconnectet toutes les sessions ouvertes</button>
253
		<br /><br />
254
		<table class="ui-widget ui-widget-content">
255
		<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>
256
		<tbody>
257
		<tr><td>1</td><td>exemple</td><td>exemple</td><td>exemple</td><td>exemple</td><td><a href="">déconnecter</a></td></tr>
258
		<tr><td>2</td><td>exemple</td><td>exemple</td><td>exemple</td><td>exemple</td><td><a href="">déconnecter</a></td></tr>
259
		</tbody>
260
		</table>
261
		</div>
703 stephane 262
		<div id="tabs7"></div>
610 stephane 263
	</div>
703 stephane 264
</form>
610 stephane 265
<div>
266
 
267
</body>
602 stephane 268
</body>