Esempio n. 1
0
 public function testSession()
 {
     $_SESSION['test'] = true;
     $this->assertTrue(session('test'));
     $this->assertTrue(session_delete('test'));
     $this->assertTrue(session('test', true));
     $this->assertTrue(session('test'));
     session_delete('test');
 }
 function setup()
 {
     //clear session
     session_delete("image_ids");
     //store callback url in viewstate if needed
     $callback = get_http_var('callback');
     if (isset($callback)) {
         if (valid_url($callback)) {
             $callback = urldecode($callback);
             $this->viewstate['callback'] = $callback;
         }
     }
 }
Esempio n. 3
0
 function bind()
 {
     $this->page_title = "Add a leaflet";
     $upload_key = session_read("upload_key");
     if (!isset($upload_key) || $upload_key == '') {
         $upload_key = md5(uniqid(rand(), true));
         session_delete("upload_key");
         session_write("upload_key", $upload_key);
         error_log("bind:upload_key set to:" . $upload_key);
     }
     $this->upload_key = $upload_key;
     $this->image_que_items = $this->get_images_from_que();
     $this->assign('image_que_items', $this->image_que_items);
 }
 public function testForSessionDelete()
 {
     // 1.
     session_delete('name');
     $this->assertNull(session_get('name'));
     // 2.
     session_delete('foo');
     $this->assertNull(session_get('foo'));
     // 3.
     session_delete('animals');
     $this->assertNull(session_get('animals'));
     // 4.
     session_delete('user.fullName');
     session_delete('user.address.street.room');
     session_delete('user.address.zip');
     $this->assertEqual(session_get('user'), array('firstName' => 'Sithu', 'lastName' => 'Kyaw', 'age' => 31, 'phone' => '123456', 'address' => array('street' => array('no' => 1, 'street' => 'Main Street'), 'city' => 'Yangon', 'country' => 'Myanmar')));
     // 5.
     session_delete('user');
     $this->assertNull(session_get('user'));
 }
Esempio n. 5
0
if (auth_is_user_authenticated()) {
    auth_logout();
}
# Check to see if signup is allowed
if (OFF == config_get_global('allow_signup')) {
    print_header_redirect('login_page.php');
    exit;
}
if (ON == config_get('signup_use_captcha') && get_gd_version() > 0 && helper_call_custom_function('auth_can_change_password', array())) {
    # captcha image requires GD library and related option to ON
    $t_key = utf8_strtolower(utf8_substr(md5(config_get('password_confirm_hash_magic_string') . $t_form_key), 1, 5));
    if ($t_key != $f_captcha) {
        trigger_error(ERROR_SIGNUP_NOT_MATCHING_CAPTCHA, ERROR);
    }
    # Clear captcha cache
    session_delete(CAPTCHA_IMG);
}
email_ensure_not_disposable($f_email);
# notify the selected group a new user has signed-up
if (user_signup($f_username, $f_email)) {
    email_notify_new_account($f_username, $f_email);
}
form_security_purge('signup');
html_page_top1();
html_page_top2a();
?>

