Alternc  latest
Alternc logiel libre pour l'hébergement
index.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  ----------------------------------------------------------------------
5  LICENSE
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License (GPL)
9  as published by the Free Software Foundation; either version 2
10  of the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  To read the license please visit http://www.gnu.org/copyleft/gpl.html
18  ----------------------------------------------------------------------
19 */
20 
21 /**
22  * Show the login page (hence the config_nochk below)
23  * this page is the only one, with logout.php, to NOT ask
24  * for authentication
25  *
26  * @copyright AlternC-Team 2000-2017 https://alternc.com/
27  */
28 
29 require_once("../class/config_nochk.php");
30 
31 if ($mem->checkid(false)) {
32  Header("Location: /main.php");
33  exit;
34 }
35 
36 $mem->del_session();
37 
38 $H=getenv("HTTP_HOST");
39 
40 if (!isset($restrictip)) {
41  $restrictip=1;
42 }
43 if (!isset($charset) || ! $charset) $charset="UTF-8";
44 @header("Content-Type: text/html; charset=$charset");
45 
46 require_once("html-head.php");
47 ?>
48 <body class="login_page">
49  <div id="global">
50 
51  <div id="content">
52 <?php
53 // Getting logo
54 $logo = variable_get('logo_login', '' ,'You can specify a logo for the login page, example /images/my_logo.png .', array('desc'=>'URL','type'=>'string'));
55 if ( empty($logo) || ! $logo ) {
56  $logo = 'images/logo.png';
57 }
58 ?>
59  <p id='logo'> <img src="<?php echo $logo; ?>" border="0" height="100px" alt="<?php __("Web Hosting Control Panel"); ?>" title="<?php __("Web Hosting Control Panel"); ?>" />
60  </p>
61  <p>&nbsp;</p>
62  <?php echo $msg->msg_html_all(); ?>
63  <br/>
64  <?php
65  if (isset($_GET['authip_token'])) $authip_token=$_GET['authip_token'];
66  if (variable_get('https_warning', true, 'warn users to switch to HTTPS') && !isset($_SERVER['HTTPS'])) {
67  echo '<div class="unsecure"><strong>' . sprintf(_('WARNING: you are trying to access the control panel insecurely, click <a href="https://%s">here</a> to go to secure mode'), $_SERVER["HTTP_HOST"]) . '</strong></div>';
68  }
69  ?>
70  <div class="block_list">
71  <div class="block_login_page">
72  <?php __("To connect to the hosting control panel, enter your AlternC's login and password in the following form and click 'Enter'"); ?>
73  </div>
74  <div class="block_login_page">
75  <div class="menu-box">
76  <?php if (!empty($authip_token)) { echo "<p style='color:red;'>";__("You are attemping to connect without IP restriction."); echo "</p>"; } ?>
77  <div class="menu-title"><?php __("AlternC access"); ?></div>
78  <form action="login.php" method="post" name="loginform" target="_top">
79  <?php csrf_get(); ?>
80  <div class="menu-content">
81  <div><label for="username"><?php echo _("Username"); ?></label></td><td><input type="text" class="int" name="username" id="username" value="" maxlength="128" autocapitalize="none" /></div>
82  <div><label for="password"><?php echo _("Password"); ?></label></td><td><input type="password" class="int" name="password" id="password" value="" maxlength="128" /></div>
83  <div class="submit"><input type="submit" class="inb" name="submit" onclick='return logmein();' value="<?php __("Enter"); ?>" /><input type="hidden" id="restrictip" name="restrictip" value="0" />
84  <input type="hidden" id="authip_token" name="authip_token" value="<?php ehe( (empty($authip_token)?'':$authip_token) ) ?>" /></div>
85  </div>
86  </form>
87  </div>
88  </div>
89  <div class="block_login_page">
90  <a href="request_reset.php"><?php echo _('Request new password'); ?></a>
91  <br />
92  <?php __("You must accept the session cookie to log-in"); ?>
93  <br />
94  <?php echo _("If you want to use a different language, choose it in the list below"); ?>
95  <br />
96  <?php
97  foreach($locales as $l) {
98  ?>
99  <a href="?setlang=<?php echo $l; ?>"><?php if (isset($lang_translation[$l])) echo $lang_translation[$l]; else echo $l; ?></a>
100  <?php } ?>
101  <br />
102  <?php
103  $mem->show_help("login",true);
104  ?>
105  </div>
106  <div class="block_login_page">
107  <?php
108 
109  // Here we used to have a form to enter the squirrelmail's webmail.
110  // Following the "rule of less astonishment, we try to put it here again, even though the webmail is now a plugin.
111  $res=$hooks->invoke("hook_admin_webmail");
112  if (($wr=variable_get("webmail_redirect")) && isset($res[$wr]) && $res[$wr]) {
113  $url=$res[$wr];
114  } else {
115  foreach($res as $r) if ($r!==false) { $url=$r; break; }
116  }
117  if (isset($url) && $url) {
118  ?>
119  <p><a href="<?php echo $url; ?>"><?php __("To read your mail in a browser, click here to go to your server's Webmail"); ?></a></p>
120  <?php
121  }
122  ?>
123  </div>
124  </div>
125  <div class="alternc_powered">
126  <a href="http://www.alternc.com/"><img src="images/powered_by_alternc2.png" width="128" height="32" alt="Powered by AlternC" /></a>
127  </div>
128 
129  <script type="text/javascript">
130  $('#username').focus();
131 
132  function logmein(){
133  if ( $('#username').val() =='' || $('#password').val() =='' ) {
134  alert("<?php __("Need a login and a password"); ?>");
135  return false;
136  }
137  return true;
138  }
139  </script>
140 
141  </div>
142  <div style="clear:both;" ></div>
143  </div>
144 </body>
145 </html>
exit
Definition: adm_doadd.php:70
$hooks
Definition: bootstrap.php:74
$mem
Definition: bootstrap.php:71
$msg
Definition: bootstrap.php:75
$r
Definition: aws_add.php:75
$res
Definition: index.php:111
$logo
Definition: index.php:54
$H
Definition: index.php:38
variable_get($name, $default=null, $createit_comment=null)
Return a persistent variable.
Definition: variables.php:85
__($str)
Definition: functions.php:404
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