Alternc  3.2
Alternc logiel libre pour l'h├ębergement
 All Data Structures Namespaces Files Functions Variables Pages
sql_list.php
Go to the documentation of this file.
1 <?php
2 /*
3  $Id: sql_list.php,v 1.8 2006/02/16 16:26:28 benjamin Exp $
4  ----------------------------------------------------------------------
5  AlternC - Web Hosting System
6  Copyright (C) 2002 by the AlternC Development Team.
7  http://alternc.org/
8  ----------------------------------------------------------------------
9  Based on:
10  Valentin Lacambre's web hosting softwares: http://altern.org/
11  ----------------------------------------------------------------------
12  LICENSE
13 
14  This program is free software; you can redistribute it and/or
15  modify it under the terms of the GNU General Public License (GPL)
16  as published by the Free Software Foundation; either version 2
17  of the License, or (at your option) any later version.
18 
19  This program is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  GNU General Public License for more details.
23 
24  To read the license please visit http://www.gnu.org/copyleft/gpl.html
25  ----------------------------------------------------------------------
26  Original Author of file: Benjamin Sonntag
27  Purpose of file: Manage the MySQL database of a member
28  ----------------------------------------------------------------------
29 */
30 require_once("../class/config.php");
31 include_once("head.php");
32 
33 $rdb=$mysql->get_dblist();
34 $r=$mysql->get_userslist();
35 
36 ?>
37 <h3><?php __("MySQL Databases"); ?></h3>
38 <hr id="topbar"/>
39 <br />
40 <?php
41  if (isset($error) && $error) {
42  echo "<p class=\"alert alert-danger\">$error</p>";
43  }
44  if(!$r || empty($r)){
45  echo "<p class=\"alert alert-info\">"._("You have no sql user at the moment.")."</p>";
46  }
47 ?>
48 
49 <?php
50 if($rdb){
51 ?>
52 <form method="post" action="sql_del.php" name="main" id="main">
53 <table class="tlist">
54  <tr><th>&nbsp;</th><th><?php __("Database"); ?></th><?php if ( variable_get('sql_allow_users_backups') ) { ?><th><?php __("Backup"); ?></th><?php } // sql_allow_users_backups ?><th><?php __("Restore"); ?></th><th><?php __("Show Settings"); ?></th><th><?php __("Size"); ?></th></tr>
55 
56 <?php
57 for($i=0;$i<count($rdb);$i++) {
58  $val=$rdb[$i];
59  $val['size'] = $mysql->get_db_size($val['db']);
60 ?>
61  <tr class="lst">
62  <td align="center"><input type="checkbox" class="inc" id="del_<?php echo $val["db"]; ?>" name="del_<?php echo $val["db"]; ?>" value="<?php echo ($val["db"]); ?>" /></td>
63  <td><label for="del_<?php echo $val["db"]; ?>"><?php echo $val["db"]; ?></label></td>
64 <?php if ( variable_get('sql_allow_users_backups') ) { ?>
65  <td><div class="ina down"><a href="sql_bck.php?id=<?php echo $val["db"] ?>"><?php __("Backup"); ?></a></div></td>
66 <?php } // sql_allow_users_backups ?>
67  <td><div class="ina up"><a href="sql_restore.php?id=<?php echo $val["db"] ?>"><?php __("Restore"); ?></a></div></td>
68  <td><div class="ina configure"><a href="sql_getparam.php?dbname=<?php echo $val["db"] ?>"><?php __("Show Settings"); ?></a></div></td>
69  <td><code><?php echo format_size($val["size"]); ?></code></td>
70  </tr>
71 <?php
72 
73 
74  }
75 ?>
76 <tr><td colspan="5">
77  <input type="submit" name="sub" value="<?php __("Delete the checked databases"); ?>" class="inb delete" />
78 </td></tr>
79 </table>
80 </form>
81 <?php
82 }
83 ?>
84 <p>&nbsp;</p>
85 
86 <?php if ($quota->cancreate("mysql")) {
87  $q=$quota->getquota("mysql");
88  if($q['u'] == 0 ){
89 ?>
90 <p> <span class="ina"><a href="sql_doadd.php"><?php __("Create a new MySQL database"); ?></a></span> </p>
91 <?php }else{
92 ?>
93 <form method="post" action="sql_doadd.php" id="main2" name="main2">
94 <table class="tedit">
95 <tr>
96  <th><label for="dbn"><?php __("MySQL Database"); ?></label></th>
97  <td>
98  <?php
99  // Max 16 caracters for the database name if we want the mysql user to be automatically created.
100  $max_dbsufix_size=(16-strlen($mem->user["login"].'_'));
101  ?>
102  <span class="int" id="dbnpfx"><?php echo $mem->user["login"]; ?>_</span><input type="text" class="int" name="dbn" id="dbn" value="" size="20" maxlength="<?php echo $max_dbsufix_size ;?>" />
103  </td>
104 </tr>
105 </table>
106 <br />
107 <input type="submit" class="inb add" name="submit" value="<?php __("Create this new MySQL database."); ?>" onClick="return false_if_empty('dbn', '<?php echo addslashes(_("Can't have empty MySQL suffix"));?>');" />
108 </form>
109 <?php
110 }
111 }
112 ?>
113 <script type="text/javascript">
114 //document.forms['main'].pass.focus();
115 //document.forms['main'].setAttribute('autocomplete', 'off');
116 </script>
117 <?php include_once("foot.php"); ?>