122 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			122 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * /subs/parts/userarea.php
 | |
|  * @version 1.3
 | |
|  * @desc Users area and admin console
 | |
|  * @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
 | |
|  * @copy 2018 Fándly Gergő Zoltán
 | |
|  * License:
 | |
|     Systemtest.tk website's.
 | |
|     Copyright (C) 2018  Fándly Gergő Zoltán
 | |
| 
 | |
|     This program is free software: you can redistribute it and/or modify
 | |
|     it under the terms of the GNU General Public License as published by
 | |
|     the Free Software Foundation, either version 3 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.
 | |
| 
 | |
|     You should have received a copy of the GNU General Public License
 | |
|     along with this program.  If not, see <https://www.gnu.org/licenses/>.
 | |
|  **/
 | |
| 
 | |
| $lm->loginPrepare();
 | |
| ?>
 | |
| 
 | |
| <span id="title" style="display: none"><?php echo (isset($titleExtend)?$titleExtend." :: ":"").($view==""?"":$lang[$view]." :: ").$lang['sitetitle'] ?></span>
 | |
| <span id="langName" style="display: none"><?php echo $lang['name'] ?></span>
 | |
| <span id="langExtension" style="display: none"><?php echo $lang['extension'] ?></span>
 | |
| <span id="langCopyToClip" style="display: none"><?php echo $lang['copytoclip'] ?></span>
 | |
| <span id="langQuotaErr" style="display: none"><?php echo $lang['error'][4] ?></span>
 | |
| <span id="langFileTooBig" style="display: none"><?php echo $lang['error'][5] ?></span>
 | |
| <span id="langSure" style="display: none"><?php echo $lang['sure'] ?></span>
 | |
| <span id="langEnterPassword" style="display: none"><?php echo $lang['enter_password'] ?></span>
 | |
| <span id="langEnterAccesslevel" style="display: none"><?php echo $lang['enter_accesslevel'] ?></span>
 | |
| <span id="langEnterQuota" style="display: none"><?php echo $lang['enter_quota'] ?></span>
 | |
| <span id="langEncrypting" style="display: none"><?php echo $lang['encrypting'] ?></span>
 | |
| <span id="langEncrypted" style="display: none"><?php echo $lang['encrypted'] ?></span>
 | |
| <span id="langConfDelShipping" style="display: none"><?php echo $lang['confirm_delete_shipping'] ?></span>
 | |
| <span id="langPGPNotValid" style="display: none"><?php echo $lang['error'][12] ?></span>
 | |
| <?php if(!$lm->validateLogin()): ?>
 | |
| <!-- unauthenticated -->
 | |
| <div id="loginPrompt">
 | |
|     <?php if($lm->isRememberingUser()): ?>
 | |
|     <fieldset class="center">
 | |
|         <legend><?php echo $lang['login'] ?></legend>
 | |
|         <?php
 | |
|         $sql=$db->prepare("SELECT fullname FROM users WHERE id=:id");
 | |
|         $sql->execute(array(":id"=>$lm->isRememberingUser()));
 | |
|         $res=$sql->fetch(PDO::FETCH_ASSOC);
 | |
|         ?>
 | |
|         <h3><?php echo $lang['welcome_back_1'].$res['fullname'].$lang['welcome_back_2'] ?></h3>
 | |
|         <button type="button" onclick="window.location='./userarea?auto_login'"><?php echo $lang['login'] ?></button>
 | |
|         <br>
 | |
|         <?php $lm->printCaptcha() ?>
 | |
|         <br>
 | |
|         <br>
 | |
|         <button type="button" onclick="window.location='./userarea?forget_user'"><?php echo $lang['forget_user'] ?></button>
 | |
|     </fieldset>
 | |
|     <?php else: ?>
 | |
|     <form method="POST" action="" id="loginForm">
 | |
|         <fieldset class="center">
 | |
|             <legend><?php echo $lang['login'] ?></legend>
 | |
|             <table class="center">
 | |
|                 <tr>
 | |
|                     <td><?php echo $lang['username'].": " ?></td>
 | |
|                     <td><input type="text" name="username" placeholder="<?php echo $lang['username']."..." ?>" required></td>
 | |
|                 </tr>
 | |
|                 <tr>
 | |
|                     <td><?php echo $lang['password'].": " ?></td>
 | |
|                     <td><input type="password" name="password" placeholder="<?php echo $lang['password']."..." ?>" required></td>
 | |
|                 </tr>
 | |
|                 <tr>
 | |
|                     <td><?php echo $lang['remember'].": " ?></td>
 | |
|                     <td>
 | |
|                         <div class="checkbox">
 | |
|                             <input id="remember" type="checkbox" name="remember" hidden>
 | |
|                             <label for="remember"></label>
 | |
|                         </div>
 | |
|                     </td>
 | |
|                 </tr>
 | |
|             </table>
 | |
|             <br>
 | |
|             <?php $lm->printCaptcha() ?>
 | |
|             <br>
 | |
|             <br>
 | |
|             <button type="submit" form="loginForm" class="center"><?php echo $lang['ok'] ?></button>
 | |
|         </fieldset>
 | |
|     </form>
 | |
|     <?php endif ?>
 | |
| </div>
 | |
| <?php else: ?>
 | |
| <!-- authenticated -->
 | |
| <div id="usersArea">
 | |
|     <div class="center" id="submenu">
 | |
|         <button type="button" onclick="window.location='/userarea/fileshare'"><?php echo $lang['fileshare'] ?></button>
 | |
|         <?php if($_SESSION['accesslevel']>=1): ?>
 | |
|         <button type="button" onclick="window.location='/userarea/blog'"><?php echo $lang['blog'] ?></button>
 | |
|         <?php endif; if($_SESSION['accesslevel']>=2): ?>
 | |
|         <button type="button" onclick="window.location='/userarea/orders'"><?php echo $lang['orders'] ?></button>
 | |
|         <button type="button" onclick="window.location='/userarea/messages'"><?php echo $lang['messages'] ?></button>
 | |
|         <?php endif; if($_SESSION['accesslevel']>=3): ?>
 | |
|         <button type="button" onclick="window.location='/userarea/news'"><?php echo $lang['news'] ?></button>
 | |
|         <button type="button" onclick="window.location='/userarea/projects'"><?php echo $lang['projects'] ?></button>
 | |
|         <button type="button" onclick="window.location='/userarea/admin'"><?php echo $lang['adminarea'] ?></button>
 | |
|         <?php endif ?>
 | |
|         <button type="button" onclick="window.location='/userarea/profile'"><?php echo $lang['profile'] ?></button>
 | |
|         <button type="button" onclick="window.location='/userarea?logout'"><?php echo $lang['logout'] ?></button>
 | |
|     </div>
 | |
|     <hr class="placeholder">
 | |
|     <div id="subcontent">
 | |
|         <?php
 | |
|         if($sub!=""){
 | |
|             include("./subs/parts/userarea/".$sub.".php");
 | |
|         }
 | |
|         ?>
 | |
|     </div>
 | |
| </div>
 | |
| <?php endif ?>
 |