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


PHP SC::setSession方法代码示例

本文整理汇总了PHP中SC::setSession方法的典型用法代码示例。如果您正苦于以下问题:PHP SC::setSession方法的具体用法?PHP SC::setSession怎么用?PHP SC::setSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SC的用法示例。


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

示例1: checkUserData

 public function checkUserData($login, $password)
 {
     $user = $this->db->select('users', 'id, password, group, date, activate', "`login`='{$login}'");
     if ($this->db->getCount() == 1) {
         $user = $user[0];
     } else {
         return 0;
     }
     /*
      * Якщо користувач не активований, то повідомляємо про це
      */
     if ($user['activate'] == 0) {
         return 2;
     }
     if (Hash::checkHash($password, $user['password'])) {
         $randHash = Hash::getRandomHash();
         SC::setCookie('id', $user['id']);
         SC::setSession('id', $user['id']);
         SC::setCookie('login', $login);
         SC::setSession('login', $login);
         SC::setCookie('group', $user['group']);
         SC::setSession('group', $user['group']);
         SC::setCookie('userHash', $randHash);
         SC::setSession('userHash', $randHash);
         $this->db->update('users', array('hash' => $randHash), "`id`='{$user['id']}'");
         $this->getCountBYDay();
         return 1;
     } else {
         return 0;
     }
 }
开发者ID:olehpitsun,项目名称:duplom.comv2.2.1,代码行数:31,代码来源:loginModel.php

示例2: checkRoom

 public function checkRoom($data)
 {
     if ($data['request_type'] == 'classroom') {
         unset($_SESSION['request_type']);
         SC::setSession("request_type", "classroom");
         header('Location: ' . URL . '?c=showTimeTable&f=showOneRoom&p=' . $data['select_classroom'] . '');
     }
 }
开发者ID:olehpitsun,项目名称:duplom.comv2.2.1,代码行数:8,代码来源:showTimeTableModel.php

示例3: getOneElements

 /**
  * get all elements of dir
  * @param $id
  * @return array
  */
 public function getOneElements($id, $table)
 {
     $id = addslashes(strip_tags(trim($id)));
     $id = (int) filter_var(abs($id), FILTER_SANITIZE_NUMBER_INT);
     if ($id == null or $id == 0) {
         header('location: ' . URL);
     }
     $user_id = SC::getSession('id');
     SC::setSession('m_id', $id);
     $e = $this->db->select($table, '*', ' metod_id=' . $id . ' AND user_id = ' . $user_id . ' ORDER BY id DESC');
     return $e;
 }
开发者ID:olehpitsun,项目名称:duplom.comv2.2.1,代码行数:17,代码来源:manageMetodModel.php

示例4: edit_test

 /**
  * @param $data
  * private function for check user input data
  */
 private function edit_test($data)
 {
     $count_questions = $data['count_questions'];
     $data['question_id'];
     for ($i = 0; $i < $count_questions - 1; $i++) {
         $g = $data['question_id' . $i . ''];
         $r = $this->db->select('test', 'test_type, right_answer', "`id`='{$g}'");
         $unique_user = SC::getSession('unique_user');
         if (gettype($data['answer' . $i . '']) != 'array') {
             if ($r[0]['right_answer'] == $data['answer' . $i . '']) {
                 $result = 1;
             } else {
                 $result = 0;
             }
         } else {
             $right = unserialize($r[0]['right_answer']);
             $ans = $data['answer' . $i . ''];
             if ($r[0]['test_type'] == "order") {
                 $count_order = 0;
                 for ($o = 0; $o < count($ans); $o++) {
                     if ($ans[$o] == $right[$o]) {
                         $count_order++;
                     }
                 }
                 $result = $count_order / count($right);
                 $data['ans_' . $i . ''] = $result;
                 unset($_SESSION['ans_' . $i . '']);
                 SC::setSession('ans_' . $i . '', $result);
             } else {
                 $result1 = array();
                 foreach ($ans as $v) {
                     if (in_array($v, $right) && !in_array($v, $result1)) {
                         array_push($result1, $v);
                     }
                 }
                 $right1 = count($result1);
                 $rans_count = count($right);
                 $result = $right1 / $rans_count;
             }
         }
         $data['ans_' . $i . ''] = $result;
         unset($_SESSION['ans_' . $i . '']);
         SC::setSession('ans_' . $i . '', $result);
     }
     $final_ocinka = $this->getResult($count_questions);
     unset($_SESSION['redsultOfTest']);
     SC::setSession('redsultOfTest', $final_ocinka);
     $n_data['result'] = $final_ocinka;
     $n_data['unique_user'] = SC::getSession('unique_user');
     $un = $n_data['unique_user'];
     $n_data['date'] = date('Y-m-d H:i:s');
     $this->db->update('tests_result', $n_data, "`unique_user`='{$un}'");
     header('location: ' . URL . '?c=testing&f=showResult');
 }
