-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditconf.php
2525 lines (2280 loc) · 118 KB
/
editconf.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
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
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/* ListMail (c) 2005 Dean Wiebe <[email protected]>
You may not modify or distribute the program without express permission from the author.
Files are overwritten when updates are released, so it's not a good idea anyway. */
include("./config.php");
include("./admin.php");
$islogged = islogged();
if($backup && $restored && $_COOKIE['LMadm1'] == md5($xid)){
// fix cookie
list($instid)=mysql_fetch_row(mysql_query("select instid from $ctable where 1"));
setcookie('LMadm1',md5($instid),0,'/','.'.getdomain(),0);
header('Location: ./editconf.php?backup=1');
exit();
}
if($islogged || (!$installed && !$codes)){$isadmin='true';} else { $isadmin='';header("Location: ./login.php?r=".urlencode(substr($_SERVER['REQUEST_URI'],strrpos($_SERVER['REQUEST_URI'],'/')+1))); exit; }
if ($isadmin == 'true'){
if($sysinfo){
// get data
list($lmp)=mysql_fetch_row(mysql_query("select listmailpath from $ctable where 1"));
list($mv)=@mysql_fetch_row(mysql_query("select version()"));
$st = @shell_exec('uname -a');
$mp = detectpath('mysql');
if($mp) $mp .= '*';
$pp = detectpath('perl',1);
$wp = detectpath('wget',1);
$cp = detectpath('curl',1);
$fp = detectpath('fetch',1);
$lp = detectpath('lynx',1);
if(@file_exists('./attach')){
$at = 'Yes';
$ap = substr(sprintf('%o', fileperms('./attach')), -3);
if($ap=='777') $ap .= ' - Correct'; else $ap .= ' - <font color=green>Incorrect</font> - <a class=sysinfo_link target=a0 href=http://listmailpro.com/help/attach.html>Help</a>';
if(@file_exists('./attach/.htaccess')){
$as = file_get_contents('./attach/.htaccess');
} else $as = 'No - <a class=sysinfo_link target=a0 href=http://listmailpro.com/help/attach.html>Help</a>';
} else $at = 'No';
adminheader('LM: Server Info','Server Info','');
echo "<table width=760 border=0 cellspacing=0 cellpadding=0>
<tr>
<td valign=top width=1>\n";
listmenu($list,'config');
echo " <!-- end left menu -->
</td>
<td width=10><img src=1.gif width=10></td>
<td valign=top>
<table border=0 bordercolor=#dddddd cellspacing=0 cellpadding=0>
<tr>
<td width=1>
<input type=button class=button value=\"Back to Config\" onclick=\"hopto('./editconf.php?list=$list');\" onmouseover=\"this.className='button_over'\" onmouseout=\"this.className='button'\" style=\"width: 110px\">
</td>
<td width=3><img src=1.gif width=3></td>
<td width=1>
<input type=button class=button_on value=\"SysInfo\" onclick=\"hopto('./editconf.php?sysinfo=1&list=$list');\" onmouseover=\"this.className='button_over'\" onmouseout=\"this.className='button_on'\" style=\"width: 79px\">
</td>
</tr>
</table>
<img src=1.gif height=3><br>
<table width=100% class=outer_table border=0 cellspacing=0 cellpadding=0><tr><td class=table_head_bg_nopad>
<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td><span class=table_head_text>Server Information</span></td><td align=right><span class=table_head_text>v$file_version<img src=1.gif width=2>:</span><img src=1.gif width=2><a class=table_head_help href=\"javascript:void(0)\" onmouseover=\"window.status='Help'; return true;\" onmouseout=\"window.status=''; return true;\" onclick=\"popitup('".helplink('sysinfo')."');\">Help</a><br></td></tr></table></td></tr><tr><td height=1 bgcolor=black><img src=1.gif height=1><br></td></tr><tr><td bgcolor=#eeeeee>
<table width=92% border=0 cellspacing=0 cellpadding=0><tr><td width=5><img src=1.gif width=5></td><td>
<img src=1.gif height=5><br>
<span class=sysinfo_head>General Information</span><br>
<span class=sysinfo_option_head>ListMail URL:</span>
<span class=sysinfo_option>$lmp<br></span>
<span class=sysinfo_option_head>Server Path:</span>
<span class=sysinfo_option>$DOCUMENT_ROOT</span><br>
<span class=sysinfo_option_head>Server ID:</span>
<span class=sysinfo_option>$st</span><br>
<span class=sysinfo_option_head>Client Type:</span>
<span class=sysinfo_option>$HTTP_USER_AGENT</span><br>
<!-- <span class=sysinfo_option_head>Dailymail Last Run:</span>
<span class=sysinfo_option>date here</span><br> -->
<img src=1.gif height=10><br>
<table width=100% border=0 cellspacing=0><tr><td width=50% valign=top><span class=sysinfo_head>PHP</span><br>
<span class=sysinfo_option_head>PHP Version:</span>
<span class=sysinfo_option>".phpversion()."</span><br>
<span class=sysinfo_option_head>php.ini \"file_uploads\":</span>
<span class=sysinfo_option>"; if(ini_get('file_uploads')=='1') echo 'Yes'; else echo 'No'; echo "</span><br>
<span class=sysinfo_option_head>php.ini \"upload_max_filesize\":</span>
<span class=sysinfo_option>".ini_get('upload_max_filesize')."</span><br>
<span class=sysinfo_option_head>php.ini \"memory_limit\":</span>
<span class=sysinfo_option>".ini_get('memory_limit')."</span><br>
<span class=sysinfo_option_head>php.ini \"post_max_size\":</span>
<span class=sysinfo_option>".ini_get('post_max_size')."</span><br>
</td><td width=50% valign=top>
<span class=sysinfo_head>Linux Programs</span><br>
<span class=sysinfo_option_head>Path to \"perl\":</span>
<span class=sysinfo_option>$pp</span><br>
<span class=sysinfo_option_head>Path to \"wget\":</span>
<span class=sysinfo_option>$wp</span><br>
<span class=sysinfo_option_head>Path to \"curl\":</span>
<span class=sysinfo_option>$cp</span><br>
<span class=sysinfo_option_head>Path to \"fetch\":</span>
<span class=sysinfo_option>$fp</span><br>
<span class=sysinfo_option_head>Path to \"lynx\":</span>
<span class=sysinfo_option>$lp</span><br>
</td></tr></table>
<img src=1.gif height=10><br>
<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td width=50% valign=top>
<span class=sysinfo_head>MySQL</span><br>
<span class=sysinfo_option_head>MySQL Version:</span>
<span class=sysinfo_option>$mv</span><br>
<span class=sysinfo_option_head>Path to MySQL utilities:</span>
<span class=sysinfo_option>$mp</span><br>
</td><td width=50% valign=top nowrap>
<span class=sysinfo_head>./attach Folder</span><br>
<span class=sysinfo_option_head>./attach Exists?</span>
<span class=sysinfo_option>$at</span><br>
<span class=sysinfo_option_head>./attach Permissions:</span>
<span class=sysinfo_option>$ap</span><br>
<span class=sysinfo_option_head>./attach Security:</span>
<span class=sysinfo_option>$as</span><br>
</td></tr></table>
<img src=1.gif height=10><br>
</td></tr></table>
</center>
</td></tr></table>
</td></tr></table>";
exit;
}
if($backup){
if($dl=='1'){
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=$fn");
readfile("./attach/$fn");
exit;
}
if($delete&&$file&&!$restore){
@exec("rm $file");
@exec("del $file");
}
if($upload&&$file){
$rpos = strrpos($file,'/');
$pfn = substr($file,$rpos+1);
$fn = './attach/'.$pfn;
echo "<center><div align=left style=\"font: 9pt arial; width: 760px;\">Sending $pfn to LMP server..."; flush();
list($lmp_id,$lmp_url)=mysql_fetch_row(mysql_query("select instid,listmailpath from $ctable where 1;"));
$targ = 'https://www.lmp2.lmhost.com/members/backup-inbound.php';
// echo "lmpid=".$lmp_id." lmpurl=".$lmp_url."<br>";
$lmp_url = urlencode($lmp_url);
$lmp_id = urlencode($lmp_id);
$bound = md5(time());
$body = "--$bound\r\n";
$body .= "content-disposition: form-data; name=\"lmp_url\"\r\n\r\n";
$body .= "$lmp_url\r\n";
$body .= "--$bound\r\n";
$body .= "content-disposition: form-data; name=\"lmp_id\"\r\n\r\n";
$body .= "$lmp_id\r\n";
$body .= "--$bound\r\n";
$body .= "content-disposition: form-data; name=\"userfile\"; filename=\"$pfn\"\r\n";
$body .= "Content-Type: application/octet-stream\r\n";
$body .= "Content-Transfer-Encoding: binary\r\n\r\n";
$foot = "--$bound--\r\n";
$len = strlen($body)+filesize($fn)+strlen($foot);
$head = "POST /members/backup-inbound.php HTTP/1.1\r\n";
$head .= "Host: lmp2.lmhost.com\r\n";
$head .= "Content-Type: multipart/form-data; boundary=$bound\r\n";
$head .= "Content-Length: $len\r\n\r\n";
$fp = @fsockopen('lmp2.lmhost.com',80);
if($fp){
$str1 = $head.$body;
fputs($fp,$str1);
unset($str1);
$fp2 = fopen($fn,'r') or die('error opening file');
while(!feof($fp2)){
$line = fgets($fp2,2048);
fputs($fp,$line);
}
fclose($fp2);
fputs($fp,"\r\n");
fputs($fp,$foot);
// get result back
while(!feof($fp)){
$line = fgets($fp,1024);
// echo "line=$line<br>"; flush();
}
fclose($fp);
echo "$line";
} else {
// notify user that server could not be contacted
echo "Could not contact LMP server! Please try again.<br>";
}
echo "</div></center>";
}
if($restore&&$file){
// if(!$sqlpath) $sqlpath = detectpath('mysql');
// if(!$sqlpath) echo "<span class=status_text>Error: Path to MySQL could not be detected. Manually set the path to the MySQL binaries in config.php</span><br>";
// get old installid and admpw
list($instid,$admpw)=mysql_fetch_row(mysql_query("select instid,admpw from $ctable where 1"));
// drop tables (for backward compat.)
echo "<span style=\"font: 9pt arial\">Dropping old tables... "; flush();
while(list($key,$val)=each($atables)){
@mysql_query("DROP TABLE if exists $val");
}
echo "OK "; flush();
$fileext = substr($file,strlen($file)-3,3);
if(strtoupper($fileext) == '.GZ') $unzip = 1; else $unzip = '';
if($unzip){
echo "Unzipping... "; flush();
// unzip it
$memory_limit = 2 * 1024 * 1024;
$buffer = '';
// echo "unzipping $file.. $file<br>";
$if = $file;
$of = './attach/'.substr($file,2,strlen($file)-5);
// echo "of=$of<br>";
$ifp = gzopen($if,'r');
$ofp = fopen($of,'w');
if(!$ifp || !$ofp) exit('gz: could not open input and/or output file');
while(!feof($ifp)){
$buffer .= gzread($ifp,2048);
if(strlen($buffer) > $memory_limit){
// echo "strlen(buffer) > memory_limit ... usage=".memory_get_usage()."<br>";
// write to output file
fputs($ofp,$buffer);
$buffer = '';
}
}
if(strlen($buffer)>0) fputs($ofp,$buffer);
// echo "done?<br>";
$file = $of;
fclose($ifp);
fclose($ofp);
echo "OK "; flush();
}
// echo "file=$file";
echo "Importing data - Please wait... "; flush();
$fp = fopen($file,'r') or die("Could not open file: $file");
$cmd = '';
while(!feof($fp)){
$line = fgets($fp,10000);
// $line = substr($line,0,strlen($line)-1);
if(substr($line,0,2)<>'--'){
$cmd .= substr($line,0,strlen($line)-1);
if(substr($line,strlen($line)-2,1)==';'){
// echo "<textarea rows=10 cols=100>$cmd</textarea><br>";
mysql_query($cmd) or die(mysql_error());
$cmd = '';
}
}
}
fclose($fp);
// exec($sqlpath."mysql -u$sqluser -p$sqlpass -h$xsqlhost".$sqlsock." $sqldb <$file");
echo "OK "; flush();
if($unzip){
@exec("rm $file");
@exec("del $file");
}
$special = "refresh-cookie;$instid";
echo "Optimizing tables... "; flush();
optimizeall();
echo "OK<br></span>"; flush();
$logtxt = 'Restore complete!';
list($nadmpw)=mysql_fetch_row(mysql_query("select admpw from $ctable where 1"));
if($nadmpw<>$admpw){
if(!$nadmpw) $nadmpw = 'blank/<b>install</b>';
else $nadmpw = "<b>$nadmpw</b>";
echo "<span style=\"font: 9pt arial\">Your admin password appears to have changed (to $nadmpw). Please <a style=\"color: navy; font: 9pt arial;\" href=./login.php>re-login</a> to reset your cookies.</span><br>";
exit();
// setcookie('LMadm2',md5($nadmpw),0,'/','.'.getdomain(),0);
}
}
if($write){
// optimize tables..
$fn = './attach/' . date("Y-m-d_h-i-s");
list($nu) = @mysql_fetch_row(mysql_query("select count(*) from $utable where 1;"));
if(!$nu) $nu = 0;
echo "<center><div align=left style=\"font: 9pt arial; width: 760px;\">Optimizing tables... "; flush();
optimizeall();
echo "DONE "; flush();
echo "Writing backup file - Please wait... "; flush();
// exec("echo > $fn.LM");
$fp = fopen("$fn.LM",'w') or die('Could not open file for writing - is your ListMail attach folder writable?');
reset($atables);
while(list($k,$v)=each($atables)){
/* NEW BACKUP PROCESS */
$start = time();
$out = "-- ListMailPRO Backup v1.00 (c) 2006 ListMail / Dean Wiebe\n-- This file can be restored from within ListMail or by uploading into PhpMyAdmin\n-- Backup Start: ".date("Y-m-d H:i(+s\s) T ",$start)."\n";
foreach($atables as $table){
// CREATE
$out .= "\nCREATE TABLE $table (\n";
$rows = mysql_query("describe $table") or die("db error accessing table $table");;
$nfs = @mysql_num_rows($rows);
$x=1;
$foot = '';
while(list($field,$type,$null,$key,$default,$extra)=mysql_fetch_row($rows)){
// echo "field=$field, type=$type, null=$null, key=$key, default=$default, extra=$extra<br>";
$out .= " $field $type";
if($default) $out .= " DEFAULT '$default'";
if(!$null) $out .= " NOT NULL";
if($extra=='auto_increment') $out .= " AUTO_INCREMENT";
if($key=='PRI'){ if($foot) $foot .= ", \n"; $foot .= " PRIMARY KEY($field)"; }
elseif($key=='MUL'){ if($foot) $foot .= ", \n"; $foot .= " INDEX($field)"; }
if($x<>$nfs) $out .= ", \n"; elseif($x==$nfs&&$foot) $out .= ", \n"; else $out .= "\n";
if($x==$nfs && $foot) $out .= $foot."\n";
if($x==$nfs) $out .= ");\n\n";
$x++;
}
fputs($fp,$out);
$out = '';
// INSERT
$rows = mysql_query("select * from $table where 1") or die("db error accessing table $table");
$nrows = @mysql_num_rows($rows);
if($nrows>0){
while($row = mysql_fetch_row($rows)){
$out .= "INSERT INTO $table VALUES(";
$x = 1;
$cnt = count($row);
while(list($k,$v)=each($row)){
$out .= "'".addslashes($v)."'";
if($x<>$cnt) $out.= ",";
$x++;
}
$out .= ");\n";
fputs($fp,$out);
$out = '';
}
} // else echo " no rows in table..";
}
$end = time();
$total = $end - $start;
$out .= "\n-- Backup Finish: ".date("Y-m-d H:i(+s\s) T ",$end)."\n";
$out .= "-- Total MySQL Time: $total seconds";
fputs($fp,$out);
/* END NEW BACKUP PROCESS */
}
fclose($fp);
echo "DONE "; flush();
reset($atables);
echo "Verifying backup file... "; flush();
// VERIFY FILE
$found = array();
if(@file_exists($fn.'.LM')){
if($fp=fopen($fn.'.LM','r')){
while(!feof($fp)){
$line = fgets($fp,2048);
}
} else {
echo "<font color=red>ERROR - COULD NOT OPEN FILE TO VERIFY</font><br>";
}
// echo "Done verifying<br>";
// echo "substr(line,0,20)=".substr($line,0,20);
if(substr($line,0,20)<>'-- Total MySQL Time:') echo "<font color=red>ERROR - MISSING DATA</font><br>";
else {
echo "OK "; flush();
}
if($zipit){
echo 'gZipping... '; flush();
// compress file with buffering
// echo "memory_usage=".memory_get_usage()."<br>";
// 2 MB default memory limit
$memory_limit = 2 * 1024 * 1024;
$buffer = '';
$if = $fn.'.LM';
$of = $fn.'.LM.gz';
$ifp = fopen($if,'r');
$ofp = fopen($of,'w');
if(!$ifp || !$ofp) exit('gz: could not open input and/or output file');
while(!feof($ifp)){
$buffer .= fgets($ifp,2048);
if(strlen($buffer) > $memory_limit){
// echo "strlen(buffer) > memory_limit ... usage=".memory_get_usage()."<br>";
// write to output file
fputs($ofp,gzencode($buffer));
$buffer = '';
}
}
if(strlen($buffer)>0) fputs($ofp,gzencode($buffer));
fclose($ifp);
fclose($ofp);
if(!@unlink($fn.'.LM')){
@exec('rm '.$fn.'.LM');
@exec('del '.$fn.'.LM');
}
echo "OK<br>"; flush();
} else echo "<br></span>";
// echo "DONE<br>"; flush();
$logtxt = "Backup file written!";
echo "</div></center>";
} else {
echo "<font color=red>NOT FOUND</font><br></small>";
}
}
if(!$dorestore){
// main page
adminheader('LM: Backup & Restore','Backup & Restore','');
echo "<table width=760 border=0 cellspacing=0 cellpadding=0>
<tr>
<td valign=top width=1>\n";
listmenu($list,'config');
echo " <!-- end left menu -->
</td>
<td width=10><img src=1.gif width=10></td>
<td valign=top>
<table border=0 bordercolor=#dddddd cellspacing=0 cellpadding=0>
<tr>
<td width=1>
<input type=button class=button value=\"Back to Config\" onclick=\"hopto('./editconf.php?list=$list');\" onmouseover=\"this.className='button_over'\" onmouseout=\"this.className='button'\" style=\"width: 110px\">
</td>
<td width=3><img src=1.gif width=3></td>
<td width=1>
<input type=button class=button_on value=\"Backup & Restore\" onclick=\"hopto('./editconf.php?list=$list&backup=1');\" onmouseover=\"this.className='button_over'\" onmouseout=\"this.className='button_on'\" style=\"width: 135px\">
</td>
</tr>
</table>
<img src=1.gif height=3><br>
<table width=100% class=outer_table border=0 cellspacing=0 cellpadding=0><tr><td class=table_head_bg_nopad>
<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td><span class=table_head_text>Backup & Restore Database</span></td><td align=right><a class=table_head_help href=\"javascript:void(0)\" onmouseover=\"window.status='Help'; return true;\" onmouseout=\"window.status=''; return true;\" onclick=\"popitup('".helplink('backup_restore')."');\">Help</a><br></td></tr></table>
</td></tr></table>
<img src=1.gif height=5><br>
<span class=table_inside_normal>This page allows you to save and restore your entire database of ListMail data. That includes everything, all of your settings, lists, and users. With this function you can change hosts and migrate your ListMail installation as well as protect again unforeseen accidents.<br><img src=1.gif height=10><br>
<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td valign=top width=48%><form method=post action=\"./editconf.php\"><input type=hidden name=backup value=1><input type=hidden name=write value=1><input type=hidden name=list value=$list>
<span class=table_inside_normal><b><u>Backup Database</u></b><br><img src=1.gif height=2><br>Your ListMailPRO data will be written to a file which you can download. This file is a basic MySQL dump file that can be restored either through ListMailPRO (at right) or with a program like PhpMyAdmin.<br><img src=1.gif height=10><br>Files are temporarily stored in the attach folder. It is <i>very important</i> that you delete these files immediately as they are fully accessible.<br>\n";
if(function_exists('gzencode')) echo "<img src=1.gif height=10><br>
<input name=zipit value=1 type=checkbox style=\"vertical-align: bottom\" class=chkbox checked=checked> gZip the file (Recommended)</span><br>\n";
echo "<img src=1.gif height=10><br><input class=button type=submit value=\"Write Backup File\" onmouseover=\"this.className='button_over'\" onmouseout=\"this.className='button'\" style=\"width: 135px\"><br>
<img src=1.gif height=10><br>\n";
$handle=opendir('./attach');
$x = 0;
$xarray = array();
while($file_name = readdir($handle)) {
$fileext = substr($file_name,strlen($filename)-3,3);
if ($file_name != "." && $file_name != ".." && (strtoupper($fileext) == '.LM' || strtoupper($fileext) == '.GZ')) {
$xarray[] = $file_name;
$relpath = "./attach/".$file_name;
$file_size = filesize($relpath);
if($file_size >= 1048576) {
$file_size = ceil(round($file_size / 1048576 * 100) / 100) . "M";
}
elseif ($file_size >= 1024) {
$file_size = ceil(round($file_size / 1024 * 100) / 100) ."k";
} else {
$file_size = $file_size . "b";
}
// if($demo<>'yes') $dlhref = "./attach/$file_name"; else $dlhref = "Not%20Available%20In%20Demo";
if($demo<>'yes') $dlhref = "./editconf.php?list=$list&backup=1&dl=1&fn=$file_name"; else $dlhref = "Not%20Available%20In%20Demo";
echo "<div style=\"border: 1px solid #eeeeee; padding: 3px 3px 3px 3px\"><span class=table_inside_normal><b>$file_name</a><img src=1.gif width=20 height=1>$file_size</b></span><br><img src=1.gif height=3><br><a href=$dlhref class=table_inside_normal style=\"color: blue\">Download</a><span class=table_inside_normal> Choose \"Save to Disk\"</span><br>
<img src=1.gif height=3><br><a href=\"./editconf.php?list=$list&backup=1&delete=1&file=./attach/$file_name\" class=table_inside_normal style=\"color: red\">Delete</a><span class=table_inside_normal> the file once you have saved it.</span><br>
<img src=1.gif height=3><br>";
if(!$no_auto_backup) echo "<a href=\"./editconf.php?list=$list&backup=1&upload=1&file=./attach/$file_name\" class=table_inside_normal style=\"color: green\">Upload</a><span class=table_inside_normal> the file to LMP servers! * <a style=\"color: green\" href=https://www.lmp2.lmhost.com/members/?r=".urlencode('/members/backup.php?backup=1')." target=newlmp>Learn More</a></span>";
echo "</div><img src=1.gif height=5><br>";
}
}
closedir($handle);
echo "</td></form>
<td width=10><img src=1.gif width=10></td>
<td valign=top><form method=post><input type=hidden name=backup value=1><input type=hidden name=restore value=1><span class=table_inside_normal><b><u>Restore Database</u></b><br><img src=1.gif height=2><br>Your settings will be read from a backup file uploaded into the ListMailPRO directory.<br><img src=1.gif height=10><br><font color=red>This will completely overwrite any existing lists, users, and settings with the data from the backup file!</font><br><img src=1.gif height=10><br>
Click your uploaded file below. If you dont see any files, upload your *.LM or *.LM.gz file to your ListMailPRO directory via FTP and refresh the page.<br>
<img src=1.gif height=10><br>\n";
echo "
<span class=table_inside_normal>
<img src=1.gif height=2><br>
<table border=0 cellspacing=0 cellpadding=0><tr><td>";
$handle=opendir('./');
$x = 0;
$xarray = array();
while($file_name = readdir($handle)) {
$fileext = substr($file_name,strlen($filename)-3,3);
$fileext2 = substr($file_name,strlen($filename)-6,6);
if ($file_name != "." && $file_name != ".." && (strtoupper($fileext) == ".LM" || strtoupper($fileext2) == 'LM.TXT' || strtoupper($fileext2) == '.LM.GZ')) {
$xarray[] = $file_name;
$relpath = "./".$file_name;
$file_size = filesize($relpath);
if ($file_size >= 1048576) {
$file_size = ceil(round($file_size / 1048576 * 100) / 100) . "M";
}
elseif ($file_size >= 1024) {
$file_size = ceil(round($file_size / 1024 * 100) / 100) ."k";
} else {
$file_size = $file_size . "b";
}
echo "<tr>
<td><a onclick=\"if(!confirm('Are you sure you want to COMPLETELY overwrite all existing ListMail data??')) return false; else return true;\" href=\"./editconf.php?list=$list&backup=1&restore=1&file=./$file_name\" class=table_inside_small style=\"color: blue\">$file_name</a></td><td width=20><img src=1.gif width=20 height=1></td><td width=1 align=right><span class=table_inside_small style=\"color: navy\">$file_size</span></td></tr>";
}
}
echo "</table>";
if(!empty($xarray)){
echo "<img src=1.gif height=10><br>You should manually delete the(se) file(s) as soon as you have restored your database.<br>";
}
if(empty($xarray)){
echo "<span class=table_inside_normal>No uploaded backup files found.</span>";
}
closedir($handle);
echo "</td></form></tr></table>";
if($logtxt) echo "<span class=status_text>$logtxt</span><br>";
echo "</td></tr></table>";
}
exit;
} // end backup & restore
if($customcmd){
if(!$ntimes) $ntimes = '1';
if($doit){
$ccmd = addslashes($ccmd);
for($i=0;$i<$ntimes;$i++){
// echo "CMD=".$ccmd."<br>";
mysql_query($ccmd) or die("failed executing command");
}
echo "<br>Successfully executed command(s). ".mysql_affected_rows()." rows affected.<br>";
}
echo "<form method=post><input type=hidden name=customcmd value=1><input type=hidden name=doit value=1>Enter custom command: <input type=text name=ccmd value=\"".htmlspecialchars($ccmd)."\" size=50> Repeat <input type=text size=1 name=ntimes value=$ntimes><br>
<input type=submit value=\"Do it!\"></form>";
exit;
}
/* *************************************************************************************************** */
if($codes){
list($keych)=mysql_fetch_row(mysql_query("select keycode from $ctable where 1"));
if(!$list) $list = 'all';
if($list=='all') $clist = '0'; else $clist = $list;
if($save){
$errtxt = '';
if($typ=='remove'){
// check multi list rem / options
if($dummy) $data4 = ''; else $data4 = str_replace(' ','',$data4);
if($data4){
if(strpos(' '.$data4,'*')>0) $data4 = '*';
else
if(!ereg("^[0-9]+(,[0-9]+)*$",$data4)){
$error = 1; $rem_multi = 1;
} else {
// check if lists exist
$lists=explode(',',$data4);
while(list($k,$v)=each($lists)){
if(@mysql_num_rows(mysql_query("select listnum from $ltable where listnum = '$v'"))==0) $errtxt .= "Warning: List $v used in the code does not exist.";
}
}
}
if(($data3 || $data4) && $data5=='1') $data5=='2';
}
if($typ=='date' || $typ=='dateadd'){
// check offsets data2-4 +/- 999
if(!is_numeric($data2)) $data2 = '0';
if(!is_numeric($data3)) $data3 = '0';
if(!is_numeric($data4)) $data4 = '0';
if($data2 > 999) $data2 = '999'; if($data2 < -999) $data2 = '-999';
if($data3 > 999) $data3 = '999'; if($data3 < -999) $data3 = '-999';
if($data4 > 999) $data4 = '999'; if($data4 < -999) $data4 = '-999';
}
$noreload = '';
if(($cname <> $origname) || $add || $noreload) $checkdupe = 1; else $checkdupe = '';
$dupe = '';
$cname = addslashes($cname);
$typ = addslashes($typ);
$data1 = addslashes($data1);
$data2 = addslashes($data2);
$data3 = addslashes($data3);
$data4 = addslashes($data4);
$data5 = addslashes($data5);
$id = addslashes($id);
if($checkdupe){
if(@mysql_num_rows(@mysql_query("select id from $dtable where ref like '$cname' and list = '$clist'")) > 0){ $dupe = 1; $error = 1; } else $dupe = '';
}
if($cname=='') $error = 1;
if(!$error){
if($edit){
mysql_query("update $dtable set list='$clist', ref='$cname',typ='$typ',data1='$data1',data2='$data2',data3='$data3',data4='$data4',data5='$data5' where id = '$id'");
$logtxt = 'Saved message code.';
$origname = $cname;
}
if($add){
mysql_query("insert into $dtable (id,list,ref,typ,data1,data2,data3,data4,data5) values('','$clist','$cname','$typ','$data1','$data2','$data3','$data4','$data5')") or die(mysql_error());
$logtxt = 'Added message code.';
$id = mysql_insert_id();
$add='';
$edit = 1;
}
} else {
$noreload = 1;
if($cname=='') $logtxt = 'Blank code name. Not saved!';
if($dupe) $logtxt = 'Duplicate code name. Not saved!';
if($rem_multi) $logtxt = 'Multi-list invalid format. Format is "1,2,3". Not saved!';
}
$xtxt = $logtxt;
if($noreload){
$cname = stripslashes($cname);
$typ = stripslashes($typ);
$data1 = stripslashes($data1);
$data2 = stripslashes($data2);
$data3 = stripslashes($data3);
$data4 = stripslashes($data4);
$data5 = stripslashes($data5);
$id = stripslashes($id);
}
$save='';
}
if($edit || $add){
if($edit) $atxt = 'Edit Message Code';
if($add){
$ref = $cname;
$atxt = 'Add Message Code';
}
adminheader('LM: '.$atxt,$atxt,'');
echo "
<table width=760 border=0 cellspacing=0 cellpadding=0>
<tr>
<td valign=top width=1>\n";
listmenu($list,'confcode');
echo " </td>
<td width=10><img src=1.gif width=10></td>
<td valign=top>";
echo " <table class=outer_table width=100% border=0 cellspacing=0 cellpadding=0>
<tr>
<td class=table_head_bg_nopad>
<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td><span class=table_head_text>$atxt</span></td><td align=right><a class=table_head_help href=\"javascript:void(0)\" onmouseover=\"window.status='Help'; return true;\" onmouseout=\"window.status=''; return true;\" onclick=\"popitup('".helplink('message_codes')."');\">Help</a><br></td></tr></table>
</td>
</tr>
</table>
<table width=100% border=0 cellspacing=0 cellpadding=0>
<tr>
<td>
<img src=1.gif height=4><br>\n";
if($edit && !$noreload){
$cmd = "select id,ref,typ,data1,data2,data3,data4,data5 from $dtable where id = '$id'";
$drow = mysql_query($cmd);
list($id,$ref,$typ,$data1,$data2,$data3,$data4,$data5)=@mysql_fetch_row($drow);
} elseif ($noreload){
$ref = $cname;
$typ = $typ;
// echo "id=$id ref=$ref typ=$typ data1=$data1 data2=$data2 data3=$data3 data4=$data4 cid=$cid cname=$cname type=$typ<br>";
}
if(!$typ) $typ = 'remove';
switch($typ){
case 'fname': $fn=' selected'; break;
case 'lname': $ln=' selected'; break;
case 'fullname': $fu=' selected'; break;
case 'email': $em=' selected'; break;
case 'remove': $re=' selected'; break;
case 'confirm': $co=' selected'; break;
case 'text': $te=' selected'; break;
case 'date': $da=' selected'; break;
case 'title': $ti=' selected'; break;
case 'uid': $ui=' selected'; break;
case 'field1' : $f1 = ' selected'; break;
case 'field2' : $f2 = ' selected'; break;
case 'field3' : $f3 = ' selected'; break;
case 'field4' : $f4 = ' selected'; break;
case 'field5' : $f5 = ' selected'; break;
case 'field6' : $f6 = ' selected'; break;
case 'field7' : $f7 = ' selected'; break;
case 'field8' : $f8 = ' selected'; break;
case 'field9' : $f9 = ' selected'; break;
case 'field10' : $f10 = ' selected'; break;
case 'ip' : $ip = ' selected'; break;
case 'refurl' : $ru = ' selected'; break;
case 'dateadd' : $dt = ' selected'; break;
case 'link2html' : $ht = ' selected'; break;
case 'remcnfht' : $rch = ' selected'; break;
case 'numsubs' : $nsu = ' selected'; break;
}
// get custom fields for this list
$fields = getcfields($list);
echo "<table border=0 cellspacing=0 cellpadding=0>
<tr>
<td>
<form name=code_frm method=post action=./editconf.php><span class=table_inside_small>Message Code Type:</span><br>
<select name=typ class=xbox onchange=\"code_frm.noreload.value=1; code_frm.submit();\">
<option value=#>-- Choose Type --
<option value=remove$re>Remove Link
<option value=remcnfht$rch>Remove Confirm
<option value=confirm$co>Signup Confirm
<option value=fname$fn>First Name
<option value=lname$ln>Last Name
<option value=fullname$fu>Full Name
<option value=email$em>Email Address
<option value=text$te>Custom Text
<option value=date$da>Formatted Date
<option value=dateadd$dt>Date Added
<option value=title$ti>List Title
<option value=refurl$ru>Referring URL
<option value=uid$ui>Unique UID
<option value=ip$ip>IP Address
<option value=link2html$ht>Link to HTML
<option value=field1$f1>".$fields[1]."
<option value=field2$f2>".$fields[2]."
<option value=field3$f3>".$fields[3]."
<option value=field4$f4>".$fields[4]."
<option value=field5$f5>".$fields[5]."
<option value=field6$f6>".$fields[6]."
<option value=field7$f7>".$fields[7]."
<option value=field8$f8>".$fields[8]."
<option value=field9$f9>".$fields[9]."
<option value=field10$f10>".$fields[10]."
<option value=numsubs$nsu>Subscriber Count
</select><br>
<img src=1.gif height=5><br>";
if($ref) $thecode = $keych.$ref;
echo "<span class=table_inside_normal>";
// show text in edit form
switch($typ){
// name
case 'fname': echo "The code <b>$thecode</b> will be replaced by the user's first name or the default text when email is sent.<br><img src=1.gif height=10><br>"; break;
case 'lname': echo "The code <b>$thecode</b> will be replaced by the user's last name when email is sent.<br><img src=1.gif height=10><br>"; break;
case 'fullname': echo "The code <b>$thecode</b> will be replaced by the user's full name, a combination of the first and last name or just the first name if the last name doesn't exist. You may also assign a default value if no first name is found.<br><img src=1.gif height=10><br>"; break;
// email
case 'email': echo "The code <b>$thecode</b> is replaced by the user's email address when email is sent.<br><img src=1.gif height=10><br>"; break;
// remove
case 'remove':
$c = $id; if(!$c) $c = '1';
echo "The code <b>$thecode</b> is replaced by an automatically generated removal link. You can set text that appears above the link and also set the title of the HTML link that is displayed by this code. The remove text is optional. If you leave it blank, just the link will be output by this code. When clicked, this link will bring the user to your Custom HTML \"Remove Confirm\" page for the list they are removing themselves from.<br><img src=1.gif height=10><br>
<span class=table_inside_small><u>Example of Output</u><br><img src=1.gif height=5><br>
<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td width=50% valign=top><span class=table_inside_small><b>Text Version:</b><br>";
// create link
$rlink = $lmpath . "rem.php?";
if($data5=='1' || !$data5) $rlink .= "u=1a2b3c4";
if($data5=='2') $rlink .= "c=$c&u=1a2b3c4";
if($data5=='3') $rlink .= "u=$c,1a2b3c4";
if($data5=='4') $rlink .= "x=$c&l=2&[email protected]";
if($data5=='5') $rlink .= "x=$c,2,[email protected]";
if($data1) echo nl2br($data1)."<br>";
echo "$rlink</span></td><td width=50% valign=top><span class=table_inside_small><b>HTML Version:<br></b>";
if($data1) echo nl2br($data1)."<br>";
echo "<a href=$rlink>$data2</a></td></tr></table><img src=1.gif height=10><br>"; break;
// confirm
case 'confirm':
echo "The code <b>$thecode</b> is replaced by an automatically generated confirmation link. You can set text that appears above the link and also set the title of the HTML link that is displayed by this code. The remove text is optional. If you leave it blank, just the link will be output by this code. When clicked, this link will bring the user to your Custom HTML \"Subscribe Success\" page for the list they are subscribing to.<br><img src=1.gif height=10><br>
<span class=table_inside_small><u>Example of Output</u><br><img src=1.gif height=5><br>
<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td width=50% valign=top><span class=table_inside_small><b>Text Version:</b><br>";
if($data1) echo nl2br($data1)."<br>";
echo "http://".getdomain().getdir()."/confirm.php?u=1a2b3c4</span></td><td width=50% valign=top><span class=table_inside_small><b>HTML Version:<br></b>";
if($data1) echo nl2br($data1)."<br>";
echo "<a href=http://".getdomain().getdir()."/confirm.php?u=1a2b3c4>$data2</a></td></tr></table><img src=1.gif height=10><br>"; break;
// HTML remove confirm
case 'remcnfht':
echo "The code <b>$thecode</b> is replaced by a button that enables the user to confirm removal of their address on the \"Remove Confirm\" Custom HTML page. The button can be customized by setting up a style sheet in your Custom HTML modifying the \".confirm_button\" element. When clicked, the button will bring the user to your Custom HTML \"Remove Success\" page for the list(s) they are unsubscribing from.<br><img src=1.gif height=10><br>"; break;
// custom text
case 'text': echo "The code <b>$thecode</b> will be replaced by user-definable text when email is sent. In HTML email, line breaks will be replaced with <b><br></b>'s.<br><img src=1.gif height=10><br>"; break;
// date
case 'date': echo "The code <b>$thecode</b> will be replaced by a formatted date that is calculated at sending time.<br><img src=1.gif height=10><br>";
echo "<span class=table_inside_small><u>Recognized characters in string:</u><br></span>";
?>
<div style="font: 9pt courier new">
d - day of the month, 2 digits with leading zeros; i.e. "01" to "31"<br>
D - day of the week, textual, 3 letters; i.e. "Fri"<br>
F - month, textual, long; i.e. "January"<br>
j - day of the month without leading zeros; i.e. "1" to "31"<br>
l (lowercase 'L') - day of the week, textual, long; i.e. "Friday"<br>
m - month; i.e. "01" to "12"<br>
M - month, textual, 3 letters; i.e. "Jan"<br>
n - month without leading zeros; i.e. "1" to "12"<br>
S - English ordinal suffix, textual, 2 characters; i.e. "th", "nd"<br>
t - number of days in the given month; i.e. "28" to "31"<br>
w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)<br>
Y - year, 4 digits; i.e. "1999"<br>
y - year, 2 digits; i.e. "99"<br>
z - day of the year; i.e. "0" to "365"<br>
</div>
<?php
echo "<img src=1.gif height=10><br>"; break;
// date added
case 'dateadd': echo "The code <b>$thecode</b> will be replaced by the date the user was added to ListMail.<br><img src=1.gif height=10><br>";
echo "<span class=table_inside_small><u>Recognized characters in string:</u><br></span>";
?>
<div style="font: 9pt courier new">
d - day of the month, 2 digits with leading zeros; i.e. "01" to "31"<br>
D - day of the week, textual, 3 letters; i.e. "Fri"<br>
F - month, textual, long; i.e. "January"<br>
j - day of the month without leading zeros; i.e. "1" to "31"<br>
l (lowercase 'L') - day of the week, textual, long; i.e. "Friday"<br>
m - month; i.e. "01" to "12"<br>
M - month, textual, 3 letters; i.e. "Jan"<br>
n - month without leading zeros; i.e. "1" to "12"<br>
S - English ordinal suffix, textual, 2 characters; i.e. "th", "nd"<br>
t - number of days in the given month; i.e. "28" to "31"<br>
w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)<br>
Y - year, 4 digits; i.e. "1999"<br>
y - year, 2 digits; i.e. "99"<br>
z - day of the year; i.e. "0" to "365"<br>
</div>
<?php
echo "<img src=1.gif height=10><br>"; break;
// list title
case 'title': echo "The code <b>$thecode</b> will be replaced by the user's list title when email is sent.<br><img src=1.gif height=10><br>"; break;
// user's unique id
case 'uid': echo "The code <b>$thecode</b> will be replaced by the user's randomly generated user id code. (Used in removal link, tracking, etc.) You can use this with external scripts to interact with the ListMail database. This is intended mainly for experienced programmers to use.<br><img src=1.gif height=10><br>"; break;
// custom fields
case (substr($typ,0,5) == 'field'): echo "The code <b>$thecode</b> will be replaced with the user's data from the chosen custom field. You can optionally enter a default value for if the user data is not found.<br><img src=1.gif height=10><br>"; break;
// ip address
case 'ip': echo "The code <b>$thecode</b> will be replaced by the user's IP address, if it exists in the database. ListMail will attempt to collect the user's IP address when they subscribe from a form. If ListMail is unable to identify the IP, or users are entered manually, with email subscription, or the import process, \"Unknown\" will be shown.<br><img src=1.gif height=10><br>"; break;
// refurl
case 'refurl': echo "The code <b>$thecode</b> will be replaced with the user's referring URL, if it exists in the database. ListMail will attempt to collect the referring URL, or, the exact page the user used to subscribe, when a subscription is made from a form. If ListMail is unable to identify the referring URL, \"Unknown\" will be shown. If user's are entered via email subscription, \"Email\" will be shown. If imported, \"Imported\" will be shown. And finally, if you manually add a user from within ListMail, \"Manually Added\" will be shown.<br><img src=1.gif height=10><br>"; break;
// link2html
case 'link2html': echo "The code <b>$thecode</b> is replaced by an automatically generated link to a page showing the current message's HTML. Message codes are processed on this page. You can set text that appears above the link and also set the title of the HTML link that is displayed by this code. The text is optional. If you leave it blank, just the link will be output by this code.<br><img src=1.gif height=10><br>
<span class=table_inside_small><u>Example of Output</u><br><img src=1.gif height=5><br>
<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td width=50% valign=top><span class=table_inside_small><b>Text Version:</b><br>";
if($data1) echo nl2br($data1)."<br>";
echo "http://".getdomain().getdir()."/showpage.php?u=1a2b3c4&m=123 </span></td><td width=50% valign=top><span class=table_inside_small><b>HTML Version:<br></b>";
if($data1) echo nl2br($data1)."<br>";
echo "<a href=http://".getdomain().getdir()."/showpage.php?u=1a2b3c4&m=123>$data2</a></td></tr></table><img src=1.gif height=10><br>"; break;
// numsubs
case 'numsubs': echo "The code <b>$thecode</b> is replaced with the current number of subscribers on the user's list. You can optionally specify an offset to fudge the results, a little :-)<br>
<img src=1.gif height=10><br>";
break;
} // end top text begin bottom boxes
echo "</span>\n";
// all types except rem
if($typ=='remove'){
if($data5=='1' || (!$data3 && !$data4 && !$data5)) $d51 = ' selected'; else $d51 = '';
if($data5=='2' || (!$data5 && ($data3 || $data4))) $d52 = ' selected'; else $d52 = '';
if($data5=='3') $d53 = ' selected'; else $d53 = '';
if($data5=='4') $d54 = ' selected'; else $d54 = '';
if($data5=='5') $d55 = ' selected'; else $d55 = '';
echo "<table border=0 cellspacing=0 cellpadding=0><tr><td><span class=table_inside_small>Code !name</span><br>
<input type=text class=xbox name=cname value=\"".htmlspecialchars($ref)."\"><br></td><td width=10><img src=1.gif width=10><br></td><td><span class=table_inside_small>Link Style</span><br><select class=xbox name=data5>";
if(!$data3 && !$data4) echo "<option value=1$d51>rem.php?u=1a2b3c4";
echo "<option value=2$d52>rem.php?c=$c&u=1a2b3c4<option value=3$d53>rem.php?u=$c,1a2b3c4<option value=4$d54>rem.php?x=$c&l=2&[email protected]<option value=5$d55>rem.php?x=$c,2,[email protected]</select><br></td></tr></table>
<img src=1.gif height=10><br>";
} elseif($typ<>'date'&&$typ<>'dateadd'&&$typ<>'numsubs') {
echo " <span class=table_inside_small>Code !name</span><br>
<input type=text class=xbox name=cname value=\"".htmlspecialchars($ref)."\"><br>
<img src=1.gif height=10><br>";
}
// extra stuff for certain types
switch($typ){
case (substr($typ,0,5) == 'field'): echo "<span class=table_inside_small>Default output (optional)</span><br>
<input type=text class=xbox name=data1 value=\"".htmlspecialchars($data1)."\"><br>
<imt src=1.gif height=10><br>\n";
break;
case 'fname':
if($data2) $data2chk = ' checked'; else $data2chk = '';
echo "<span class=table_inside_small>No first name output (optional)</span><br>
<input type=text class=xbox name=data1 value=\"".htmlspecialchars($data1)."\"><br>
<img src=1.gif height=10><br>
<input type=checkbox class=chkbox_left name=data2 value=1$data2chk><span class=table_inside_small> Capitalize, ie \"John\"</span><br>
<img src=1.gif height=10><br>\n";
break;
case 'lname':
if($data2) $data2chk = ' checked'; else $data2chk = '';
echo "<span class=table_inside_small>No last name output (optional)</span><br>
<input type=text class=xbox name=data1 value=\"".htmlspecialchars($data1)."\"><br>
<img src=1.gif height=10><br>
<input type=checkbox class=chkbox_left name=data2 value=1$data2chk><span class=table_inside_small> Capitalize, ie \"Doe\"</span><br>
<img src=1.gif height=10><br>\n";
break;
case 'fullname':
if($data2) $data2chk = ' checked'; else $data2chk = '';
echo "<span class=table_inside_small>No name output (optional)</span><br>
<input type=text class=xbox name=data1 value=\"".htmlspecialchars($data1)."\"><br>
<img src=1.gif height=10><br>
<input type=checkbox class=chkbox_left name=data2 value=1$data2chk><span class=table_inside_small> Capitalize, ie \"John Doe\"</span><br>
<img src=1.gif height=10><br>\n";
break;
case 'remove':
if($data3) $data3chk = ' checked'; else $data3chk = '';
if($data4) { $dummy2chk = ' checked'; $dummychk = ''; } else { $dummy2chk = ''; $dummychk = ' checked'; }
echo "<span class=table_inside_small>Remove Text (optional, a line break or <b><br></b> and the remove link is added to this when code is used)</span><br>
<textarea class=xbox name=data1 cols=90 rows=4>$data1</textarea><br>
<img src=1.gif height=10><br>
<span class=table_inside_small>Remove HTML Link Title</span><br>
<input type=text class=xbox size=40 name=data2 value=\"".htmlspecialchars($data2)."\"><br>
<img src=1.gif height=10><br>
<input type=checkbox class=chkbox_left name=data3 value=1$data3chk><span class=table_inside_small> One-click Remove (No \"Remove Confirm\" Custom HTML, just \"Remove Success\")</span><br>
<input type=checkbox class=chkbox_left name=dummy value=1$dummychk onclick=\"if(this.checked){ code_frm.dummy2.checked=0; } else { code_frm.dummy2.checked=1; code_frm.data4.focus(); } return true;\"><span class=table_inside_small> Remove user from list mailed-to only</span><br>
<input type=checkbox class=chkbox_left name=dummy2 value=1$dummy2chk onclick=\"if(this.checked){ code_frm.dummy.checked=0; code_frm.data4.focus(); } else { code_frm.dummy.checked=1; } return true;\"><span class=table_inside_small> Remove user from multiple lists. Users are removed from the mailed-to list, utilizing it's Custom HTML, as well as these lists (separate by commas, * = all) </span><input type=text class=xbox size=6 name=data4 value=\"".htmlspecialchars($data4)."\"><br><img src=1.gif height=10><br>
";
break;
case 'confirm':
echo "<span class=table_inside_small>Confirm Text (optional, a line break <b><br></b> and the confirmation link is added to this when code is used)</span><br>
<textarea class=xbox name=data1 cols=90 rows=4>$data1</textarea><br>
<img src=1.gif height=10><br>
<span class=table_inside_small>Confirmation HTML Link Title</span><br>
<input type=text class=xbox size=40 name=data2 value=\"".htmlspecialchars($data2)."\"><br>
<img src=1.gif height=10><br>";
break;
case 'remcnfht':
echo "<span class=table_inside_small>Remove Button Text</span><br>
<input type=text class=xbox name=data1 cols=90 value=\"".htmlspecialchars($data1)."\"><br>
<img src=1.gif height=10><br>";
break;
case 'text':
echo "<span class=table_inside_small>Custom Text (Max 65000+ chars)</span><br>
<textarea class=xbox name=data1 style=\"width: 510px\" rows=8>$data1</textarea><br>
<img src=1.gif height=10><br>";
if($data2=='1') $d2chk = ' checked'; else $d2chk = '';
echo "<input class=chkbox name=data2 type=checkbox value=1$d2chk> <span class=table_inside_normal>Do not translate line breaks to <br> in HTML messages.<br>
<img src=1.gif height=10><br>";
break;
case 'dateadd':
case 'date':
if(!$data2 || !is_numeric($data2)) $data2 = '0'; if(!$data3 || !is_numeric($data3)) $data3 = '0'; if(!$data4 || !is_numeric($data4)) $data4 = '0';
$datex = date($data1,mktime($dar[0],$dar[1],$dar[2],$dar[3]+$data3,$dar[4]+$data2,$dar[5]+$data4));
echo "<table border=0 cellspacing=0 cellpadding=0><tr><td valign=top class=table_inside_small>Code !name<br>
<input type=text class=xbox name=cname value=\"".htmlspecialchars($ref)."\"><br></td><td width=10><img src=1.gif height=10><br></td>
<td valign=top class=table_inside_small>Date Format String (ie. <b>m/d/y</b>)<br>
<input type=text class=xbox name=data1 value=\"".htmlspecialchars($data1)."\" size=30><br></td><td width=10><img src=1.gif height=10><br></td><td valign=top class=table_inside_small>Offset (ie. <b>0</b>,<b>5</b>,<b>-5</b>)<br>Days <input size=2 type=text class=xbox name=data2 value=\"".htmlspecialchars($data2)."\" style=\"width: 24px\"> Months <input size=2 type=text class=xbox name=data3 value=\"".htmlspecialchars($data3)."\" style=\"width: 24px\"> Years <input size=2 type=text class=xbox name=data4 value=\"".htmlspecialchars($data4)."\" style=\"width: 24px\"></td></tr></table>
<img src=1.gif height=10><br>";
if($data1) echo " <span class=table_inside_small>Example</span><br>
<font size=2 face=helvetica><b>$datex</b></font><br>
<img src=1.gif height=10><br>";
break;
case 'link2html':
echo "<span class=table_inside_small>Text above link (optional, a line break <b><br></b> and the link is added to this when code is used)</span><br>
<textarea class=xbox name=data1 cols=90 rows=4>$data1</textarea><br>
<img src=1.gif height=10><br>
<span class=table_inside_small>HTML Link Title</span><br>
<input type=text class=xbox size=40 name=data2 value=\"".htmlspecialchars($data2)."\"><br>
<img src=1.gif height=10><br>";
break;
case 'numsubs':
if(!$data1||!is_numeric($data1)) $data1 = 0;
echo "<table border=0 cellspacing=0 cellpadding=0><tr><td valign=top class=table_inside_small>Code !name<br>
<input type=text class=xbox name=cname value=\"".htmlspecialchars($ref)."\"><br></td><td width=10><img src=1.gif height=10><br></td>
<td valign=top class=table_inside_small>Offset (ie. <b>500</b>,<b>-500</b>)<br><input size=2 type=text class=xbox name=data1 value=\"".htmlspecialchars($data1)."\" style=\"width: 48px\"><br></td></tr></table>
<img src=1.gif height=10><br>";
}
if($add){ $btxt = 'Cancel'; $bsiz = '60'; }
if($edit){ $btxt = 'Back to Codes'; $bsiz = '100'; }
echo "
<input type=hidden name=list value=$list>
<!-- <input type=hidden name=typ value=$typ> -->
<input type=hidden name=save value=>