refresh-post protection
[banana.git] / install.d / session.inc.php
1 <?php
2 /********************************************************************************
3 * include/session.inc.php : sessions for profile
4 * -------------------------
5 *
6 * This file is part of the banana distribution
7 * Copyright: See COPYING files that comes with this distribution
8 ********************************************************************************/
9
10 session_start();
11
12 //sets sessions variables
13 if (!isset($_SESSION['profile']) && (!isset($_POST['action']) ||
14 (isset($_POST['action']) && ($_POST['action']!="OK")))) {
15 require("include/profile.inc.php");
16 $profile=getprofile();
17 require("header.inc.php");
18 require("profile_form.inc.php");
19 require("footer.inc.php");
20 exit;
21 } elseif (!isset($_SESSION['profile'])) {
22 $_SESSION['name'] = $_POST['profile_name'];
23 $_SESSION['mail'] = $_POST['profile_mail'];
24 $_SESSION['org'] = $_POST['profile_org'];
25 $_SESSION['sig'] = $_POST['profile_sig'];
26 $_SESSION['login'] = $_POST['profile_login'];
27 $_SESSION['passwd'] = $_POST['profile_passwd'];
28 $_SESSION['displaytype'] = $_POST['displaytype'];
29 $_SESSION['profile'] = true;
30 }
31
32 // refresh-post protection
33 $sname = $_SERVER['SCRIPT_NAME'];
34 $array = explode('/',$sname);
35 $sname = array_pop($array);
36 unset($array);
37 switch ($sname) {
38 case "thread.php":
39 if (!isset($_SESSION['bananapostok']))
40 $_SESSION['bananapostok']=true;
41 break;
42 default:
43 $_SESSION['bananapostok']=true;
44 break;
45 }
46 ?>