Annotation of register/prgsrc/register.cgi, revision 1.14
1.1 boris 1: #!/usr/bin/perl
2:
3: =pod
4:
5: =head1 NAME
6:
7: register.cgi - a universal script for club regiter
8:
9: =head1 SYNOPSIS
10:
11: register.cgi?[I<options>]
12:
13: =head1 DESCRIPTION
14:
15: The script draws the hierarchy in the form suitable for WWW
16:
17: =head1 AUTHOR
18:
19: Boris Veytsman
20:
21: =head1 DATE
22:
1.14 ! boris 23: $Date: 2002/11/04 05:02:13 $
1.1 boris 24:
25: =head1 REVISION
26:
1.14 ! boris 27: $Revision: 1.13 $
1.2 boris 28:
29: =cut
30:
31:
32: ###################################################
33: # Starting up
34: ###################################################
35:
36: use strict;
1.6 boris 37: use vars qw(%ENV);
1.2 boris 38: use CGI qw(:standard);
39: use DBI;
40: use POSIX qw(locale_h);
41:
42: setlocale(LC_CTYPE,'russian');
1.6 boris 43: $ENV{'LANG'}='ru_RU.KOI8-R';
1.11 boris 44: my ($SENDMAIL) = "mail";
1.7 boris 45: my $TO = 'borisv@lk.net, igra@gorlovka.net, erudit@mail.od.ua';
1.2 boris 46: my $FROM = 'borisv@lk.net';
47:
1.14 ! boris 48: my $date='$Date: 2002/11/04 05:02:13 $';
1.3 boris 49: $date =~ s/[^ ]* ([^ ]*) .*/$1/;
50:
51:
1.2 boris 52: my $dbh = DBI->connect("DBI:mysql:chgk", "piataev", "")
53: or do {
54: print h1("Временные проблемы") . "База данных временно не
55: работает. Заходите попозже.";
56: print &Include_virtual("../dimrub/db/reklama.html");
57: print end_html;
58: die "Can't connect to DB chgk\n";
59: };
60:
1.10 boris 61: print header(-charset=>'koi8-r');
1.2 boris 62:
63:
64: ##################################################
65: # Printing top
66: ##################################################
67: print start_html(-"title"=>'Register of Clubs',
68: -author=>'borisv@lk.net',
69: -background=>"../images/map.jpg");
70: print &Include_virtual("../dimrub/db/reklama.html");
71: print <<END;
72: <table>
73: <tr>
74: <td background=../images/compass.gif valign=top>
75: END
76:
77: ################################################
78: # NAVIGATION PANEL
79: ################################################
80:
81: my $self=url();
82:
83:
84:
85: ###############################################
86: # The navigation panel has three special lines
87: ###############################################
88: print <<END;
1.13 boris 89: <ul>
90: <li><a href="$self">Home</a></li>
91: <li><a href="$self?rid=1&level=1000&clubs=0">Все регионы</a></li>
92: <li><a href="$self?rid=1&level=1000&clubs=1">Все клубы</a></li>
93: <li><a href="$self?addclub=1">Добавить клуб</a></li>
94: <li><a href="$self?whoiswho=1">Кто есть кто</a></li>
1.2 boris 95: END
96:
97: #################################################
98: # And the navpanel itself
99: ##################################################
100:
1.13 boris 101: print ListRegions(dbh=>$dbh,rid=>1,level=>1,tag=>'li',
1.2 boris 102: self=>$self);
103:
104: print <<END;
1.13 boris 105: </ul>
1.2 boris 106: END
107:
108:
109:
110: print <<END;
111: </td>
112: <td width=100% valign=top>
113: END
114:
115:
116: ######################################################
117: # MAIN PANEL
118: ######################################################
119:
120: #
121: # First, we introduce ourselves
122: #
123: print <<END;
124:
1.4 boris 125: <h1 align=center>
126: Журнал "Игра"<br>
127: и<br>
1.12 boris 128: <a href="/znatoki/klub/znat.html"><img
129: ismap border=0 src= "../images/logo.gif"
1.2 boris 130: alt="Интернет Клуб Что? Где? Когда?" width=319 height=27></a>
1.4 boris 131: <br>ПРЕДСТАВЛЯЮТ<br>
132: Регистр Клубов Интеллектуальных Игр
1.2 boris 133: </h1>
134: END
135:
136: #
137: # Now check the parameters...
138: #
139: if (param('rid')) {
140: my $rid = param('rid');
141: $rid =~ s/(\d*)/$1/;
142: print ListRegions(dbh=>$dbh,rid=>$rid,
143: level=>param('level'),
144: clubs=>param('clubs'),
145: tag=>'h2',
146: self=>$self);
147: } elsif (param('cid')) {
148: my $cid = param('cid');
149: $cid =~ s/(\d*)/$1/;
150: print ClubInfo(dbh=>$dbh,cid=>$cid,
151: self=>$self);
1.7 boris 152: } elsif (param('pid')) {
153: my $pid = param('pid');
154: $pid =~ s/(\d*)/$1/;
155: print ListPerson(dbh=>$dbh,pid=>$pid,
156: self=>$self,
157: positions=>1,
158: displayperson=>1);
159: } elsif (param('whoiswho')) {
160: print PrintWhoIsWho(dbh=>$dbh,
161: self=>$self);
1.2 boris 162: } elsif (param('addclub')) {
163: print AddClub();
164: } elsif (param('Submit')) {
165: print SendLetter();
1.3 boris 166: } else {
167: print <<END;
168: <dl>
169: <dt><a href="$self?rid=1&level=1000&clubs=0">Все регионы</a></dt>
170: <dt><a href="$self?rid=1&level=1000&clubs=1">Все клубы</a></dt>
171: <dt><a href="$self?addclub=1">Добавить клуб или изменить сведения
172: о клубе</a></dt>
1.7 boris 173: <dt><a href="$self?whoiswho=1">Кто есть кто</a></dt>
1.3 boris 174: </dl>
1.9 boris 175: <p align=center>
176: END
177: print &Include_virtual("../boris/register/regions.html");
178: print <<END;
179: </p>
1.3 boris 180: END
1.4 boris 181: }
1.3 boris 182:
183: ####################################################################
184: # And the bottom of the page
185: ###################################################################
1.8 boris 186: my $sth=$dbh->prepare("select count(*) from Clubs");
187: $sth->execute;
188: my ($count) = $sth->fetchrow_array;
189: $sth->finish;
1.3 boris 190:
191: print "<p align=center>";
1.8 boris 192: print "Всего клубов: $count<br>\n";
1.3 boris 193: print "Эту страничку посмотрели ";
194: print `/home/piataev/public_html/cgi-bin/counter.sh /znatoki/cgi-bin/register.cgi`;
195: print " раз(а)</p>\n";
196:
197: print <<END;
198: <hr>
199: <address>
200: <img width = 60 height = 80 src="../images/owl.gif" alt = "owl">
201: <a href="http://users.lk.net/~borisv">
202: Boris Veytsman</a>, $date
203: </address>
204: </body>
205: </html>
206: END
207:
1.2 boris 208:
209: print <<END;
210: </td>
211: </tr>
212: </table>
213: END
214:
215: print end_html;
216:
217: exit 0;
218:
219: ###################################################
220: # Parsing included file
221: ##################################################
222: sub Include_virtual {
223: my ($fn, $output) = (@_, '');
224:
225: open F , $fn
226: or return; #die "Can't open the file $fn: $!\n";
227:
228: while (<F>) {
229: if (/<!--#include/o) {
230: s/<!--#include virtual="\/(.*)" -->/&Include_virtual($1)/e;
231: }
232: if (/<!--#exec/o) {
233: s/<!--#exec.*cmd\s*=\s*"([^"]*)".*-->/`$1`/e;
234: }
235: $output .= $_;
236: }
237: return $output;
238: }
239:
240:
241:
242: #############################################################
243: # Listing the given region and optionally its children
244: #############################################################
245:
246:
247: sub ListRegions {
248: my %args = @_;
249: my $sth = $args{'dbh'}->prepare("
250: SELECT Name FROM Regions WHERE RID=$args{'rid'}");
251: $sth->execute;
252: if (!$sth->rows) {
253: return "";
254: }
255: my ($name)=$sth->fetchrow_array;
1.4 boris 256: $name="<a href=\"$self?rid=$args{'rid'}&level=100&clubs=1\">$name</a>";
1.2 boris 257: my $result="<$args{'tag'}>$name</$args{'tag'}>\n";
258: if ($args{'level'}>0) { # Print children
259:
260: # Frist, we print clubs
261: if ($args{'clubs'}) {
1.10 boris 262: $result .= ListRegionURLs(%args);
1.2 boris 263: $result .= ListClubs(%args);
264: }
265: $sth=$args{'dbh'}->prepare("
266: SELECT Child FROM RegionRegion WHERE Parent=$args{'rid'}");
267: $sth->execute;
268: if ($sth->rows) {
269: my @kids=();
270: while (my ($kid)=$sth->fetchrow_array) {
271: push @kids,"rid=$kid";
272: }
273: my $clause = join(' OR ', @kids);
1.13 boris 274: $result .= "<ul>\n";
1.2 boris 275: $sth=$args{'dbh'}->prepare("
276: SELECT rid FROM Regions WHERE $clause ORDER BY Name");
277: $sth->execute;
278: while (my ($kid)=$sth->fetchrow_array) {
279: $result .= ListRegions(
280: %args,'rid'=>$kid,
281: 'level'=>$args{'level'}-1,
1.13 boris 282: 'tag'=>'li');
1.2 boris 283: }
1.13 boris 284: $result .= "</ul>\n";
1.2 boris 285: }
286: }
287: return $result;
288: }
289:
290: ############################################################
1.10 boris 291: # List the URLs of a given region
292: ###########################################################
293: sub ListRegionURLs {
294: my %args = @_;
295: my $sth;
296: $sth = $args{'dbh'}->prepare("
297: SELECT URL FROM Regions WHERE rid=$args{'rid'} and NOT ISNULL(URL)");
298:
299: $sth->execute;
300:
301: if (!$sth->rows) {
302: return "";
303: }
304:
305: my $result;
306:
307: $result=<<END;
308: <dl><dt>Странички:</dt>
309: <dd><dl>\n
310: END
311:
312: while (my ($string)=$sth->fetchrow_array) {
313: $string=htmlize($string);
314: $result .= p($string);
315: }
316: $result .= "</dl></dd></dl>\n";
317: return $result;
318: }
319:
320:
321: ############################################################
1.4 boris 322: # List the clubs of a given region or a given association
1.2 boris 323: ###########################################################
324: sub ListClubs {
325: my %args = @_;
326: my $sth;
327: if ($args{'cid'}) {
328: $sth = $args{'dbh'}->prepare("
329: SELECT Child FROM ClubClub WHERE Parent=$args{'cid'}");
330: } else {
331: $sth = $args{'dbh'}->prepare("
332: SELECT cid FROM ClubRegion WHERE rid=$args{'rid'}");
333: }
334:
335: $sth->execute;
336:
337: if (!$sth->rows) {
338: return "";
339: }
340:
341: my $result;
342:
343: if ($args{'cid'}) {
344:
345: $result=<<END;
346: <h3>Клубы:</h3>
1.13 boris 347: <ul>\n
1.2 boris 348: END
349: } else {
350:
351: $result=<<END;
1.13 boris 352: <ul>\n
1.2 boris 353: END
354: }
355: my @clubs=();
356: while (my ($club)=$sth->fetchrow_array) {
357: push @clubs,"cid=$club";
358: }
359: my $clause = join(' OR ', @clubs);
360: $sth=$args{'dbh'}->prepare("
361: SELECT cid, Name FROM Clubs WHERE $clause ORDER BY Name");
362: $sth->execute;
363: while (my ($cid,$Name)=$sth->fetchrow_array) {
1.13 boris 364: $result .= li("<a href=\"$self?cid=$cid\">$Name</a>\n");
1.2 boris 365: }
1.13 boris 366: $result .= "</ul>\n";
1.2 boris 367: }
368:
1.4 boris 369:
370: ############################################################
371: # List the association a given club belongs to
372: ###########################################################
373: sub ListParents {
374: my %args = @_;
375: my $sth;
376:
377: $sth = $args{'dbh'}->prepare("
378: SELECT Parent FROM ClubClub WHERE Child=$args{'cid'}");
379:
380: $sth->execute;
381:
382: if (!$sth->rows) {
383: return "";
384: }
385:
386: my $result;
387:
388: $result=<<END;
389: <h3>Коллективный член ассоциаций:</h3>
1.7 boris 390: <dl>\n
1.4 boris 391: END
392:
393: my @clubs=();
394: while (my ($club)=$sth->fetchrow_array) {
395: push @clubs,"cid=$club";
396: }
397: my $clause = join(' OR ', @clubs);
398: $sth=$args{'dbh'}->prepare("
399: SELECT cid, Name FROM Clubs WHERE $clause ORDER BY Name");
400: $sth->execute;
401: while (my ($cid,$Name)=$sth->fetchrow_array) {
402: $result .= dt("<a href=\"$self?cid=$cid\">$Name</a>\n");
403: }
404: $result .= "</dl></dd></dl>\n";
405: }
406:
1.2 boris 407: #############################################################
408: # The longest subroutine in the list...
409: #############################################################
410: sub ClubInfo {
411: my %args = @_;
412: my $sth = $args{'dbh'}->prepare("
413: SELECT * FROM Clubs WHERE cid=$args{'cid'}");
414: $sth->execute;
415:
416: if (!$sth->rows) {
417: return "";
418: }
419:
420: my $result="";
421: my $club=$sth->fetchrow_hashref;
422: $result .= h2($club->{'Name'});
423:
424: if (my $string=$club->{'Address'}) {
425: $string =~ s/\n/<br>\n/g;
426: $result .= h3('Адрес')."\n".p($string);
427: }
428:
429: if (my $string=$club->{'URL'}) {
430: $string = htmlize($string);
431: $result .= h3('Домашняя страничка')."\n".p($string);
432: }
433:
434: if (my $string=$club->{'Phone'}) {
435: $result .= h3('Телефон')."\n".p($string);
436: }
437:
438: if (my $string=$club->{'Fax'}) {
439: $result .= h3('Факс')."\n".p($string);
440: }
441:
442: if (my $string=$club->{'Email'}) {
443: $string = htmlize($string,'mailto:');
444: $result .= h3('E-mail')."\n".p($string);
445: }
446:
447:
448: $result .= ListPeople(%args);
449:
1.4 boris 450: $result .= ListParents(%args);
451:
1.2 boris 452: $result .= ListClubs(%args);
453:
1.4 boris 454:
1.2 boris 455: if (my $string=$club->{'DoB'}) {
456: $result .= h3('История создания клуба')."\n".p($string);
457: }
458:
459: if (my $string=$club->{'Sponsor'}) {
460: $result .= h3('Спонсор')."\n".p($string);
461: }
462:
463: if (my $string=$club->{'Meetings'}) {
464: $result .= h3('Форма деятельности клуба')."\n".p($string);
465: }
466:
467: if (my $string=$club->{'AdultTeams'}) {
468: $result .= h3('Взрослые команды')."\n".p($string);
469:
470: }
471:
472: if (my $string=$club->{'KidTeams'}) {
473: $result .= h3('Детские команды')."\n".p($string);
474:
475: }
476:
477: if (my $string=$club->{'ForeignFests'}) {
478: $result .= h3('Иногородние фестивали, традиционно посещаемые командами клуба')."\n".p($string);
479:
480: }
481:
482: if (my $string=$club->{'Braglist'}) {
483: $result .= h3('Высшие достижения команд клуба')."\n".p($string);
484:
485: }
486:
487: if (my $string=$club->{'OwnFests'}) {
488: $result .= h3('Фестивали, организуемые клубом')."\n".p($string);
489:
490: }
491:
492:
493: return $result;
494:
495: }
496:
497:
498: ##############################################################
499: # Adding a href=... The second optional argument may be
500: # 'mailto:'
501: ##############################################################
502:
503: sub htmlize {
504: my($string,$proto)=@_;
505: $string =~ s/^\s+//;
506: $string =~ s/\s+$//;
507: my @entities = split /\s+/, $string;
508: my @hrefs=map {"<a href=\"$proto$_\">$_</a>"} @entities;
509: return join(", ",@hrefs);
510: }
511:
512:
513: ##############################################################
514: # List the bosses....
515: ##############################################################
516: sub ListPeople {
517: my %args = @_;
518: my $sth = $args{'dbh'}->prepare("
519: SELECT pid,Position FROM ClubPeople WHERE cid=$args{'cid'} ORDER BY Weight DESC");
520: $sth->execute;
521:
522: if (!$sth->rows) {
523: return "";
524: }
525:
526: my $result=h3('Руководство');
527: while (my($pid,$Position)=$sth->fetchrow_array) {
528: $result .= h4($Position);
529: $result .= ListPerson(%args,pid=>$pid);
530: }
531: return $result;
532: }
533:
534: ##############################################################
535: # Listing one person
536: #############################################################
537: sub ListPerson {
538: my %args=@_;
539: my $sth = $args{'dbh'}->prepare("
540: SELECT * FROM People WHERE pid=$args{'pid'}");
541: $sth->execute;
542:
543: if (!$sth->rows) {
544: return "";
545: }
546:
1.7 boris 547: my $result="";
1.2 boris 548: my @entries=();
549: my $person=$sth->fetchrow_hashref;
550: if (my $string = $person->{'Name'}) {
1.7 boris 551: if ($args{'displayperson'}) {
552: $result=h2($string);
553: } else {
554: push @entries,
555: "<a href=\"$args{'self'}?pid=$args{'pid'}\">$string</a>";
556: }
1.2 boris 557: }
558: if (my $string=$person->{'Address'}) {
559: push @entries, "Адрес: $string";
560: }
561:
562: if (my $string=$person->{'URL'}) {
563: $string = htmlize($string);
1.14 ! boris 564: push @entries, "Домашняя страничка: $string";
1.2 boris 565: }
566:
567: if (my $string=$person->{'Phone'}) {
568: push @entries, "Телефон: $string";
569: }
570:
571: if (my $string=$person->{'Fax'}) {
572: push @entries, "Факс: $string";
573: }
574:
575: if (my $string=$person->{'Email'}) {
576: $string = htmlize($string,'mailto:');
577: push @entries, "E-mail: $string";
578: }
579:
1.7 boris 580: $result.=p(join('; ',@entries).".");
581: if ($args{'positions'}) {
582: my $sth=$dbh->prepare("SELECT cid,Position FROM ClubPeople
583: WHERE pid=$args{'pid'} ORDER by Weight");
584: $sth->execute;
585: $result .= "<dl>\n";
586: while (my ($cid,$Position)=$sth->fetchrow_array) {
587: my $sth1=$dbh->prepare("Select Name from Clubs where
588: cid=$cid");
589: $sth1->execute;
590: my ($Name)=$sth1->fetchrow_array;
591: $sth1->finish;
592: $result .= "<dd><strong>$Position,</strong> ";
593: $result .= "<a href=\"$args{self}?cid=$cid\">$Name</a></dd>\n";
594: }
595: $sth->finish;
596: $result .= "</dl>\n";
597: }
598: return $result;
1.2 boris 599:
600: }
601:
602:
603: #########################################################
604: # Adding club
605: #########################################################
606: sub AddClub {
607: my $result=h2("Добавить клуб или изменить информацию о клубе");
608:
1.3 boris 609:
1.2 boris 610: $result .= start_form;
1.3 boris 611:
612: $result .= h3("Контактная информация");
613: $result .= p("Адрес, телефон, email и т.д. ниже -- НЕ адреса руководства
614: клуба (их Вы введёте ниже),
615: а официальные адреса самого клуба. Если отдельного адреса,
616: телефона, и т.д. у клуба нет, просто оставьте
617: поля пустыми");
1.2 boris 618: $result .= table(Tr(td(["Название клуба",
619: textfield(-name=>'Name',
620: -size=>60)])),
1.3 boris 621: Tr(td(["Официальный адрес клуба",
1.2 boris 622: textarea(-name=>'Address',
623: -rows=>5,
624: -columns=>60)])),
1.3 boris 625: Tr(td(["Страничка клуба",
1.2 boris 626: textfield(-name=>'URL',
627: -size=>60)])),
1.3 boris 628: Tr(td(["Телефон клуба",
1.2 boris 629: textfield(-name=>'Phone',
630: -size=>60)])),
1.3 boris 631: Tr(td(["Факс клуба",
1.2 boris 632: textfield(-name=>'Fax',
633: -size=>60)])),
1.3 boris 634: Tr(td(["E-mail клуба",
1.2 boris 635: textfield(-name=>'Email',
636: -size=>60)])),
1.3 boris 637: );
638: $result .= h3("Руководство клуба");
639: $result .= p("Адреса и телефоны ниже будут опубликованы. Если Вы не хотите
640: афишировать чьи-то адреса и телефоны, просто оставьте соответствующие поля
641: пустыми");
642: $result .= "<ol>\n";
643: for(my $i=1;$i<=5;$i++) {
644: $result .=li;
645: $result .= table(
646:
647: Tr(td(["Должность",
648: textfield(-name=>"Position$i",
649: -size=>50)])),
650: Tr(td(["ФИО",
651: textfield(-name=>"Name$i",
652: -size=>50)])),
653: Tr(td(["Адрес",
654: textarea(-name=>"Address$i",
655: -columns=>50,
656: -rows=>5)])),
657: Tr(td(["Телефон",
658: textfield(-name=>"Phone$i",
659: -size=>50)])),
660: Tr(td(["Факс",
661: textfield(-name=>"Fax$i",
662: -size=>50)])),
663: Tr(td(["Email",
664: textfield(-name=>"Email$i",
665: -size=>50)])),
666: Tr(td(["Домашняя страничка",
667: textfield(-name=>"URL$i",
668: -size=>50)])),
669: );
670: }
671: $result .= "</ol>\n";
672: $result .= h3("Ассоциации и объединения");
673: $result .= table(
1.2 boris 674: Tr(td(["Ассоциации, членом котрых является клуб",
675: textarea(-name=>'Parents',
676: -rows=>5,
677: -columns=>60)])),
678: Tr(td(["Для ассоциаций: коллективные члены ассоциации",
679: textarea(-name=>'Members',
680: -rows=>5,
681: -columns=>60)])),
1.3 boris 682: );
683: $result .= h3("Жизнь клуба");
684: $result .= table(
1.2 boris 685: Tr(td(["История создания клуба",
686: textarea(-name=>'DoB',
687: -rows=>5,
688: -columns=>60)])),
689: Tr(td(["Основной спонсор клуба",
690: textarea(-name=>'Sponsor',
691: -rows=>5,
692: -columns=>60)])),
693: Tr(td(["Основные формы деятельности клуба",
694: textarea(-name=>'Meetings',
695: -rows=>5,
696: -columns=>60)])),
697: Tr(td(["Взрослые команды",
698: textarea(-name=>'AdultTeams',
699: -rows=>5,
700: -columns=>60)])),
701: Tr(td(["Детские команды",
702: textarea(-name=>'KidTeams',
703: -rows=>5,
704: -columns=>60)])),
705: Tr(td(["Иногородние фестивали, на которые ездят команды клуба",
706: textarea(-name=>'ForeignFests',
707: -rows=>5,
708: -columns=>60)])),
709: Tr(td(["Высшие достижения команд клуба",
710: textarea(-name=>'Braglist',
711: -rows=>5,
712: -columns=>60)])),
713: Tr(td(["Фестивали, которые организовывает клуб",
714: textarea(-name=>'OwnFests',
715: -rows=>5,
716: -columns=>60)])),
1.3 boris 717: );
718:
719: $result .= h3("География клуба (для будущей карты)");
720: $result .= table(
721: Tr(td(["Долгота",
722: textfield(-name=>"Longitude",
723: -size=> 60)])),
724: Tr(td(["Широта",
725: textfield(-name=>"Latitude",
726: -size=> 60)])),
727: );
728:
729: $result .= h3("Дополнительные вопросы");
730: $result .= table(
731:
732: Tr(td(["Что вам больше всего нравится в журнале 'Игра'?",
733: textarea(-name=>'IgraA',
734: -rows=>5,
735: -columns=>60)])),
736: Tr(td(["Что вам больше всего не нравится в журнале 'Игра'?",
737: textarea(-name=>'IgraB',
738: -rows=>5,
739: -columns=>60)])),
740: Tr(td(["Что бы вы хотели увидеть в журнале 'Игра' - то
741: чего нет в настоящее время?",
742: textarea(-name=>'IgraC',
743: -rows=>5,
1.2 boris 744: -columns=>60)])),
1.5 boris 745: );
746:
747: $result .= h3("Кто регистрировал");
748: $result .= table(
749: Tr(td(["Имя",
750: textfield(-name=>'RegistrarName',
751: -size=>60)])),
752: Tr(td(["Email",
753: textfield(-name=>'RegistrarEmail',
754: -size=>60)])),
1.2 boris 755: );
1.3 boris 756:
757: $result .= p("Нажав кнопку 'Submit', Вы отправите Вашу регистрационную
1.4 boris 758: карточку службе поддержки регистра. Пожалуйста, подождите несколько дней, пока
759: Ваша информация будет обработана и попадёт в регистр");
1.2 boris 760: $result .= submit(-name=>'Submit');
761: $result .= end_form;
762: return $result;
763: }
764:
765: ###################################################################
766: # Sending the letter with results
767: #####################################################################
768: sub SendLetter {
1.11 boris 769: open(MAIL,"| $SENDMAIL -s 'Registracionnaya kartochka kluba' $TO");
1.3 boris 770: print MAIL <<END;
1.2 boris 771: MIME-Version: 1.0
772: Content-type: text/plain; charset=koi8-r
773:
774: END
1.3 boris 775: foreach my $key (param) {
776: my $value = param($key);
777: if ($value =~ /^\s*$/) {
778: next;
779: }
780: print MAIL "$key=$value\n\n";
781: }
782:
1.2 boris 783:
1.4 boris 784: close MAIL;
785: return p("Спасибо за регистрацию. Ваши данные приняты и после ".
786: "обработки будут внесены в базу данных");
1.2 boris 787: }
1.1 boris 788:
1.7 boris 789: ###############################################################
790: # Printing Who is Who list
791: ###############################################################
792: sub PrintWhoIsWho {
793: my %args =@_;
794: my $result = h2("Кто есть кто");
795: $result .= "\n<dl>\n";
796: my $sth = $dbh->prepare("SELECT pid,Name FROM People ORDER BY Name");
797: $sth->execute;
798: while (my($pid,$Name)=$sth->fetchrow_array) {
799: $result .= dd("<a href=\"$args{'self'}?pid=$pid\">$Name</a>");
800: $result .= "\n";
801: }
802: $sth->finish;
803: $result .= "</dl>\n";
804: return $result;
805: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>