Skip to content
Snippets Groups Projects
Commit 177ec227 authored by Raghav's avatar Raghav
Browse files

Included classes for session() in Sessiontest.php

parent c0097c38
No related branches found
No related tags found
No related merge requests found
......@@ -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;
// }
// }
<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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment