当前位置: 首页>>代码示例>>PHP>>正文


PHP Validate_Session函数代码示例

本文整理汇总了PHP中Validate_Session函数的典型用法代码示例。如果您正苦于以下问题:PHP Validate_Session函数的具体用法?PHP Validate_Session怎么用?PHP Validate_Session使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Validate_Session函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

<?php

if ($already_initialized != 1) {
    require "./inc/script_inicialization.php";
    require "./inc/nrp_api.php";
}
if (!isset($num_errors)) {
    $num_errors = 0;
}
if (!isset($num_alerts)) {
    $num_alerts = 0;
}
if (Validate_Session($complete_sess_id, $_SERVER['REMOTE_ADDR'], $bd)) {
    Get_Account_Id($sess_id, $account_id, $bd);
    if ($account_id != 'admin') {
        $error[$num_errors++] = "You are not the administrator";
        include "logout.php";
        exit;
    }
} else {
    $error[$num_errors++] = "Invalid Session ID";
    include "logout.php";
    exit;
}
$result_xsl = "xsl/" . $default_xsl . "/adm_accounts.xsl";
$smarty->assign("nrpTransform", $result_xsl);
$smarty->assign("nrpSchErrors", $error);
$smarty->assign("nrpSchAlerts", $alert);
$smarty->assign("nrpMasterSessId", $master_session);
$smarty->assign("nrpSessId", $complete_sess_id);
$smarty->assign("nrpUserId", $account_id);
开发者ID:magsilva,项目名称:NoRiskPlanning,代码行数:31,代码来源:adm_accounts.php

示例2: listAppointments

function listAppointments($complete_sess_id, $beg_date, $end_date, $beg_time, $end_time, $type)
{
    // Validate user session code
    if (!Validate_Session($complete_sess_id, $_SERVER['REMOTE_ADDR'], $GLOBALS['bd'])) {
        return "Invalid session ID!";
    }
    // Get the user account ID
    $sess_id = substr($complete_sess_id, 32);
    Get_Account_Id($sess_id, $account_id, $GLOBALS['bd']);
    // Get information about appointments types available
    $query = "SELECT * FROM accounts WHERE account_id = '{$account_id}'";
    $result = $GLOBALS['bd']->Query($query);
    $role = $GLOBALS['bd']->FetchResult($result, 0, 'role');
    $var_type = $role . '_type';
    // Set app types, times and days of week (see inc/config.inc.php)
    $app_times = $GLOBALS['cfg']['time'];
    $app_types = $GLOBALS['cfg'][$var_type];
    $days_of_week = $GLOBALS['cfg']['days'];
    // Convert $beg_time and $end_time to NoRisk values
    // see (inc/config.inc.php to see how norisk store this values
    // XXX Check if value is between first_time and last_time?
    $aux = split(":", $beg_time);
    $nrp_beg_time = $aux[0] - $GLOBALS['cfg']['first_time'];
    $aux = split(":", $end_time);
    $nrp_end_time = $aux[0] - $GLOBALS['cfg']['first_time'];
    // Get the list of appointments for this user
    // (does not include the weekly ones)
    $apps = List_Appointments($account_id, '', '', '', $beg_date, $end_date, $nrp_beg_time, $nrp_end_time, '', '', $app_times, $app_types, '', '', $days_of_week, $GLOBALS['bd']);
    // If there are no results, return an empty array instead of a null
    if ($apps == null) {
        return array();
    }
    // Make the returning array
    $apps_list = array();
    foreach ($apps as $app) {
        $aux = array('app_id' => $app['0'], 'description' => $app['2'], 'beg_time' => $app['8'], 'end_time' => $app['10'], 'date' => $app['16'], 'type' => $app['12'], 'url' => $app['17'], 'owner' => $app['18']);
        array_push($apps_list, $aux);
    }
    // Return the appotinments list
    return $apps_list;
}
开发者ID:magsilva,项目名称:NoRiskPlanning,代码行数:41,代码来源:services.php


注:本文中的Validate_Session函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。