<br />
<div align="center">
<table class="width50" cellspacing="1">
<tr>
Esempio n. 6
0
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*************************************************************************************************/
defined('_PHP_CONGES') or die('Restricted access');
//
// MAIN
//
/*** initialisation des variables ***/
$session_username = "";
$session_password = "";
/************************************/
//
// recup du num  de session (mais on ne sais pas s'il est passé en GET ou POST
$session = isset($_REQUEST['session']) ? $_REQUEST['session'] : '';
$DEBUG = FALSE;
//$DEBUG=TRUE;
if ($session != "") {
    if (session_is_valid($session)) {
        session_update($session);
    } else {
        session_delete($session);
        $session = "";
        $session_username = "";
        $session_password = "";
        $_SESSION['config'] = init_config_tab();
        // on recrée le tableau de config pour l'url du lien
        redirect(ROOT_PATH . 'index.php?error=session-invalid');
    }
} else {
    //  PAS DE SESSION   ($session == "")
    redirect(ROOT_PATH . 'index.php');
}
Esempio n. 7
0
function verif_droits_user($session, $niveau_droits)
{
    $niveau_droits = strtolower($niveau_droits);
    // verif si $_SESSION['is_admin'] ou $_SESSION['is_resp'] ou $_SESSION['is_hr'] =="N" ou $_SESSION['is_active'] =="N"
    if ($_SESSION[$niveau_droits] == "N") {
        // on recupere les variable utiles pour le suite :
        $url_accueil_conges = $_SESSION['config']['URL_ACCUEIL_CONGES'];
        $lang_divers_acces_page_interdit = _('divers_acces_page_interdit');
        $lang_divers_user_disconnected = _('divers_user_disconnected');
        $lang_divers_veuillez = _('divers_veuillez');
        $lang_divers_vous_authentifier = _('divers_vous_authentifier');
        // on delete la session et on renvoit sur l'authentification (page d'accueil)
        session_delete($session);
        // message d'erreur !
        echo "<center>\n";
        echo "<font color=\"red\">{$lang_divers_acces_page_interdit}</font><br>{$lang_divers_user_disconnected}<br>\n";
        echo "{$lang_divers_veuillez} <a href='{$url_accueil_conges}/index.php' target='_top'> {$lang_divers_vous_authentifier} .</a>\n";
        echo "</center>\n";
        exit;
    }
}
/**
 * @internal
 *
 * Loads the text .po file and returns array of translations
 * @param string $filename Text .po file to load
 * @return mixed Array of translations on success or FALSE on failure
 */
function __i18n_load()
{
    global $lc_lang;
    global $lc_translation;
    global $lc_translationEnabled;
    if ($lc_translationEnabled == false) {
        return false;
    }
    $filename = I18N . $lc_lang . '.po';
    if (!file_exists($filename)) {
        return false;
    }
    # Open the po file
    if (!($file = fopen($filename, 'r'))) {
        session_delete("i18n.{$lc_lang}");
        return false;
    }
    # if the respective po file is already parsed
    if ($translations = session_get("i18n.{$lc_lang}")) {
        return $lc_translation[$lc_lang] = $translations;
    }
    # parse the file
    session_delete("i18n.{$lc_lang}");
    /**
     * Thanks to CakePHP for the po file parsing logic in the do...while loop
     * @package  Cake.I18n
     * @version  1.2.0.4116
     * @license  http://www.opensource.org/licenses/mit-license.php MIT License
     */
    $type = 0;
    $translations = array();
    $translationKey = '';
    $plural = 0;
    $header = '';
    do {
        $line = trim(fgets($file));
        if ($line === '' || $line[0] === '#') {
            continue;
        }
        if (preg_match("/msgid[[:space:]]+\"(.+)\"\$/i", $line, $regs)) {
            $type = 1;
            $translationKey = strtolower(stripcslashes($regs[1]));
        } elseif (preg_match("/msgid[[:space:]]+\"\"\$/i", $line, $regs)) {
            $type = 2;
            $translationKey = '';
        } elseif (preg_match("/^\"(.*)\"\$/i", $line, $regs) && ($type == 1 || $type == 2 || $type == 3)) {
            $type = 3;
            $translationKey .= strtolower(stripcslashes($regs[1]));
        } elseif (preg_match("/msgstr[[:space:]]+\"(.+)\"\$/i", $line, $regs) && ($type == 1 || $type == 3) && $translationKey) {
            $translations[$translationKey] = stripcslashes($regs[1]);
            $type = 4;
        } elseif (preg_match("/msgstr[[:space:]]+\"\"\$/i", $line, $regs) && ($type == 1 || $type == 3) && $translationKey) {
            $type = 4;
            $translations[$translationKey] = '';
        } elseif (preg_match("/^\"(.*)\"\$/i", $line, $regs) && $type == 4 && $translationKey) {
            $translations[$translationKey] .= stripcslashes($regs[1]);
        } elseif (preg_match("/msgid_plural[[:space:]]+\".*\"\$/i", $line, $regs)) {
            $type = 6;
        } elseif (preg_match("/^\"(.*)\"\$/i", $line, $regs) && $type == 6 && $translationKey) {
            $type = 6;
        } elseif (preg_match("/msgstr\\[(\\d+)\\][[:space:]]+\"(.+)\"\$/i", $line, $regs) && ($type == 6 || $type == 7) && $translationKey) {
            $plural = $regs[1];
            $translations[$translationKey][$plural] = stripcslashes($regs[2]);
            $type = 7;
        } elseif (preg_match("/msgstr\\[(\\d+)\\][[:space:]]+\"\"\$/i", $line, $regs) && ($type == 6 || $type == 7) && $translationKey) {
            $plural = $regs[1];
            $translations[$translationKey][$plural] = '';
            $type = 7;
        } elseif (preg_match("/^\"(.*)\"\$/i", $line, $regs) && $type == 7 && $translationKey) {
            $translations[$translationKey][$plural] .= stripcslashes($regs[1]);
        } elseif (preg_match("/msgstr[[:space:]]+\"(.+)\"\$/i", $line, $regs) && $type == 2 && !$translationKey) {
            $header .= stripcslashes($regs[1]);
            $type = 5;
        } elseif (preg_match("/msgstr[[:space:]]+\"\"\$/i", $line, $regs) && !$translationKey) {
            $header = '';
            $type = 5;
        } elseif (preg_match("/^\"(.*)\"\$/i", $line, $regs) && $type == 5) {
            $header .= stripcslashes($regs[1]);
        } else {
            unset($translations[$translationKey]);
            $type = 0;
            $translationKey = '';
            $plural = 0;
        }
    } while (!feof($file));
    fclose($file);
    $merge[''] = $header;
    $lc_translation[$lc_lang] = array_merge($merge, $translations);
    # Store the array of translations in Session
    session_set("i18n.{$lc_lang}", $lc_translation[$lc_lang]);
    return $lc_translation;
}
Esempio n. 9
0
<?php