开发者ID:olehpitsun,项目名称:duplom.comv2.2.1,代码行数:58,代码来源:testingModel.php

示例5: compareUserData

 /**
  * &#1060;&#1091;&#1085;&#1082;&#1094;&#1110;&#1103; &#1076;&#1083;&#1103; &#1087;&#1086;&#1088;&#1110;&#1074;&#1085;&#1103;&#1085;&#1085;&#1103; &#1076;&#1072;&#1085;&#1080;&#1093; &#1110;&#1079; &#1082;&#1091;&#1082; &#1079; &#1110;&#1085;&#1092;&#1086;&#1088;&#1084;&#1072;&#1094;&#1110;&#1108;&#1102; &#1110;&#1079; &#1041;&#1044;
  * 
  * @param array $cookieArray &#1052;&#1072;&#1089;&#1080;&#1074; &#1082;&#1091;&#1082;
  * @param bool $sc 0 - &#1074;&#1089;&#1090;&#1072;&#1085;&#1086;&#1074;&#1080;&#1090;&#1080; &#1089;&#1077;&#1089;&#1110;&#1102;, &#1072; 1 - &#1082;&#1091;&#1082;&#1080;
  */
 public function compareUserData($cookieArray)
 {
     $db = new DB();
     $id = $cookieArray['id'];
     /*
      * &#1042;&#1080;&#1073;&#1110;&#1088;&#1082;&#1072; &#1076;&#1072;&#1085;&#1080;&#1093; &#1110;&#1079; &#1041;&#1044; &#1087;&#1086; &#1110;&#1076;&#1077;&#1085;&#1090;&#1080;&#1092;&#1110;&#1082;&#1072;&#1090;&#1086;&#1088;&#1091;
      */
     $r = $db->select('users', 'group, hash', "`id`='{$id}'");
     /*
      * &#1055;&#1086;&#1088;&#1110;&#1074;&#1085;&#1103;&#1085;&#1085;&#1103; &#1076;&#1072;&#1085;&#1080;&#1093; &#1110;&#1079; &#1082;&#1091;&#1082;
      * &#1050;&#1086;&#1083;&#1080; &#1076;&#1072;&#1085;&#1110; &#1086;&#1076;&#1085;&#1072;&#1082;&#1086;&#1074;&#1110;, &#1074;&#1110;&#1076;&#1082;&#1088;&#1080;&#1074;&#1072;&#1102; &#1089;&#1077;&#1089;&#1110;&#1102;
      * &#1030;&#1085;&#1072;&#1082;&#1096;&#1077; - &#1085;&#1072; &#1074;&#1093;&#1110;&#1076;
      */
     if ($r[0]['group'] == $cookieArray['group'] && $r[0]['hash'] == $cookieArray['hash']) {
         SC::setSession('id', $cookieArray['id']);
         SC::setSession('group', $cookieArray['group']);
         SC::setSession('userHash', $cookieArray['hash']);
         return 1;
     } else {
         return 0;
     }
 }
