-
Notifications
You must be signed in to change notification settings - Fork 1
/
update.php
38 lines (36 loc) · 977 Bytes
/
update.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/*
导入配置文件
*/
ini_set('session.save_path', dirname(__FILE__).'/session');
session_start();
$lifeTime = 3600;
setcookie(session_name(), session_id(), time() + $lifeTime, "/");
if(!isset($_SESSION['flag'])){
$_SESSION['flag']=0;
$_SESSION['user']="";
}
function check_session(){
if(isset($_SESSION['flag'])&&$_SESSION['flag']==1&&isset($_SESSION['user'])&&$_SESSION['user']!="")
return true;
else
return false;
}
include("config/config.ini.php");
$smarty->assign("username",$_SESSION['user']);
$smarty->assign("flag",$_SESSION['flag']);
if(!isset($_GET['p'])||!check_session()){
include("control/login.php");
}else{
$p=$_GET['p'];
if(isset($_GET['id'])&&$_GET['id']){
$control = new Control($smarty);
$arr = $control->selectById($_GET['p'],$_GET['id']);
$smarty->assign("arr",$arr);
$smarty->display("view_html/".$p."_update.html");
}else{
$smarty->assign("flag",0);
$smarty->display("view_html/".$p."_update.html");
}
}
?>