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


PHP addSession函数代码示例

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


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

示例1: launchCheck

 /**
  * Silently check if this is a launch and if so, handle it
  */
 public static function launchCheck()
 {
     if (!LTI::isRequest()) {
         return false;
     }
     $session_id = self::setupSession();
     if ($session_id === false) {
         return false;
     }
     // Redirect back to ourselves...
     $url = curPageURL();
     $query = false;
     if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) {
         $query = true;
         $url .= '?' . $_SERVER['QUERY_STRING'];
     }
     $location = addSession($url);
     session_write_close();
     // To avoid any race conditions...
     if (headers_sent()) {
         echo '<p><a href="' . $url . '">Click to continue</a></p>';
     } else {
         header('Location: ' . $location);
     }
     exit;
 }
开发者ID:na1iu,项目名称:tsugi,代码行数:29,代码来源:LTIX.php

示例2: launchCheck

 /**
  * Silently check if this is a launch and if so, handle it and redirect
  * back to ourselves
  */
 public static function launchCheck($needed = self::ALL)
 {
     $needed = self::patchNeeded($needed);
     if (!LTI::isRequest()) {
         return false;
     }
     $session_id = self::setupSession($needed);
     if ($session_id === false) {
         return false;
     }
     // Redirect back to ourselves...
     $url = self::curPageUrl();
     $location = addSession($url);
     session_write_close();
     // To avoid any race conditions...
     if (headers_sent()) {
         echo '<p><a href="' . $url . '">Click to continue</a></p>';
     } else {
         header('Location: ' . $location);
     }
     exit;
 }
开发者ID:csev,项目名称:tsugi-php,代码行数:26,代码来源:LTIX.php

示例3: session_start

require_once "../pdo.php";
require_once $CFG->dirroot . '/lib/lms_lib.php';
require_once 'tp_messages.php';
use Tsugi\Util\LTI;
use Tsugi\Util\Net;
session_start();
header('Content-Type: text/html; charset=utf-8');
if (!isset($_SESSION['lti2post'])) {
    die_with_error_log("Missing LTI 2.0 post data");
}
error_log("Session in lti2 " . session_id());
if (!isset($_SESSION['id'])) {
    if (isset($_REQUEST['login_done'])) {
        die_with_error_log("LTI 2 login failed.");
    }
    $_SESSION['login_return'] = addSession(getCurrentFileUrl(__FILE__) . "?login_done=true");
    header("Location: " . getLoginUrl());
    return;
}
// See if this person is allowed to register a tool
$row = $PDOX->rowDie("SELECT request_id, user_id, admin, state, lti\n        FROM {$CFG->dbprefix}key_request\n        WHERE user_id = :UID LIMIT 1", array(":UID" => $_SESSION['id']));
if ($row === false) {
    $_SESSION['error'] = 'You have not requested a key for this service.';
    header('Location: ' . $CFG->wwwroot);
    return;
}
if ($row['state'] == 0) {
    $_SESSION['error'] = 'Your key has not yet been approved. ' . $row['admin'];
    header('Location: ' . $CFG->wwwroot);
    return;
}
开发者ID:4sp1r3,项目名称:tsugi,代码行数:31,代码来源:lti2.php

示例4: updateNumbers

</p>
<iframe id="my_iframe" width="98%" height="600px" style="border: 1px black solid">
</iframe>
</div>


<?php 
$OUTPUT->footerStart();
?>
<script type="text/javascript">
$UPDATE_INTERVAL = false;
function updateNumbers() {
    window.console && console.log('Calling updateNumbers');
    $.ajaxSetup({ cache: false }); // For IE...
    $.getJSON('<?php 
echo addSession($CFG->wwwroot . '/mod/peer-grade/maintcount.php');
?>
',
    function(data) {
        if ( $UPDATE_INTERVAL === false ) $UPDATE_INTERVAL = setInterval(updateNumbers,10000);
        window.console && console.log(data);
        $('#totspinner').hide();
        oldtotal = $('#total').text();
        $('#total').text(data.total);
        if ( oldtotal.length > 1 && oldtotal != data.total ) $('#totspinner').show();
    });
}
updateNumbers();
</script>
<?php 
$OUTPUT->footerEnd();
开发者ID:ixtel,项目名称:tsugi,代码行数:31,代码来源:maint.php

