index.php 6.42 KB
Newer Older
1
<?php
2

3 4 5
/*
 ----------------------------------------------------------------------
 AlternC - Web Hosting System
6 7
 Copyright (C) 2000-2012 by the AlternC Development Team.
 https://alternc.org/
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
 ----------------------------------------------------------------------
 LICENSE

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License (GPL)
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 To read the license please visit http://www.gnu.org/copyleft/gpl.html
 ----------------------------------------------------------------------
 Purpose of file: Main index : show the login page
 ----------------------------------------------------------------------
*/

require_once("../class/config_nochk.php");

if (!$mem->del_session()) {
Alan Garcia's avatar
Alan Garcia committed
30 31
  // No need to draw an error message ...
  //$error=$err->errstr();
32 33 34
}

$H=getenv("HTTP_HOST");
35 36 37 38

if (!isset($restrictip)) {
  $restrictip=1;
}
Alan Garcia's avatar
Alan Garcia committed
39
if (!isset($charset) || ! $charset) $charset="UTF-8";
40 41
@header("Content-Type: text/html; charset=$charset");

42 43
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
44
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
45 46
<head>
<title>AlternC Desktop</title>
47
<link rel="stylesheet" href="styles/style.css" type="text/css" />
48 49 50 51 52 53
<?php
if (file_exists("styles/style-custom.css") ) {
  echo '<link rel="stylesheet" href="styles/style-custom.css" type="text/css" />';
}
?>

54
<script type="text/javascript" src="js/alternc.js"></script>
alban's avatar
alban committed
55
<script src="js/jquery.min_embedded.js" type="text/javascript"></script>
56
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
57
</head>
58
<body>
Alan Garcia's avatar
Alan Garcia committed
59 60
  <div id="global">

Alan Garcia's avatar
Alan Garcia committed
61
    <div id="content" style="width:1000px;">
62 63
<?php
// Getting logo
Alan Garcia's avatar
Alan Garcia committed
64
$logo = variable_get('logo_login', '' ,'You can specify a logo for the login page, example /images/my_logo.png .', array('desc'=>'URL','type'=>'string'));
65 66 67 68
if ( empty($logo) ||  ! $logo ) { 
  $logo = 'images/logo.png'; 
}
?>
Alan Garcia's avatar
Alan Garcia committed
69

70
      <p id="logo">  <img src="<?php echo $logo; ?>" border="0" alt="<?php __("Web Hosting Control Panel"); ?>" title="<?php __("Web Hosting Control Panel"); ?>" />
Alan Garcia's avatar
Alan Garcia committed
71 72
      </p>
      <p>&nbsp;</p>
alban's avatar
alban committed
73
    <?php if (isset($error) && $error) echo "<div class='alert alert-danger'>$error</div>"; ?>
Alan Garcia's avatar
Alan Garcia committed
74 75 76
    <br/>
    <?php
    if (isset($_GET['authip_token'])) $authip_token=$_GET['authip_token'];
77 78
    if (variable_get('https_warning', true, 'warn users to switch to HTTPS') && !isset($_SERVER['HTTPS'])) {
      echo __('<h4>WARNING: you are trying to access the control panel insecurely, click <a href="%s">here</a> to go to secure mode</h4>', $_SERVER["HTTP_HOST"]);
Alan Garcia's avatar
Alan Garcia committed
79 80 81 82 83 84 85 86 87 88 89 90
    }
    ?>
    <div style="margin: 0 auto 30px auto; width: 700px;">
      <table width="100%"><tr><td>
        <?php __("To connect to the hosting control panel, enter your AlternC's login and password in the following form and click 'Enter'"); ?>
        <?php if (!empty($authip_token)) { echo "<p style='color:red;'>";__("You are attemping to connect without IP restriction."); echo "</p>"; } ?>
        </td><td>
          <form action="login.php" method="post" name="loginform" target="_top">
            <table border="0" style="border: 1px solid #202020;" cellspacing="0" cellpadding="3" width="300px" >
            <tr><td colspan="2" align="center"><b><?php __("AlternC access"); ?></b></td></tr>
            <tr><td align="right"><label for="username"><?php echo _("Username"); ?></label></td><td><input type="text" class="int" name="username" id="username" value="" maxlength="128" size="15" /></td></tr>
            <tr><td align="right"><label for="password"><?php echo _("Password"); ?></label></td><td><input type="password" class="int" name="password" id="password" value="" maxlength="128" size="15" /></td></tr>
91
            <tr><td colspan="2" align="center"><input type="submit" class="inb" name="submit" onclick='return logmein();' value="<?php __("Enter"); ?>" /><input type="hidden" id="restrictip" name="restrictip" value="1" /></td></tr>
Alan Garcia's avatar
Alan Garcia committed
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
            </table>
            <input type="hidden" id="authip_token" name="authip_token" value="<?php echo htmlentities( (empty($authip_token)?'':$authip_token) ) ?>" />
          </form>

        </td></tr>
        <tr><td>

        <?php

          // Here we used to have a form to enter the squirrelmail's webmail.
          // Following the "rule of less astonishment, we try to put it here again, even though the webmail is now a plugin.
          $res=$hooks->invoke("hook_admin_webmail");
        if (($wr=variable_get("webmail_redirect")) && isset($res[$wr]) && $res[$wr]) {
          $url=$res[$wr];
        } else {
          foreach($res as $r) if ($r!==false) { $url=$r; break; }
        }
        if (isset($url) && $url)  {
        ?>
          <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>
        <?php
        }
        ?></td><td>

        </td></tr>

      </table>


      <table width="100%" style="border: 0">
        <tr><td style="text-align: left; font-size: 10px">
        <?php __("You must accept the session cookie to log-in"); ?>
        <br />
        <?php echo "If you want to use a different language, choose it in the list below"; ?>
        <br />
              <?php 
            foreach($locales as $l) {
              ?>
              <a href="?setlang=<?php echo $l; ?>"><?php if (isset($lang_translation[$l])) echo $lang_translation[$l]; else echo $l;  ?></a>
              <?php } ?>
        <br />
        <?php
         $mem->show_help("login",true); 
        ?>
        </td>
        <td>
        <p>
139
        <a href="http://www.alternc.com/"><img src="images/powered_by_alternc2.png" width="128" height="32" alt="Powered by AlternC" /></a>
Alan Garcia's avatar
Alan Garcia committed
140 141 142 143 144 145 146
        </p>
        </td>
        </tr>
      </table>


    </div>
147
    <script type="text/javascript">
148
    $('#username').focus();
Alan Garcia's avatar
Alan Garcia committed
149 150 151

    function logmein(){
      if ( $('#username').val() =='' || $('#password').val() =='' ) {
152
        alert("<?php __("Need a login and a password"); ?>");
Alan Garcia's avatar
Alan Garcia committed
153 154 155 156 157 158 159
        return false;
      }
      return true;
    }
    </script>

  </div>
Alan Garcia's avatar
Alan Garcia committed
160
  <div style="clear:both;" ></div>
161
  </div>
162 163
</body>
</html>