429eefb301c0c3f8816544c00ede5b4912077ab0
[squasher.git] / index.php
1 <?php
2
3 require_once("include/connect.inc.php");
4
5 require_once("squasher.class.php");
6
7 //login info
8 $vars[user]=$_POST[user];
9 $vars[pass]=$_POST[pass];
10 $vars[debug]=$_GET[debug];
11 $vars[newtpl]=$_GET[newtpl];
12 $tools=$_GET[tools];
13
14 foreach($_POST AS $key => $value) $submitted[$key]=$value;
15
16 $saltplus=md5($_SERVER[REMOTE_ADDR].":".$_SERVER[REMOTE_PORT]."|".$_SERVER[HTTP_USER_AGENT]);
17 $salt=md5($_SERVER[REMOTE_ADDR]."|".$_SERVER[HTTP_USER_AGENT]);
18
19 //(md5(md5('jasper').$salt) == $vars[user]) ? $vun = "Username validated" : $vun = "Username incorrect";
20 //(md5(md5('test'  ).$salt) == $vars[pass]) ? $vpw = "Password validated" : $vpw = "Password incorrect";
21 //echo $vun . ' <br/> ' . $vpw;
22
23 if ($tools=="logout"){
24         session_destroy();
25         $_SESSION[creds][validated]=false;
26         header( 'Location: '.$_SERVER['PHP_SELF'] ) ;
27 }
28
29 if (!$_SESSION[creds][validated]){
30         validate_user($vars,$salt);
31 }
32
33 if ($_SESSION[creds][validated] || isset($_GET['f'])){  
34 //if ($_SESSION[creds][validated]){
35 //load squasher
36         include("squasher.php");
37 }else{
38
39 //show login
40
41 require_once("smarty/Smarty.class.php");
42
43 $smarty = new Smarty;
44
45 $smarty->assign('salt',$salt);
46 $smarty->assign('vun',$vun);
47 $smarty->assign('vpw',$vpw);
48 $smarty->assign('debug',$debug);
49 $smarty->display('login.tpl');
50
51 }
52 ?>