-
Notifications
You must be signed in to change notification settings - Fork 0
/
tempdef_update.php
executable file
·79 lines (65 loc) · 2.71 KB
/
tempdef_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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
require_once("plib/head.php");
$cgi = getCGI();
gsql_esc($cgi);
$p_id = $cgi[p_id];
$t_id = $cgi[t_id];
$f_id = $cgi[f_id];
if($p_id == "" || $t_id == "" || $f_id == "" || $cgi['cname'] == "" || $cgi['type'] == "") sys_exit("参数错误");
conProjDB($p_id, $t_id);
$p_cname = $proj_data[p_cname];
$t_cname = $temp_data[$t_id][cname];
$t_name = $temp_data[$t_id][t_name];
$row_old = $tempdef_data["$f_id"];
if($cgi[f_name] == "") $cgi[f_name] = $row_old[f_name];
if( $cgi[if_into_db] == "d" )
{
if(in_array($cgi[type], array("Char", "Int", "Text", "File", "AutoTypeset_Text", "RichText", "Select", "Rel_Select", "Multi_Page")) )
$cgi[if_into_db] = "y";
else
$cgi[if_into_db] = "n";
}
if($cgi[if_into_db] == "y")
{
$this_type = $cgi[real_type];
if($this_type == "")
{
if($cgi[type] == "Int")
$this_type = "int(12) not null default '0'";
else if( $cgi[type] =="Char")
$this_type = "varchar(255) not null default ''";
else if($cgi[type] == "File")
$this_type = "varchar(255) not null default ''";
else if( $cgi[type] == "Temp_Field")
$this_type = "varchar(255) not null default ''";
else if($cgi[type] == "Select")
$this_type = "varchar(255) not null default ''";
else if($cgi[type] == "Rel_Select")
$this_type = "varchar(255) not null default ''";
else if($cgi[type] =="Text")
$this_type = "blob";
else if($cgi[type] == "AutoTypeset_Text")
$this_type = "mediumblob";
else if($cgi[type] == "RichText")
$this_type = "mediumblob";
else
$this_type = "blob";
}
}
if($row_old[if_into_db] != $cgi[if_into_db] )
{
if( $row_old[if_into_db] == "y")
$sqlstr = "alter table $t_name drop $row_old[f_name]";
else
$sqlstr = "alter table $t_name add $cgi[f_name] $this_type";
$res = mysql_query($sqlstr, $proj_mysql) or sys_exit("系统忙, 请稍候再试。", $sqlstr . ":\n" . mysql_error());
}
else if( $cgi[if_into_db] == "y" )
{
$sqlstr = "alter table $t_name change $row_old[f_name] $cgi[f_name] $this_type";
$res = mysql_query($sqlstr, $proj_mysql) or sys_exit("系统忙, 请稍候再试。", $sqlstr . ":\n" . mysql_error());
}
$sqlstr = "update tempdef set t_id=$t_id, f_name='$cgi[f_name]', cname='$cgi[cname]', type='$cgi[type]', arithmetic='$cgi[arithmetic]', defaultvalue='$cgi[defaultvalue]', validate='$cgi[validate]', showwidth=$cgi[showwidth], showheight=$cgi[showheight], showmargin=$cgi[showmargin], hide='$cgi[hide]', ifnull='$cgi[ifnull]', if_into_db='$cgi[if_into_db]', real_type='$cgi[real_type]' where f_id=$f_id";
$res = mysql_query($sqlstr, $proj_mysql) or sys_exit("系统忙, 请稍候再试。", $sqlstr . ":\n" . mysql_error());
sys_jmp("tempdeflist.php?p_id=$p_id&t_id=$t_id");
?>