// ini_set("display_errors", On);
// error_reporting(E_ALL);
require_once $_SERVER['DOCUMENT_ROOT'] . '/function/function.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/function/CFstatus.php';
session_start();
$pdo = pdo_connect();
$mail = $_SESSION['MAIL'];
$sql = "SELECT * FROM User WHERE `mail` = '{$mail}' AND `invalid` = 0 LIMIT 1;";
$user = $pdo->query($sql)->fetch(PDO::FETCH_ASSOC);
if (isset($_SESSION["MAIL"]) && $_SESSION["MAIL"] != null && md5($user['password']) === $_SESSION["PASS"]) {
} else {
    $pdo = null;
    session_delete();
    header("Location: login.php");
    exit;
}
?>
<!doctype html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>提出状況 - C Factory</title>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.5/paper/bootstrap.min.css" rel="stylesheet">
<link href="/css/style.css" rel="stylesheet">
</head>
Esempio n. 10
0
    return $john->listCracked();
}
function unlink_sess($sessid)
{
    $john = new johnSession($sessid);
    return $john->delete();
}
function list_formats()
{
    return johnSession::getFormats();
}
if (!empty($_POST['action']) && $_POST['action'] == 'crack') {
    session_begin($_POST['sess_name'], $_POST['hashes'], $_POST['format'], $_POST['options'], $_POST['mode'], $_POST['dictionnary'], $_POST['rules']);
}
if (!empty($_POST['action']) && $_POST['action'] == 'delete') {
    session_delete($_POST['sessionid']);
}
if (!empty($_POST['json']) && ($_POST['json'] = 1)) {
    if (!empty($_POST['action']) && $_POST['action'] == 'list') {
        print json_encode(list_sessions());
    }
    if (!empty($_POST['action']) && $_POST['action'] == 'resume') {
        $result = FALSE;
        if (!empty($_POST['sessionid'])) {
            $result = session_resume($_POST['sessionid']);
        }
        print json_encode(array('result' => $result));
    }
    if (!empty($_POST['action']) && $_POST['action'] == 'stop') {
        $result = FALSE;
        if (!empty($_POST['sessionid'])) {
 function process()
 {
     if ($this->validate()) {
         //create & save leaflet
         $leaflet = factory::create('leaflet');
         $leaflet->title = $this->data['txtTitle'];
         $leaflet->description = $this->data['txtDescription'];
         $leaflet->publisher_party_id = $this->data['ddlPartyBy'];
         $leaflet->postcode = $this->data['txtPostcode'];
         $leaflet->lng = $this->lng;
         $leaflet->lat = $this->lat;
         $leaflet->name = $this->data['txtName'];
         $leaflet->email = $this->data['txtEmail'];
         //date delivered
         $days = $this->data['ddlDelivered'];
         if ((int) $days > 30) {
             $days = 30;
         }
         $date = mktime(0, 0, 0, date("m"), date("d") - $days, date("Y"));
         $leaflet->date_delivered = mysql_date($date);
         if ($leaflet->insert()) {
             //save images
             $image_ids = session_read("image_ids");
             $sequence = 1;
             foreach ($image_ids as $image_id) {
                 $leaflet_image = factory::create("leaflet_image");
                 $leaflet_image->leaflet_id = $leaflet->leaflet_id;
                 $leaflet_image->image_key = $image_id;
                 $leaflet_image->sequence = $sequence;
                 if (!$leaflet_image->insert()) {
                     trigger_error("Unable to save leaflet image");
                 }
                 $sequence++;
             }
             //TODO: move the code below into the leaflet object
             //save party attack
             foreach ($this->selected_party_attack_ids as $selected_party_attack_id) {
                 $leaflet_party_attack = factory::create("leaflet_party_attack");
                 $leaflet_party_attack->leaflet_id = $leaflet->leaflet_id;
                 $leaflet_party_attack->party_id = $selected_party_attack_id;
                 if (!$leaflet_party_attack->insert()) {
                     trigger_error("Unable to save leaflet party attack");
                 }
             }
             //save categories
             foreach ($this->selected_category_ids as $selected_category_id) {
                 $leaflet_category = factory::create("leaflet_category");
                 $leaflet_category->leaflet_id = $leaflet->leaflet_id;
                 $leaflet_category->category_id = $selected_category_id;
                 if (!$leaflet_category->insert()) {
                     trigger_error("Unable to save leaflet category");
                 }
             }
             //save tags
             $tag_string = trim($this->data['txtTags']);
             $tags = split(",", $tag_string);
             if ($tag_string != '' && isset($tag_string) && count($tags) > 0) {
                 foreach ($tags as $tag) {
                     $new_tag = factory::create('tag');
                     $new_tag->tag = $tag;
                     if (!$new_tag->insert()) {
                         trigger_error("Unable to save new tag");
                     }
                     $leaflet_tag = factory::create('leaflet_tag');
                     $leaflet_tag->leaflet_id = $leaflet->leaflet_id;
                     $leaflet_tag->tag_id = $new_tag->tag_id;
                     if (!$leaflet_tag->insert()) {
                         trigger_error("Unable to save leaflet/tag bridge");
                     }
                 }
             }
         } else {
             trigger_error("Unable to save leaflet");
         }
         //clear session
         session_delete('image_ids');
         //redirect with callback provided
         if ($this->viewstate['callback']) {
             redirect($this->viewstate['callback'] . "?v1=" . WWW_SERVER . "/leaflet.php?q=" . $leaflet->leaflet_id);
         } else {
             redirect("leaflet.php?q=" . $leaflet->leaflet_id . "&m=1");
         }
     } else {
         $this->bind();
         $this->render();
     }
 }
Esempio n. 12
0
 function process()
 {
     if ($this->validate()) {
         //create & save leaflet
         $leaflet = factory::create('leaflet');
         $leaflet->title = trim($this->data['txtTitle']);
         $leaflet->description = $this->data['txtDescription'];
         $leaflet->publisher_party_id = $this->data['ddlPartyBy'];
         $leaflet->postcode = trim($this->data['txtPostcode']);
         $leaflet->lng = $this->lng;
         $leaflet->lat = $this->lat;
         $leaflet->name = trim($this->data['txtName']);
         $leaflet->email = trim($this->data['txtEmail']);
         $leaflet->live = 1;
         //date delivered
         $days = (int) $this->data['ddlDelivered'];
         if ($days > 90) {
             $days = 90;
         }
         $date = mktime(0, 0, 0, date("m"), date("d") - $days, date("Y"));
         $leaflet->date_delivered = mysql_date($date);
         if ($leaflet->insert()) {
             //save images
             $images = $this->get_images_from_que();
             $sequence = 1;
             foreach ($images as $image) {
                 $leaflet_image = factory::create("leaflet_image");
                 $leaflet_image->leaflet_id = $leaflet->leaflet_id;
                 $leaflet_image->image_key = $image->image_key;
                 $leaflet_image->sequence = $sequence;
                 if (!$leaflet_image->insert()) {
                     trigger_error("Unable to save leaflet image");
                 }
                 $sequence++;
             }
             //TODO: move the code below into the leaflet object
             //save party attack
             foreach ($this->selected_party_attack_ids as $selected_party_attack_id) {
                 $leaflet_party_attack = factory::create("leaflet_party_attack");
                 $leaflet_party_attack->leaflet_id = $leaflet->leaflet_id;
                 $leaflet_party_attack->party_id = $selected_party_attack_id;
                 if (!$leaflet_party_attack->insert()) {
                     trigger_error("Unable to save leaflet party attack");
                 }
             }
             //save categories
             foreach ($this->selected_category_ids as $selected_category_id) {
                 $leaflet_category = factory::create("leaflet_category");
                 $leaflet_category->leaflet_id = $leaflet->leaflet_id;
                 $leaflet_category->category_id = $selected_category_id;
                 if (!$leaflet_category->insert()) {
                     trigger_error("Unable to save leaflet category");
                 }
             }
             //save tags
             $tag_string = trim($this->data['txtTags']);
             // match, all, these, and these, "and these"
             $tag_string = preg_replace("/[^a-z0-9, ]/i", '', $tag_string);
             // drop extended chars
             preg_match_all("/[\\w ]+/i", $tag_string, $found_tags);
             // search for tags
             $tags = array_map('trim', $found_tags[0]);
             // trim found tags
             $tags = array_unique($tags);
             // remove dupes
             if ($tag_string != '' && isset($tag_string) && count($tags) > 0) {
                 foreach ($tags as $tag) {
                     $new_tag = factory::create('tag');
                     $new_tag->tag = trim($tag);
                     if (!$new_tag->insert()) {
                         trigger_error("Unable to save new tag");
                     }
                     $leaflet_tag = factory::create('leaflet_tag');
                     $leaflet_tag->leaflet_id = $leaflet->leaflet_id;
                     $leaflet_tag->tag_id = $new_tag->tag_id;
                     if (!$leaflet_tag->insert()) {
                         trigger_error("Unable to save leaflet/tag bridge");
                     }
                 }
             }
             // Now save the constituency
             $leaflet_constituency = factory::create('leaflet_constituency');
             $leaflet_constituency->leaflet_id = $leaflet->leaflet_id;
             $leaflet_constituency->constituency_id = $this->constituency_id;
             if (!$leaflet_constituency->insert()) {
                 trigger_error("Unable to save constituency information");
             }
         } else {
             trigger_error("Unable to save leaflet");
         }
         //clear session
         session_delete('image_ids');
         //clear the image que for this upload
         $this->clear_images_from_que();
         //redirect with callback provided
         if ($this->viewstate['callback']) {
             redirect($this->viewstate['callback'] . "?v1=" . WWW_SERVER . "/leaflets/" . $leaflet->leaflet_id . "/");
         } else {
             redirect("leaflets/" . $leaflet->leaflet_id . "?m=1");
         }
     } else {
         $this->bind();
         $this->render();
     }
 }
Esempio n. 13
0
/**
 * Clear the authenticate user object from session
 */
function auth_clear()
{
    global $_auth;
    session_delete(auth_namespace());
    $_auth = null;
}
Esempio n. 14
0
 public static function destroySession()
 {
     session_delete(static::$session_name);
 }