103 |
- |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/***************************************************************************
|
|
|
4 |
* Copyright (C) 2009-2011 by Geo Varghese(www.seopanel.in) *
|
|
|
5 |
* sendtogeo@gmail.com *
|
|
|
6 |
* *
|
|
|
7 |
* This program is free software; you can redistribute it and/or modify *
|
|
|
8 |
* it under the terms of the GNU General Public License as published by *
|
|
|
9 |
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
10 |
* (at your option) any later version. *
|
|
|
11 |
* *
|
|
|
12 |
* This program is distributed in the hope that it will be useful, *
|
|
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
15 |
* GNU General Public License for more details. *
|
|
|
16 |
* *
|
|
|
17 |
* You should have received a copy of the GNU General Public License *
|
|
|
18 |
* along with this program; if not, write to the *
|
|
|
19 |
* Free Software Foundation, Inc., *
|
|
|
20 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
21 |
***************************************************************************/
|
|
|
22 |
|
|
|
23 |
# class defines all session functions
|
|
|
24 |
class Session extends Seopanel{
|
|
|
25 |
|
|
|
26 |
# starts session
|
|
|
27 |
public static function startSession(){
|
|
|
28 |
ini_set("session.gc_probability", 100);
|
|
|
29 |
ini_set("session.gc_divisor", 100);
|
|
|
30 |
ini_set("session.gc_maxlifetime", SP_TIMEOUT);
|
|
|
31 |
session_start();
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
# to set session
|
|
|
35 |
public static function setSession($varName, $varValue){
|
|
|
36 |
$_SESSION[$varName] = $varValue;
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
# function read session
|
|
|
40 |
public static function readSession($varName) {
|
|
|
41 |
return $_SESSION[$varName];
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
# fucntion to destroy session
|
|
|
45 |
public static function destroySession() {
|
|
|
46 |
@Session::setSession('userInfo', "");
|
|
|
47 |
@Session::setSession('lang_code', "");
|
|
|
48 |
@Session::setSession('text', "");
|
|
|
49 |
session_destroy();
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
public static function setSessionMessages($msg, $error=true) {
|
|
|
53 |
$sessionVar = $error ? "sp_error_msg" : "sp_success_msg";
|
|
|
54 |
$_SESSION[$sessionVar] = $msg;
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
public static function showSessionMessges($exit=false) {
|
|
|
58 |
if (!empty($_SESSION['sp_success_msg'])) {
|
|
|
59 |
showSuccessMsg($_SESSION['sp_success_msg'], $exit);
|
|
|
60 |
$_SESSION['sp_success_msg'] = "";
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
if (!empty($_SESSION['sp_error_msg'])) {
|
|
|
64 |
showErrorMsg($_SESSION['sp_error_msg'], $exit);
|
|
|
65 |
$_SESSION['sp_error_msg'] = "";
|
|
|
66 |
}
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
}
|
|
|
70 |
?>
|