diff --git a/libs/load.php b/libs/load.php index 27ead7a7ce23b1151357ecdac63923b49e2c5560..cc91e437f493e1cf7ebb30cb77c0cb86e6fc1fd8 100644 --- a/libs/load.php +++ b/libs/load.php @@ -4,6 +4,7 @@ include_once '_includes/Mic.class.php'; include_once '_includes/Database.class.php'; include_once '_includes/User.class.php'; +include_once '_includes/Session.class.php'; function load_template($name) { @@ -12,14 +13,14 @@ function load_template($name) } // Function to validate the credentials. -function validate_credentials($email, $password) -{ +// function validate_credentials($email, $password) +// { - // pass credential to class function - User::getCredential($email, $password); - if ($email == "raghav@gmail.com" and $password == "raghav") { - return true; - } else { - return false; - } -} +// // pass credential to class function +// User::getCredential($email, $password); +// if ($email == "raghav@gmail.com" and $password == "raghav") { +// return true; +// } else { +// return false; +// } +// } diff --git a/sessiontest.php b/sessiontest.php index 8d4a07cf108ca89a28365f418eeb58bf80c4946f..3b4cee4cde3cac271d3effedb5ff6dd32f62d307 100644 --- a/sessiontest.php +++ b/sessiontest.php @@ -1,8 +1,9 @@ <pre> <?php +include 'libs/load.php'; // To use session include this function -session_start(); +Session::start(); print("_SESSION\n"); print_r($_SESSION); @@ -12,14 +13,14 @@ print("Session ID = " . session_id()."\n"); // To Clear the values in session array but not delete. if (isset($_GET['clear'])) { printf("Clearing....\n"); - session_unset(); + Session::unset_all(); print("Session ID[unset] = " . session_id()."\n"); } // To destroy the session if (isset($_GET['destroy'])) { printf("Destroying..\n"); - session_destroy(); + Session::destroy(); print("Session ID[destroyed] = " . session_id()."\n"); } /* @@ -28,10 +29,10 @@ if (isset($_GET['destroy'])) { * print("a = $_SESSION[A]"); */ -if (isset($_SESSION['a'])) { - printf("Exsiting value a = $_SESSION[a]\n"); +if (Session::isset('a')) { + printf("Exsiting value a = ". Session::get('a'). "\n"); } else { - $_SESSION['a'] = time(); - printf("Assigning value to a = $_SESSION[a]\n"); + Session::set('a', time()); + printf("Assigning value to a = ". Session::get('a'). "\n"); }?> </pre> \ No newline at end of file