示例5: var_dump

    $retval = LTIX::gradeSend($gradetosend, false, $debug_log);
    $_SESSION['debug_log'] = $debug_log;
    if ($retval === true) {
        $_SESSION['success'] = "Grade {$gradetosend} sent to server.";
    } else {
        if (is_string($retval)) {
            $_SESSION['error'] = "Grade not sent: " . $retval;
        } else {
            echo "<pre>\n";
            var_dump($retval);
            echo "</pre>\n";
            die;
        }
    }
    // Redirect to ourself
    header('Location: ' . addSession('index.php'));
    return;
}
// Start of the output
$OUTPUT->header();
$OUTPUT->bodyStart();
$OUTPUT->flashMessages();
echo "<h1>Grade Test Harness</h1>\n";
$OUTPUT->welcomeUserCourse();
?>
<form method="post">
Enter grade:
<input type="number" name="grade" step="0.01" min="0" max="1.0"><br/>
<input type="submit" name="send" value="Send grade">
</form>
<?php 
开发者ID:shaamimahmed,项目名称:tsugi,代码行数:31,代码来源:index.php

示例6: leaders

            $("#success").html(sprintf(I18N.lost,data.displayname));
        }
        $("#rpsform input").attr("disabled", false);
        leaders();  // Immediately update the leaderboard
  });
}

var OLD_TIMEOUT = false;
function leaders() {
    if ( OLD_TIMEOUT ) {
        clearTimeout(OLD_TIMEOUT);
        OLD_TIMEOUT = false;
    }
    window.console && console.log('Updating leaders...');
    $.getJSON('<?php 
echo addSession('stats.php');
?>
', function(data) {
        window.console && console.log(data);
        $("#leaders").html("");
        $("#leaders").append("<ol>\n");
        for (var i = 0; i < data.length; i++) {
            entry = data[i];
            $("#leaders").append("<li>"+entry.name+' ('+entry.games+') score='+entry.score+"</li>\n");
            console.log(data[i]);
        }
        $("#leaders").append("</ol>\n");
        OLD_TIMEOUT = setTimeout('leaders()', 20000);
  });
}
开发者ID:shaamimahmed,项目名称:tsugi,代码行数:30,代码来源:index.php

示例7: doRedirect

 /**
  * Redirect to a local URL, adding session if necessary
  *
  * Note that this is only needed for AJAX and header() calls
  * as &lt;form> and &lt;a href tags are properly handled already
  * by the PHP built-in "don't use cookies for session" support.
  */
 function doRedirect($location)
 {
     if (headers_sent()) {
         echo '<a href="' . htmlentities($location) . '">Continue</a>' . "\n";
     } else {
         if (ini_get('session.use_cookies') == 0) {
             $location = addSession($location);
         }
         header("Location: {$location}");
     }
 }
开发者ID:JANQLIANGTSAI,项目名称:tsugi,代码行数:18,代码来源:Output.php

示例8: json_encode

