10c7e195548a4cac1df08d0d542ccccc9d40d814
[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) $submitted[$key]=$value;
12
13 $salt=md5($_SERVER['REMOTE_ADDR']."|".$_SERVER['HTTP_USER_AGENT']);
14
15 if ($tools=="logout"){
16         session_destroy();
17         $_SESSION['creds']['validated']=false;
18         header( 'Location: '.$_SERVER['PHP_SELF'] ) ;
19 }
20
21 if (!$_SESSION['creds']['validated']){
22         validate_user($_POST['user'], $_POST['pass'], $salt);
23 }
24
25 if ($_SESSION['creds']['validated'] || isset($_GET['f'])){      
26 //if ($_SESSION['creds']['validated']){
27 //load squasher
28         include("squasher.php");
29 }else{
30
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 }
42 ?>