Alternc  latest
Alternc logiel libre pour l'hébergement
sql_users_rights.php
Go to the documentation of this file.
1 <?php
2 /*
3  ----------------------------------------------------------------------
4  LICENSE
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License (GPL)
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  To read the license please visit http://www.gnu.org/copyleft/gpl.html
17  ----------------------------------------------------------------------
18 */
19 
20 /**
21  * Manages MySQL users granted rights
22  *
23  * @copyright AlternC-Team 2000-2017 https://alternc.com/
24  */
25 
26 require_once("../class/config.php");
27 include_once("head.php");
28 
29 $fields = array (
30  "id" => array ("request", "string", ""),
31 );
33 ?>
34 <h3><?php printf(_("Manage MySQL rights for user '%s'"),$id) ?></h3>
35 <hr id="topbar"/>
36 <br />
37 <?php
38 $r=$mysql->get_user_dblist($id);
39 
40 if ($msg->has_msgs("ERROR")) {
41  require_once('sql_users_list.php');
42  exit();
43 }
44 
45 if ($r) {
46 
47 ?>
48 
49 <form method="post" action="sql_users_dorights.php">
50  <?php csrf_get(); ?>
51 <input type="hidden" name="id" value="<?php ehe($id); ?>" />
52 <table cellspacing="0" cellpadding="4" class="tlist ombrage">
53  <tr class="petit">
54  <th colspan="2"><?php __("Database"); ?></th>
55  <th>SELECT</th>
56  <th>INSERT</th>
57  <th>UPDATE</th>
58  <th>DELETE</th>
59  <th>CREATE</th>
60  <th>DROP</th>
61  <th>REFERENCES</th>
62  <th>INDEX</th>
63  <th>ALTER</th>
64  <th>CREATE_TMP_TABLE</th>
65  <th>LOCK</th>
66  <th>CREATE VIEW</th>
67  <th>SHOW VIEW</th>
68  <th>CREATE ROUTINE</th>
69  <th>ALTER ROUTINE</th>
70  <th>EXECUTE</th>
71  <th>EVENT</th>
72  <th>TRIGGER</th>
73  </tr>
74 
75 <?php
76 $sql_right=$mysql->available_sql_rights();
77 for($i=0;$i<count($r);$i++) {
78  $val=$r[$i];
79 ?>
80  <tr class="lst">
81  <td><strong><?php echo $val["db"] ?></strong></td>
82  <td><a href="javascript:inverse_sql_right('<?php echo htmlentities($val["db"]);?>');"><?php __('Reverse selection');?></a></td>
83  <?php foreach($sql_right as $sr) { ?>
84  <td align="center">
85  <input type="checkbox" class="inc" id="<?php echo $val["db"]."_$sr"; ?>" name="<?php echo $val["db"]."_$sr"; ?>"<?php if($val[$sr]=="Y") echo " checked=\"checked\""; ?> />
86  </td>
87  <?php } ?>
88  </tr>
89 <?php
90 
91 
92  }
93 ?>
94 </table>
95 <p>
96  <input type="submit" class="inb ok" value="<?php __("Apply"); ?>"/>
97  <input type="button" class="inb cancel" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='sql_users_list.php'"/>
98 </p>
99 </form>
100 <p>&nbsp;</p>
101 <script type="text/javascript">
102 function inverse_sql_right(db) {
103  <?php foreach($sql_right as $sr) { ?>
104  if ( document.getElementById(db+'_<?php echo $sr;?>').checked ) {
105  document.getElementById(db+'_<?php echo $sr;?>').checked=false;
106  } else {
107  document.getElementById(db+'_<?php echo $sr;?>').checked=true;
108  }
109  <?php } ?>
110 }
111 
112 </script>
113 <?php } ?>
114 <?php include_once("foot.php"); ?>
if(!($ds=ldap_connect($L_LDAP_HOST))) if(!(ldap_bind($ds, $L_LDAP_ROOT, $L_LDAP_ROOTPWD))) if(!mysql_connect($L_MYSQL_HOST, $L_MYSQL_LOGIN, $L_MYSQL_PWD)) if(!mysql_select_db($L_MYSQL_DATABASE)) $sr
exit
Definition: adm_doadd.php:70
$msg
Definition: bootstrap.php:75
$r
Definition: aws_add.php:75
__($str)
Definition: functions.php:404
getFields($fields, $requestOnly=false)
Get the Fields of the posted form from $_REQUEST or POST or GET and check their type.
Definition: functions.php:688
csrf_get($return=false)
Give a new CSRF uniq token for a form the session must be up since the CSRF is linked to the session ...
Definition: functions.php:1159
$i
$fields
Manages MySQL users granted rights.
if(!isset($is_include)) if(! $key &&! $crt) $id
$val
Definition: tempovars.php:15