/*
$qj = json_encode($questions);
echo("<pre>\n");
var_dump($attempt);
var_dump($errors);
echo(htmlent_utf8(jsonIndent($qj)));
echo("</pre>\n");
*/
$OUTPUT->footerStart();
require_once 'templates.php';
?>
<script>
TEMPLATES = [];
$(document).ready(function(){
    $.getJSON('<?php 
echo addSession('quiz.php');
?>
', function(quiz) {
        window.console && console.log(quiz);
        for(var i=0; i<quiz.questions.length; i++) {
            question = quiz.questions[i];
            type = question.type;
            console.log(type);
            if ( TEMPLATES[type] ) {
                template = TEMPLATES[type];
            } else {
                source  = $('#'+type).html();
                if ( source == undefined ) {
                    window.console && console.log("Did not find template for question type="+type);
                    continue;
                }
开发者ID:shaamimahmed,项目名称:tsugi,代码行数:31,代码来源:index.php

示例9: showSubmission

function showSubmission($LTI, $assn_json, $submit_json)
{
    echo '<div style="padding:5px">';
    $blob_ids = $submit_json->blob_ids;
    $urls = isset($submit_json->urls) ? $submit_json->urls : array();
    $blobno = 0;
    $urlno = 0;
    foreach ($assn_json->parts as $part) {
        if ($part->type == "image") {
            // This test triggeres when an assignment is reconfigured
            // and old submissions have too few blobs
            if ($blobno >= count($blob_ids)) {
                continue;
            }
            $blob_id = $blob_ids[$blobno++];
            if (is_array($blob_id)) {
                $blob_id = $blob_id[0];
            }
            $url = getAccessUrlForBlob($blob_id);
            $title = 'Student image';
            if (isset($part->title) && strlen($part->title) > 0) {
                $title = $part->title;
            }
            echo ' <a href="#" onclick="$(\'#myModal_' . $blobno . '\').modal();"';
            echo 'alt="' . htmlent_utf8($title) . '" title="' . htmlent_utf8($title) . '">';
            echo '<img src="' . addSession($url) . '" width="240"></a>' . "\n";
            ?>
<div class="modal fade" id="myModal_<?php 
            echo $blobno;
            ?>
">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title"><?php 
            echo htmlent_utf8($title);
            ?>
</h4>
      </div>
      <div class="modal-body">
        <img src="<?php 
            echo addSession($url);
            ?>
" style="width:100%">
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<?php 
        } else {
            if ($part->type == "url") {
                $url = $urls[$urlno++];
                echo '<p><a href="' . safe_href($url) . '" target="_blank">';
                echo htmlentities(safe_href($url)) . '</a> (Will launch in new window)</p>' . "\n";
            }
        }
    }
    echo "<br/>&nbsp;<br/>\n";
    if ($blobno > 0) {
        echo "<p>Click on each image to see a larger view of the image.</p>\n";
    }
    if (strlen($submit_json->notes) > 1) {
        echo "<p>Notes: " . htmlent_utf8($submit_json->notes) . "</p>\n";
    }
    echo '<div style="padding:3px">';
}
开发者ID:ixtel,项目名称:tsugi,代码行数:67,代码来源:peer_util.php

示例10: addSession

;
        var grade = 1.0 - <?php 
echo $dueDate->penalty;
?>
;
        if ( oldgrade > grade ) grade = oldgrade;  // Never go down
        window.console && console.log("Sending grade="+grade);

        if ( window.CM_EDITOR !== false ) window.CM_EDITOR.save();
        var code = document.getElementById("code").value;
        var toSend = { grade : grade, code : code };

        $.ajax({
            type: "POST",
            url: "<?php 
echo addSession('sendgrade.php');
?>
",
            dataType: "json",
            beforeSend: function (request)
            {
                request.setRequestHeader("X-CSRF-Token", CSRF_TOKEN);
            },
            data: toSend
        }).done( function (data) {
            window.console && console.log("Grade response received...");
            window.console && console.log(data);
            $("#spinner").hide();
            if ( data.status == "success") {
                $("#gradegood").show();
                $('#curgrade').text('1');
开发者ID:ixtel,项目名称:tsugi,代码行数:31,代码来源:index.php

示例11: header

    $_SESSION['error'] = 'Bad value for id';
    header('Location: error.php');
    return;
}
$sql = sprintf("SELECT name,lkey,image,email FROM LTI_Users WHERE id=%s AND key_id=%s", $db->quote($_SESSION['user_id']), $CFG->localkeyid);
$q = $db->query($sql);
$user = $q->fetch();
if (!$course) {
    $_SESSION['error'] = 'Bad value for id';
    header('Location: error.php');
    return;
}
$sql = sprintf("SELECT role_id FROM LTI_Members WHERE user_id=%s AND course_id=%s", $db->quote($_SESSION['user_id']), $db->quote($course['id']));
$q = $db->query($sql);
if ($q) {
    $member = $q->fetch();
}
$_SESSION['_context_consumer_key'] = $CFG->localkey;
$_SESSION['_context_consumer_id'] = $CFG->localkeyid;
$_SESSION['_lti_context'] = array('oauth_consumer_key' => 'local', 'resource_link_id' => 'rlid-1234', 'resource_link_title' => 'This Week', 'resource_link_description' => 'Please complete this', 'user_id' => $user['lkey'], 'roles' => $member['roleid'] == 0 ? 'Instructor' : 'Learner', 'lis_person_name_full' => $user['name'], 'lis_person_contact_email_primary' => $user['email'], 'lis_person_sourcedid' => 'localhost.edu::' . $user['id'], 'context_id' => $course['lkey'], 'context_title' => $course['name'], 'context_label' => $course['lkey'], 'tool_consumer_info_product_family_code' => 'ims', 'tool_consumer_info_version' => '1.1', 'tool_consumer_instance_guid' => 'www.imsglobal.org', 'tool_consumer_instance_description' => 'University of Localhost (LMSng)');
/*
echo("<pre>\n");
print_r($course);
print_r($user);
print_r($member);
print_r($_SESSION);
echo("</pre>\n");
*/
// Do this by hand to switch away from cookie based sessions.
$location = addSession('mod/response/index.php');
doRedirect($location);
开发者ID:jesusvaz,项目名称:ims-dev,代码行数:31,代码来源:launch.php

示例12: foreach

    }
    echo "</table>\n";
    echo "</div>\n";
}
if ($grades_given === false || count($grades_given) < 1) {
    echo "<p>Nothing has been graded {$user_display} yet.</p>";
} else {
    echo "<p>Grades Given{$user_display}:</p>";
    echo '<div style="margin:3px;">';
    echo '<table border="1" class="table table-hover table-condensed table-responsive">';
    echo "\n<tr><th>User</th><th>Email</th><th>Points</th>\n        <th>Comments</th><th>Action</th></tr>\n";
    foreach ($grades_given as $grade) {
        echo "<tr>\n        <td>" . htmlent_utf8($grade['displayname']) . "</td>\n        <td>" . htmlent_utf8($grade['email']) . "</td>\n        <td>" . $grade['points'] . "</td><td>" . htmlent_utf8($grade['note']) . "</td>" . '<td> <form method="post"><input type="hidden"
            name="grade_id" value="' . $grade['grade_id'] . '">
        <input type="hidden" name="user_id" value="' . $user_id . '">
        <input type="submit" name="deleteGrade" value="delete" class="btn btn-danger"></form></td>' . "\n</tr>\n";
    }
    echo "</table>\n";
    echo "</div>\n";
}
?>
<form method="post">
<br/>
<input type="submit" name="doDone" class="btn btn-success"
onclick="location='<?php 
echo addSession('admin.php');
?>
'; return false;" value="Done">
</form>
<?php 
$OUTPUT->footer();
开发者ID:ixtel,项目名称:tsugi,代码行数:31,代码来源:student.php

示例13: json_encode

         $post_data = json_encode(array('error' => $post_data), JSON_FORCE_OBJECT);
         echo $post_data;
     }
     break;
 case 'add_attendance':
     if (isset($_GET['session_id']) && $_GET['session_id'] != "" && isset($_GET['status_set']) && $_GET['status_set'] != "" && isset($_GET['taken_by']) && $_GET['taken_by'] != "" && isset($_GET['data']) && $_GET['data'] != "" && isset($_GET['time']) && $_GET['time'] != "") {
         addAttendance($conn, $_GET['session_id'], $_GET['status_set'], $_GET['taken_by'], $_GET['time'], $_GET['data']);
     } else {
         $post_data = array('message' => 'missing parameters', 'comment' => 'require param [session_id,status_set,taken_by,time,data]');
         $post_data = json_encode(array('error' => $post_data), JSON_FORCE_OBJECT);
         echo $post_data;
     }
     break;
 case 'add_session':
     if (isset($_GET['attendance_id']) && $_GET['attendance_id'] != "" && isset($_GET['session_date']) && $_GET['session_date'] != "" && isset($_GET['duration']) && $_GET['duration'] != "" && isset($_GET['time_modified']) && $_GET['time_modified'] != "" && isset($_GET['description']) && $_GET['description'] != "") {
         addSession($conn, $_GET['attendance_id'], $_GET['session_date'], $_GET['duration'], $_GET['time_modified'], $_GET['description']);
     } else {
         $post_data = array('message' => 'missing parameters', 'comment' => 'require param [attendance_id,session_date,duration,time_modified,description]');
         $post_data = json_encode(array('error' => $post_data), JSON_FORCE_OBJECT);
         echo $post_data;
     }
     break;
 case 'update_attendance':
     if (isset($_GET['session_id']) && $_GET['session_id'] != "" && isset($_GET['taken_by']) && $_GET['taken_by'] != "" && isset($_GET['time']) && $_GET['time'] != "" && isset($_GET['data']) && $_GET['data'] != "") {
         updateAttendance($conn, $_GET['session_id'], $_GET['taken_by'], $_GET['time'], $_GET['data']);
     } else {
         $post_data = array('message' => 'missing parameters', 'comment' => 'require param [session_id,taken_by,time,data]');
         $post_data = json_encode(array('error' => $post_data), JSON_FORCE_OBJECT);
         echo $post_data;
     }
     break;
开发者ID:fjaragon,项目名称:demo,代码行数:31,代码来源:webservice.php

示例14: addSession

<link href="calendarmap.css" rel="stylesheet" /> 

<script type="text/javascript" src="bootstrap.min.js"></script> 
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>

</head>
<body>

  <div class="calendar-map" id="calendar_div"></div>

  <script>
  var attend_url = '<?php 
echo addSession("checking.php");
?>
';
  var global_db_calendar_url = '<?php 
echo addSession("db_calendar.php");
?>
';
  </script>

  <script type="text/javascript" src="calendarmap.js?x=<?php 
echo time();
?>
"></script>
  <!--End of Calendar HeatMap-->

  <?php 
// Finish the body (including loading JavaScript for JQUery and Bootstrap)
// And put out the common footer material
$OUTPUT->footer();
开发者ID:jasondou,项目名称:clicker,代码行数:31,代码来源:attendance.php

示例15: session_start

require_once $CFG->dirroot . '/lib/lms_lib.php';
require_once 'tp_messages.php';
use Tsugi\Util\LTI;
use Tsugi\Util\Net;
session_start();
header('Content-Type: text/html; charset=utf-8');
if (!isset($_SESSION['lti2post'])) {
    die_with_error_log("Missing LTI 2.0 post data");
}
error_log("Session in lti2 " . session_id());
if (!isset($_SESSION['id'])) {
    if (isset($_REQUEST['login_done'])) {
        die_with_error_log("LTI 2 login failed.");
    }
    error_log('Redirecting user to login.');
    $_SESSION['login_return'] = addSession($CFG->wwwroot . "/lti/lti2.php?login_done=true");
    header("Location: " . getLoginUrl());
    return;
}
// See if this person is allowed to register a tool
$row = $PDOX->rowDie("SELECT request_id, user_id, admin, state, lti\n        FROM {$CFG->dbprefix}key_request\n        WHERE user_id = :UID LIMIT 1", array(":UID" => $_SESSION['id']));
if ($row === false) {
    $_SESSION['error'] = 'You have not requested a key for this service.';
    header('Location: ' . $CFG->wwwroot);
    return;
}
if ($row['state'] == 0) {
    $_SESSION['error'] = 'Your key has not yet been approved. ' . $row['admin'];
    header('Location: ' . $CFG->wwwroot);
    return;
}
开发者ID:shaamimahmed,项目名称:tsugi,代码行数:31,代码来源:lti2.php


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