d092dd6df90c422195b8ab96c28dc8e49da0e803
[squasher.git] / index.php
1 <?php
2
3 require_once("include/connect.inc.php");
4
5 require_once("squasher.class.php");
6
7 $vars['debug'] = $_GET['debug'];
8 $vars['newtpl'] = $_GET['newtpl'];
9 $tools = $_GET['tools'];
10
11 foreach($_POST AS $key => $value)
12         $submitted[$key]=$value;
13
14 $salt = md5($_SERVER['REMOTE_ADDR']."|".$_SERVER['HTTP_USER_AGENT']);
15
16 if ($tools=="logout"){
17         session_destroy();
18         $_SESSION['creds']['validated'] = false;
19         header( 'Location: '.$_SERVER['PHP_SELF'] ) ;
20 }
21
22 if (!$_SESSION['creds']['validated']){
23         validate_user($_POST['user'], $_POST['pass'], $salt);
24 }
25
26 if ($_SESSION['creds']['validated'] || isset($_GET['f'])) {
27 //if ($_SESSION['creds']['validated']){
28         //load squasher
29         include("squasher.php");
30 } else {
31         //show login
32
33         require_once("smarty/Smarty.class.php");
34
35         $smarty = new Smarty;
36
37         $smarty->assign('salt',$salt);
38         $smarty->assign('debug',$debug);
39         $smarty->display('login.tpl');
40 }
41 // vim: syntax=php ts=4 sw=4 sts=4 sr noet
42 ?>