#!/usr/bin/perl # MemberManagerPro is copyright 2001 by Internalysis, all rights reserved. # Purchasing this script allows you to install and use it on ONE website for ONE client # You may not redistribute, sell, make copies, post for archival or download purposes or in any other way # violate the copyright of this application. Basically, if you want to make money off this script, let me # know and we'll both benefit. (I'll support your customers, as well as keep them up to date on upgrades and # you make an easy commission for doing next to no work :) # If you need help installing or configuring this script, please feel free to contact me, Marc Bissonnette, at # dragnet@internalysis.com # IMPORTANT: READ ALL THE COMMENTS IN THIS SCRIPT, ESPECIALLY THOSE IN THE &GetMembers SUBROUTINE! Customizing the display # of this CGI is fairly straightforward, but you need to understand what to edit (especially since editing one section will # affect another. # The name of the file containging your member list. If this is not in the same directory # as the CGI, include the full path $memberfile="memberfile.txt"; # The header file to display above the CGI-Generated Content $header="memberhead.html"; # The footer file to display below the CGI-Generated Content $footer="memberfoot.html"; # The URL of the CGI script $cgiurl="http://www.internalysis.com/memberpro/membermanagerprodemo.cgi"; # The name of your site. Used to create sentances like "Choose you you wish to display the $sitename member list $sitename="MemberManager Pro Demo"; # The subroutine library included in the download require '../cgi-bin/cgi-lib.pl'; # This helps display errors to your browser instead of the error log to make debugging easier use CGI::Carp qw(fatalsToBrowser); # Get content, if any, from the browser &ReadParse; # Check to see how to proceed &Handling; sub Handling { if (!$in{submit}) { &Default; } elsif ($in{method} eq "name" && $in{submit} eq "Continue") { &ShowAll; } elsif ($in{method} ne "name" && $in{submit} eq "Continue") { &ChoiceParse; exit; } elsif ($in{submit} eq "Show Members") { &ShowFiltered; exit; } } sub ChoiceParse { # This subroutine creates the drop-down menus for the filter choices. Edit at your own risk (You shouldn't have to) print &PrintHeader; &HeaderFile; print "
\n"; print "Please choose how you wish to filter the $sitename member list by $in{method}:
"; print "\n"; print "\n\n"; &FooterFile; exit; } sub ShowFiltered { # This subroutine displays the final content, based on the user's selection # This gets the memberlist. READ THE COMMENTS IN THIS SUBROUTINE &GetMembers; print &PrintHeader; &HeaderFile; print "\n"; print "\n"; $method=$in{method}; print "\n"; $count=0; print "\n"; foreach $key (sort keys %master) { next if ($$key{$method} ne $in{filter}); $$key{$method}="".$$key{$method}.""; if ($count==0) {print "\n";} # This is the line that prints the table row to the browser. If you've modified the definitions at the end of this script, you'll need to add, delete or edit these entries, as well print "\t\n"; # The value of $count is the number of columns displayed in the output, plus one. By default, it's two columns. If you want more, increase the value of count. # For example, if you want a four column layout, change the value of $count to 3 if ($count==1) { print "\n"; $count=0; } else { ++$count; } } print "

Members in $in{filter}

$$key{name}
$$key{title}
$$key{company}
$$key{address}
$$key{suite}
$$key{city}
$$key{province}
$$key{postal}
$$key{country}
$$key{phone}
$$key{fax}
$$key{email}
$$key{url}
\n"; &FooterFile; } sub Default { # This subroutine displays the initial choice menu print &PrintHeader; &HeaderFile; print "
\n"; print "Please choose how you wish to display the $sitename member list:
\n\n"; &FooterFile; } sub ShowAll { # This subroutine displays the entire contents of your memberlist. # This gets the memberlist. READ THE COMMENTS IN THIS SUBROUTINE &GetMembers; print &PrintHeader; &HeaderFile; print "\n"; print "\n"; $count=0; print "\n"; foreach $key (sort keys %master) { if ($count==0) {print "\n";} # This is the line that prints the table row to the browser. If you've modified the definitions at the end of this script, you'll need to add, delete or edit these entries, as well print "\t\n"; # The value of $count is the number of columns displayed in the output, plus one. By default, it's two columns. If you want more, increase the value of count. # For example, if you want a four column layout, change the value of $count to 3 if ($count==1) { print "\n"; $count=0; } else { ++$count; } } print "
$$key{name}
$$key{title}
$$key{company}
$$key{address}
$$key{suite}
$$key{city}
$$key{province}
$$key{postal}
$$key{country}
$$key{phone}
$$key{fax}
$$key{email}
$$key{url}
\n"; &FooterFile; } sub HeaderFile { open (HEADER, "$header") || &CgiError ("Cannot open $header $!"); while (
) { print $_; } close HEADER; } sub FooterFile { print "

MemberManager Pro is © 2001 InternAlysis. All rights reserved.

\n"; open (FOOTER, "$footer"); while (