开发者ID:olehpitsun,项目名称:duplom.comv2.2.1,代码行数:28,代码来源:Security.php

示例6: getAllSubjects

 public function getAllSubjects($id)
 {
     unset($_SESSION['group_id']);
     SC::setSession('group_id', $id);
     $group_id = SC::getSession('group_id');
     $gr = $this->db->select('rozklad_group', 'name', 'id=' . $group_id . '');
     $users = $gr[0]['name'] . '</br>';
     $u = $this->db->select('rozklad_subjects', '*', 'group_id=' . $group_id . '');
     if ($this->db->getCount() != 0) {
         $users .= '<div class="table-responsive">';
         $users .= '<table class="table table-condensed table-bordered table-hover">';
         $users .= '<thead><tr class="caption">';
         $caption = array('День', 'Час', 'Предмет', 'Викладач', 'Аудиторія', 'Дії');
         $cook = SC::getCookie('id');
         foreach ($caption as $k => $v) {
             $users .= '<th  style="text-align: center; ">' . $v . '</th>';
         }
         $users .= '</tr></thead>';
         for ($i = 0; $i < sizeof($u); $i++) {
             // if ( $u[$i]['id'] != SC::getCookie ( 'id' ) ) {
             $teacher_id = $u[$i]['teacher_id'];
             $w = $this->db->select('teachers', 'surname,name,fathername', 'id=' . $teacher_id . '');
             $users .= '<tr>';
             /*
                                 foreach ( $u[$i] as $k => $v ) {
                                     //if ( $k != 'password' && $k != 'date' && $k != 'activateCode' && $k != 'hash' ) {
                                    
                                    
                                         $users .= '<td>' . $v . '</td>';
                                     
                                     //}
                                 }
             */
             $users .= '<td>' . $u[$i]['day'] . '</td>';
             $users .= '<td>' . $u[$i]['hors'] . '</td>';
             $users .= '<td>' . $u[$i]['name'] . '</td>';
             $users .= '<td>' . $w[0]['surname'] . ' ' . $w[0]['name'] . ' ' . $w[0]['fathername'] . '</td>';
             $users .= '<td>' . $u[$i]['lab'] . '</td>';
             $users .= '<td>';
             $users .= '<a class="users-info-links" href="?c=manageRozklads&f=edit_subject&p=' . $u[$i]['id'] . '">Редагувати</a><br />';
             $users .= '<a class="users-info-links" href="?c=manageRozklads&f=delete_subject&p=' . $u[$i]['id'] . '">Видалити</a>';
             $users .= '</td>';
             $users .= '</tr>';
             //}
         }
         $users .= '</table>';
         $users .= '</div>';
     }
     return $users;
 }
开发者ID:olehpitsun,项目名称:duplom.comv2.2.1,代码行数:50,代码来源:manageRozkladsModel.php

示例7: array

			wrap.load(this.getTrigger().attr("href"));
		//}
	});
});
</script>

<?php 
$g = $this->group;
// назва групи
$g0 = $this->groups;
// масив предметів
require_once './core/TimeTableStudents.php';
$days = array("Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота", "Неділя");
$group_id = $_GET['p'];
unset($_SESSION['gr_id']);
SC::setSession('gr_id', $group_id);
?>

 <ol class="breadcrumb">
    <li><font size="3" color="#d80e0e" ><a href="<?php 
print URL;
?>
">Кабінет</a></font></li>
	<li><font size="3" color="#d80e0e" ><a href="<?php 
print URL;
?>
?c=manageRozklads&f=show">Розклад(курси)</a></font></li>
	<li><font size="3" color="#d80e0e" ><a href="<?php 
print URL;
?>
?c=manageRozklads&f=showSomeGroups&p=<?php 
开发者ID:olehpitsun,项目名称:duplom.comv2.2.1,代码行数:31,代码来源:showGroup.php


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