memberfun.php
21.8 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
<?php
//********************************** 會員字段 **********************************
//返回字段值
function ReturnMFvalue($value)
{
$value=str_replace("\r\n","|",$value);
return $value;
}
//取得會員表單元素html代碼
function GetMemberFform($type,$f,$fvalue,$fformsize=''){
if($type=="select"||$type=="radio"||$type=="checkbox")
{
return GetMFformSelect($type,$f,$fvalue,$fformsize);
}
$file="../data/html/memberfhtml.txt";
$data=ReadFiletext($file);
$exp="[!--".$type."--]";
$r=explode($exp,$data);
$string=str_replace("[!--enews.var--]",$f,$r[1]);
$string=str_replace("[!--enews.def.val--]",$fvalue,$string);
$string=RepMFformSize($f,$string,$type,$fformsize);
return fAddAddsData($string);
}
//取得select/radio元素代碼
function GetMFformSelect($type,$f,$fvalue,$fformsize=''){
$vr=explode("|",$fvalue);
$count=count($vr);
$change="";
$def=':default';
for($i=0;$i<$count;$i++)
{
$val=$vr[$i];
$isdef="";
if(strstr($val,$def))
{
$dr=explode($def,$val);
$val=$dr[0];
$isdef="||\$ecmsfirstpost==1";
}
if($type=='select')
{
$change.="<option value=\"".$val."\"<?=\$r[".$f."]==\"".$val."\"".$isdef."?' selected':''?>>".$val."</option>";
}
elseif($type=='checkbox')
{
$change.="<input name=\"".$f."[]\" type=\"checkbox\" value=\"".$val."\"<?=strstr(\$r[".$f."],\"|".$val."|\")".$isdef."?' checked':''?>>".$val;
}
else
{
$change.="<input name=\"".$f."\" type=\"radio\" value=\"".$val."\"<?=\$r[".$f."]==\"".$val."\"".$isdef."?' checked':''?>>".$val;
}
}
if($type=="select")
{
if($fformsize)
{
$addsize=' style="width:'.$fformsize.'"';
}
$change="<select name=\"".$f."\" id=\"".$f."\"".$addsize.">".$change."</select>";
}
return $change;
}
//替換表單元素長度
function RepMFformSize($f,$string,$type,$fformsize=''){
$fformsize=ReturnDefMFformSize($f,$type,$fformsize);
if($type=='textarea')
{
$r=explode(',',$fformsize);
$string=str_replace('[!--fsize.w--]',$r[0],$string);
$string=str_replace('[!--fsize.h--]',$r[1],$string);
}
else
{
$string=str_replace('[!--fsize.w--]',$fformsize,$string);
}
return $string;
}
//返回默認長度
function ReturnDefMFformSize($f,$type,$fformsize){
if(empty($fformsize))
{
if($type=='textarea')
{
$fformsize='60,10';
}
elseif($type=='img')
{
$fformsize='45';
}
elseif($type=='file')
{
$fformsize='45';
}
elseif($type=='flash')
{
$fformsize='45';
}
elseif($type=='date')
{
$fformsize='12';
}
elseif($type=='color')
{
$fformsize='10';
}
elseif($type=='linkfield')
{
$fformsize='45';
}
elseif($type=='downpath')
{
$fformsize='45';
}
elseif($type=='onlinepath')
{
$fformsize='45';
}
}
return $fformsize;
}
//增加會員字段
function AddMemberF($add,$userid,$username){
global $empire,$dbtbpre;
//驗證權限
CheckLevel($userid,$username,$classid,"memberf");
$add[f]=RepPostVar($add[f]);
if(empty($add[f])||empty($add[fname]))
{
printerror("EmptyF","");
}
//字段是否重複
$s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsmemberadd");
$b=0;
while($r=$empire->fetch($s))
{
if($r[Field]==$add[f])
{
$b=1;
break;
}
}
if($b)
{
printerror("ReF","");
}
$s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsmember");
$b=0;
while($r=$empire->fetch($s))
{
if($r[Field]==$add[f])
{
$b=1;
break;
}
}
if($b)
{
printerror("ReF","");
}
$add[fvalue]=ReturnMFvalue($add[fvalue]);//初始化值
//字段類型
if($add[ftype]=="TINYINT"||$add[ftype]=="SMALLINT"||$add[ftype]=="INT"||$add[ftype]=="BIGINT"||$add[ftype]=="FLOAT"||$add[ftype]=="DOUBLE")
{
$def=" default '0'";
}
elseif($add[ftype]=="VARCHAR")
{
$def=" default ''";
}
else
{
$def="";
}
$type=$add[ftype];
//VARCHAR
if($add[ftype]=='VARCHAR'&&empty($add[flen]))
{
$add[flen]='255';
}
//字段長度
if($add[flen]){
if($add[ftype]!="TEXT"&&$add[ftype]!="MEDIUMTEXT"&&$add[ftype]!="LONGTEXT"){
$type.="(".$add[flen].")";
}
}
$field="`".$add[f]."` ".$type." NOT NULL".$def;
//新增字段
$asql=$empire->query("alter table {$dbtbpre}enewsmemberadd add ".$field);
//替換代碼
$fhtml=GetMemberFform($add[fform],$add[f],$add[fvalue],$add[fformsize]);
if($add[fform]=='select'||$add[fform]=='radio'||$add[fform]=='checkbox')
{
$fhtml=str_replace("\$r[","\$addr[",$fhtml);
}
//處理變量
$add[myorder]=(int)$add[myorder];
$sql=$empire->query("insert into {$dbtbpre}enewsmemberf(f,fname,fform,fhtml,fzs,myorder,ftype,flen,fvalue,fformsize) values('$add[f]','$add[fname]','$add[fform]','".eaddslashes2($fhtml)."','".eaddslashes($add[fzs])."',$add[myorder],'$add[ftype]','$add[flen]','".eaddslashes2($add[fvalue])."','$add[fformsize]');");
$lastid=$empire->lastid();
if($asql&&$sql)
{
//操作日誌
insert_dolog("fid=".$lastid."<br>f=".$add[f]);
printerror("AddFSuccess","member/AddMemberF.php?enews=AddMemberF".hReturnEcmsHashStrHref2(0));
}
else
{
printerror("DbError","history.go(-1)");
}
}
//修改會員字段
function EditMemberF($add,$userid,$username){
global $empire,$dbtbpre;
//驗證權限
CheckLevel($userid,$username,$classid,"memberf");
$fid=(int)$add['fid'];
$add[f]=RepPostVar($add[f]);
$add[oldf]=RepPostVar($add[oldf]);
if(empty($add[f])||empty($add[fname])||!$fid){
printerror("EmptyF","history.go(-1)");
}
if($add[f]<>$add[oldf]){
//字段是否重複
$s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsmemberadd");
$b=0;
while($r=$empire->fetch($s)){
if($r[Field]==$add[f]){
$b=1;
break;
}
}
if($b){
printerror("ReF","history.go(-1)");
}
$s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsmember");
$b=0;
while($r=$empire->fetch($s))
{
if($r[Field]==$add[f])
{
$b=1;
break;
}
}
if($b)
{
printerror("ReF","");
}
}
$add[fvalue]=ReturnMFvalue($add[fvalue]);//初始化值
//字段類型
if($add[ftype]=="TINYINT"||$add[ftype]=="SMALLINT"||$add[ftype]=="INT"||$add[ftype]=="BIGINT"||$add[ftype]=="FLOAT"||$add[ftype]=="DOUBLE")
{
$def=" default '0'";
}
elseif($add[ftype]=="VARCHAR")
{
$def=" default ''";
}
else
{
$def="";
}
$type=$add[ftype];
//VARCHAR
if($add[ftype]=='VARCHAR'&&empty($add[flen]))
{
$add[flen]='255';
}
//字段長度
if($add[flen]){
if($add[ftype]!="TEXT"&&$add[ftype]!="MEDIUMTEXT"&&$add[ftype]!="LONGTEXT"){
$type.="(".$add[flen].")";
}
}
$field="`".$add[f]."` ".$type." NOT NULL".$def;
$usql=$empire->query("alter table {$dbtbpre}enewsmemberadd change `".$add[oldf]."` ".$field);
//替換代碼
if($add[f]<>$add[oldf]||$add[fform]<>$add[oldfform]||$add[fvalue]<>$add[oldfvalue]||$add[fformsize]<>$add[oldfformsize]){
$fhtml=GetMemberFform($add[fform],$add[f],$add[fvalue],$add[fformsize]);
if($add[fform]=='select'||$add[fform]=='radio'||$add[fform]=='checkbox')
{
$fhtml=str_replace("\$r[","\$addr[",$fhtml);
}
}
else{
$fhtml=$add[fhtml];
}
//處理變量
$add[myorder]=(int)$add[myorder];
$sql=$empire->query("update {$dbtbpre}enewsmemberf set f='$add[f]',fname='$add[fname]',fform='$add[fform]',fhtml='".eaddslashes2($fhtml)."',fzs='".eaddslashes($add[fzs])."',myorder=$add[myorder],ftype='$add[ftype]',flen='$add[flen]',fvalue='".eaddslashes2($add[fvalue])."',fformsize='$add[fformsize]' where fid=$fid");
//更新表單
$record="<!--record-->";
$field="<!--field--->";
$like=$field.$add[oldf].$record;
$newlike=$field.$add[f].$record;
$slike=",".$add[oldf].",";
$newslike=",".$add[f].",";
$csql=$empire->query("select fid,ftemp,enter,mustenter,filef,imgf,tobrf,viewenter,searchvar,canaddf,caneditf,checkboxf from {$dbtbpre}enewsmemberform where enter like '%$like%'");
while($cr=$empire->fetch($csql))
{
$setf="";
$newftemp=str_replace('[!--'.$add[oldf].'--]','[!--'.$add[f].'--]',stripSlashes($cr['ftemp']));
$setf.=",ftemp='".addslashes($newftemp)."'";
if(strstr($cr['mustenter'],$slike)){
$setf.=",mustenter=REPLACE(mustenter,'$slike','$newslike')";
}
if(strstr($cr['filef'],$slike)){
$setf.=",filef=REPLACE(filef,'$slike','$newslike')";
}
if(strstr($cr['imgf'],$slike)){
$setf.=",imgf=REPLACE(imgf,'$slike','$newslike')";
}
if(strstr($cr['tobrf'],$slike)){
$setf.=",tobrf=REPLACE(tobrf,'$slike','$newslike')";
}
if(strstr($cr[viewenter],$like)){
$setf.=",viewenter=REPLACE(viewenter,'$like','$newlike')";
}
if(strstr($cr['searchvar'],$slike)){
$setf.=",searchvar=REPLACE(searchvar,'$slike','$newslike')";
}
if(strstr($cr['canaddf'],$slike)){
$setf.=",canaddf=REPLACE(canaddf,'$slike','$newslike')";
}
if(strstr($cr['caneditf'],$slike)){
$setf.=",caneditf=REPLACE(caneditf,'$slike','$newslike')";
}
if(strstr($cr['checkboxf'],$slike))
{
$setf.=",checkboxf=REPLACE(checkboxf,'$slike','$newslike')";
}
$cusql=$empire->query("update {$dbtbpre}enewsmemberform set enter=REPLACE(enter,'$like','$newlike')".$setf." where fid='$cr[fid]'");
//生成表單頁面
ChangeMemberForm($cr[fid],$newftemp);
}
if($usql&&$sql)
{
insert_dolog("fid=".$fid."<br>f=".$add[f]);//操作日誌
printerror("EditFSuccess","member/ListMemberF.php".hReturnEcmsHashStrHref2(1));
}
else
{printerror("DbError","history.go(-1)");}
}
//刪除會員字段
function DelMemberF($add,$userid,$username){
global $empire,$dbtbpre;
//驗證權限
CheckLevel($userid,$username,$classid,"memberf");
$fid=(int)$add['fid'];
if(empty($fid)){
printerror("EmptyFid","history.go(-1)");
}
$r=$empire->fetch1("select f from {$dbtbpre}enewsmemberf where fid=$fid");
if(!$r[f]){
printerror("EmptyFid","history.go(-1)");
}
$usql=$empire->query("alter table {$dbtbpre}enewsmemberadd drop COLUMN `".$r[f]."`");
$sql=$empire->query("delete from {$dbtbpre}enewsmemberf where fid=$fid");
//更新表單表
$record="<!--record-->";
$field="<!--field--->";
$like=$field.$r[f].$record;
$slike=",".$r[f].",";
$csql=$empire->query("select fid,ftemp,enter,mustenter,filef,imgf,tobrf,viewenter,searchvar,canaddf,caneditf,checkboxf from {$dbtbpre}enewsmemberform where enter like '%$like%'");
while($cr=$empire->fetch($csql))
{
$setf="";
if(strstr($cr['mustenter'],$slike))
{
$setf.=",mustenter=REPLACE(mustenter,'$slike',',')";
}
if(strstr($cr['filef'],$slike))
{
$setf.=",filef=REPLACE(filef,'$slike',',')";
}
if(strstr($cr['imgf'],$slike))
{
$setf.=",imgf=REPLACE(imgf,'$slike',',')";
}
if(strstr($cr['tobrf'],$slike))
{
$setf.=",tobrf=REPLACE(tobrf,'$slike',',')";
}
//錄入項
$enter="";
$re1=explode($record,$cr[enter]);
for($i=0;$i<count($re1)-1;$i++)
{
if(strstr($re1[$i].$record,$like))
{continue;}
$enter.=$re1[$i].$record;
}
//前台顯示
if(strstr($cr[viewenter],$like)){
$viewenter='';
$re2=explode($record,$cr[viewenter]);
for($i=0;$i<count($re2)-1;$i++){
if(strstr($re2[$i].$record,$like)){
continue;
}
$viewenter.=$re2[$i].$record;
}
$setf.=",viewenter='".$viewenter."'";
}
//搜索項
if(strstr($cr['searchvar'],$slike))
{
$setf.=",searchvar=REPLACE(searchvar,'$slike',',')";
}
//增加項
if(strstr($cr['canaddf'],$slike))
{
$setf.=",canaddf=REPLACE(canaddf,'$slike',',')";
}
//修改項
if(strstr($cr['caneditf'],$slike))
{
$setf.=",caneditf=REPLACE(caneditf,'$slike',',')";
}
//復選框
if(strstr($cr['checkboxf'],$slike))
{
$setf.=",checkboxf=REPLACE(checkboxf,'$slike',',')";
}
$cusql=$empire->query("update {$dbtbpre}enewsmemberform set enter='$enter'".$setf." where fid='$cr[fid]'");
}
if($usql&&$sql)
{
insert_dolog("fid=".$fid."<br>f=".$r[f]);//操作日誌
printerror("DelFSuccess","member/ListMemberF.php".hReturnEcmsHashStrHref2(1));
}
else
{printerror("DbError","history.go(-1)");}
}
//修改會員字段順序
function EditMemberFOrder($fid,$myorder,$userid,$username){
global $empire,$dbtbpre;
//驗證權限
CheckLevel($userid,$username,$classid,"memberf");
for($i=0;$i<count($myorder);$i++)
{
$fid[$i]=(int)$fid[$i];
$newmyorder=(int)$myorder[$i];
$usql=$empire->query("update {$dbtbpre}enewsmemberf set myorder=$newmyorder where fid='$fid[$i]'");
}
printerror("EditFOrderSuccess","member/ListMemberF.php".hReturnEcmsHashStrHref2(1));
}
//********************************** 會員表單 **********************************
//返回自動生成會員表單模板
function ReturnMemberFtemp($cname,$center){
$temp="<tr><td width='16%' height=25 bgcolor='ffffff'>enews.name</td><td bgcolor='ffffff'>[!--enews.var--]</td></tr>";
for($i=0;$i<count($center);$i++){
$v=$center[$i];
$data.=str_replace("enews.var",$v,str_replace("enews.name",$cname[$v],$temp));
}
return "<table width='100%' align='center' cellpadding=3 cellspacing=1 bgcolor='#DBEAF5'>".$data."</table>";
}
//更新會員表單文件
function ChangeMemberForm($fid,$mtemp){
global $empire,$dbtbpre;
$file="../data/html/memberform".$fid.".php";
$sql=$empire->query("select f,fhtml from {$dbtbpre}enewsmemberf");
while($r=$empire->fetch($sql)){
$mtemp=str_replace("[!--".$r[f]."--]",$r[fhtml],$mtemp);
}
$mtemp="<?php
if(!defined('InEmpireCMS'))
{exit();}
?>".$mtemp;
WriteFiletext($file,$mtemp);
}
//組合投稿項
function TogMemberqenter($cname,$cqenter){
$record="<!--record-->";
$field="<!--field--->";
$c="";
for($i=0;$i<count($cqenter);$i++)
{
$v=$cqenter[$i];
$name=str_replace($field,"",$cname[$v]);
$name=str_replace($record,"",$name);
$c.=$name.$field.$v.$record;
}
return $c;
}
//組合必填項
function TogMemberMustf($cname,$menter){
$c="";
for($i=0;$i<count($menter);$i++)
{
$v=$menter[$i];
$c.=$v.",";
}
if($c)
{
$c=",".$c;
}
return $c;
}
//增加會員表單
function AddMemberForm($add,$userid,$username){
global $empire,$dbtbpre;
if(empty($add[fname]))
{
printerror("EmptyMemberForm","");
}
//驗證權限
CheckLevel($userid,$username,$classid,"memberf");
$enter=TogMemberqenter($add['cname'],$add['center']);//錄入項
$viewenter=TogMemberqenter($add['cname'],$add['venter']);//顯示項
$mustenter=TogMemberMustf($add['cname'],$add['menter']);//必填項
$canaddf=TogMemberMustf($add['cname'],$add['canadd']);//增加項
$caneditf=TogMemberMustf($add['cname'],$add['canedit']);//修改項
$searchvar=TogMemberMustf($add['cname'],$add['schange']);//搜索項
$filef=ReturnMFileF($enter,$dbtbpre."enewsmemberf",0,"file");
$imgf=ReturnMFileF($enter,$dbtbpre."enewsmemberf",0,"img");
$tobrf=ReturnMFileF($enter,$dbtbpre."enewsmemberf",0,"textarea");
$checkboxf=ReturnMFileF($enter,$dbtbpre."enewsmemberf",0,"checkbox");
//自動生成表單
if($add[ftype])
{
$add[ftemp]=ReturnMemberFtemp($add['cname'],$add['center']);
}
$sql=$empire->query("insert into {$dbtbpre}enewsmemberform(fname,ftemp,fzs,enter,mustenter,filef,imgf,tobrf,viewenter,searchvar,canaddf,caneditf,checkboxf) values('$add[fname]','".eaddslashes2($add[ftemp])."','".addslashes($add[fzs])."','$enter','$mustenter','$filef','$imgf','$tobrf','$viewenter','$searchvar','$canaddf','$caneditf','$checkboxf');");
$fid=$empire->lastid();
//生成表單頁面
ChangeMemberForm($fid,$add[ftemp]);
if($sql)
{
insert_dolog("fid=".$fid."<br>fname=".$add[fname]);//操作日誌
printerror("AddMemberFormSuccess","member/AddMemberForm.php?enews=AddMemberForm".hReturnEcmsHashStrHref2(0));
}
else
{printerror("DbError","history.go(-1)");}
}
//修改會員表單
function EditMemberForm($add,$userid,$username){
global $empire,$dbtbpre;
$fid=(int)$add['fid'];
if(empty($add[fname])||!$fid)
{
printerror("EmptyMemberForm","history.go(-1)");
}
//驗證權限
CheckLevel($userid,$username,$classid,"memberf");
$enter=TogMemberqenter($add['cname'],$add['center']);//錄入項
$viewenter=TogMemberqenter($add['cname'],$add['venter']);//顯示項
$mustenter=TogMemberMustf($add['cname'],$add['menter']);//必填項
$canaddf=TogMemberMustf($add['cname'],$add['canadd']);//增加項
$caneditf=TogMemberMustf($add['cname'],$add['canedit']);//修改項
$searchvar=TogMemberMustf($add['cname'],$add['schange']);//搜索項
$filef=ReturnMFileF($enter,$dbtbpre."enewsmemberf",0,"file");
$imgf=ReturnMFileF($enter,$dbtbpre."enewsmemberf",0,"img");
$tobrf=ReturnMFileF($enter,$dbtbpre."enewsmemberf",0,"textarea");
$checkboxf=ReturnMFileF($enter,$dbtbpre."enewsmemberf",0,"checkbox");
//自動生成表單
if($add[ftype])
{
$add[ftemp]=ReturnMemberFtemp($add['cname'],$add['center']);
}
$sql=$empire->query("update {$dbtbpre}enewsmemberform set fname='$add[fname]',ftemp='".eaddslashes2($add[ftemp])."',fzs='".addslashes($add[fzs])."',enter='$enter',mustenter='$mustenter',filef='$filef',imgf='$imgf',tobrf='$tobrf',viewenter='$viewenter',searchvar='$searchvar',canaddf='$canaddf',caneditf='$caneditf',checkboxf='$checkboxf' where fid=$fid");
//生成表單頁面
ChangeMemberForm($fid,$add[ftemp]);
if($sql)
{
insert_dolog("fid=".$fid."<br>fname=".$add[fname]);//操作日誌
printerror("EditMemberFormSuccess","member/ListMemberForm.php".hReturnEcmsHashStrHref2(1));
}
else
{printerror("DbError","history.go(-1)");}
}
//刪除會員表單
function DelMemberForm($add,$userid,$username){
global $empire,$dbtbpre;
$fid=(int)$add['fid'];
if(!$fid)
{
printerror("EmptyMemberFormId","history.go(-1)");
}
//驗證權限
CheckLevel($userid,$username,$classid,"memberf");
$r=$empire->fetch1("select fid,fname from {$dbtbpre}enewsmemberform where fid=$fid;");
if(!$r['fid'])
{
printerror("EmptyMemberFormId","history.go(-1)");
}
$sql=$empire->query("delete from {$dbtbpre}enewsmemberform where fid=$fid;");
//刪除表單文件
$file="../data/html/memberform".$fid.".php";
DelFiletext($file);
if($sql)
{
insert_dolog("fid=".$fid."<br>fname=".$r[fname]);//操作日誌
printerror("DelMemberFormSuccess","member/ListMemberForm.php".hReturnEcmsHashStrHref2(1));
}
else
{printerror("DbError","history.go(-1)");}
}
//********************************** 會員組 **********************************
//增加會員組
function AddMemberGroup($add,$userid,$username){
global $empire,$dbtbpre;
if(empty($add[groupname])||empty($add[level]))
{printerror("EmptyMemberGroupname","history.go(-1)");}
//驗證權限
CheckLevel($userid,$username,$classid,"member");
//處理文件
$add[level]=(int)$add[level];
$add[checked]=(int)$add[checked];
$add[favanum]=(int)$add[favanum];
$add[daydown]=(int)$add[daydown];
$msgnum=(int)$add['msgnum'];
$msglen=(int)$add['msglen'];
$canreg=(int)$add['canreg'];
$formid=(int)$add['formid'];
$regchecked=(int)$add['regchecked'];
$spacestyleid=(int)$add['spacestyleid'];
$add[dayaddinfo]=(int)$add[dayaddinfo];
$add[infochecked]=(int)$add[infochecked];
$add[plchecked]=(int)$add[plchecked];
$sql=$empire->query("insert into {$dbtbpre}enewsmembergroup(groupname,level,checked,favanum,daydown,msglen,msgnum,canreg,formid,regchecked,spacestyleid,dayaddinfo,infochecked,plchecked) values('$add[groupname]',$add[level],$add[checked],$add[favanum],$add[daydown],$msglen,$msgnum,$canreg,$formid,$regchecked,$spacestyleid,'$add[dayaddinfo]','$add[infochecked]','$add[plchecked]');");
$groupid=$empire->lastid();
//更新緩存
GetMemberLevel();
if($sql)
{
//操作日誌
insert_dolog("groupid=".$groupid."<br>groupname=".$add[groupname]);
printerror("AddMemberGroupSuccess","member/AddMemberGroup.php?enews=AddMemberGroup".hReturnEcmsHashStrHref2(0));
}
else
{printerror("DbError","history.go(-1)");}
}
//修改會員組
function EditMemberGroup($add,$userid,$username){
global $empire,$dbtbpre;
$add[groupid]=(int)$add[groupid];
if(empty($add[groupid])||empty($add[groupname])||empty($add[level]))
{printerror("EmptyMemberGroupname","history.go(-1)");}
//驗證權限
CheckLevel($userid,$username,$classid,"member");
//處理文件
$add[level]=(int)$add[level];
$add[checked]=(int)$add[checked];
$add[favanum]=(int)$add[favanum];
$add[daydown]=(int)$add[daydown];
$msgnum=(int)$add['msgnum'];
$msglen=(int)$add['msglen'];
$canreg=(int)$add['canreg'];
$formid=(int)$add['formid'];
$regchecked=(int)$add['regchecked'];
$spacestyleid=(int)$add['spacestyleid'];
$add[dayaddinfo]=(int)$add[dayaddinfo];
$add[infochecked]=(int)$add[infochecked];
$add[plchecked]=(int)$add[plchecked];
$sql=$empire->query("update {$dbtbpre}enewsmembergroup set groupname='$add[groupname]',level=$add[level],checked=$add[checked],favanum=$add[favanum],daydown=$add[daydown],msglen=$msglen,msgnum=$msgnum,canreg=$canreg,formid=$formid,regchecked=$regchecked,spacestyleid=$spacestyleid,dayaddinfo='$add[dayaddinfo]',infochecked='$add[infochecked]',plchecked='$add[plchecked]' where groupid='$add[groupid]'");
//更新緩存
GetMemberLevel();
if($sql)
{
//操作日誌
insert_dolog("groupid=".$add[groupid]."<br>groupname=".$add[groupname]);
printerror("EditMemberGroupSuccess","member/ListMemberGroup.php".hReturnEcmsHashStrHref2(1));
}
else
{printerror("DbError","history.go(-1)");}
}
//刪除會員組
function DelMemberGroup($groupid,$userid,$username){
global $empire,$dbtbpre;
$groupid=(int)$groupid;
if(empty($groupid))
{printerror("NotDelMemberGroupid","history.go(-1)");}
//驗證權限
CheckLevel($userid,$username,$classid,"member");
$r=$empire->fetch1("select groupname from {$dbtbpre}enewsmembergroup where groupid='$groupid'");
$sql=$empire->query("delete from {$dbtbpre}enewsmembergroup where groupid='$groupid'");
//更新緩存
GetMemberLevel();
if($sql)
{
//操作日誌
insert_dolog("groupid=".$groupid."<br>groupname=".$r[groupname]);
printerror("DelMemberGroupSuccess","member/ListMemberGroup.php".hReturnEcmsHashStrHref2(1));
}
else
{printerror("DbError","history.go(-1)");}
}
?>