#!/usr/bin/perl 
 
# Set short name of category (not more 8 characters)
# Short name must be the same as name of this .pl file
# e.g. file name is health.pl, short name is health
# Type of OS ( u - Unix, w - Windows)
#Walli
#$ostype="w"; 
$ostype="u"; 
#$ostype="t"; 

#Walli
$catheadt="Cut-off machines and tooling";
$catname="addmsgboard2";
$catname2="marketplace2uus";


# Setting up Classified Ads options:
# seuraavalla määritellään max postings per day
$sallittu=9;
# Set the URL of the  cgi directory where script is placed
#walli
if ($ostype ne "w") {$urlbase="http://www.tubenet.org.uk/cgi/"}
if ($ostype eq "w") {$urlbase="http://k2/scripts/"}
$htmlbase="http://www.tubenet.org.uk/";



# Set the base of the path of the directory where
# all database  files will be kept.
#walli

if ($ostype ne "w") {$basepath="/var/www/customers/tubenet/public_html/cgi/datat/"}
if ($ostype eq "w") {$basepath="/inetpub/wwwroot/"}

if ($ostype eq "w") {
require "/inetpub/scripts/html.pl";
require "/inetpub/scripts/taulukot.pl";
require "/inetpub/scripts/lajit.pl"; }

if ($ostype ne "w") {
require "/var/www/customers/tubenet/public_html/cgi/html2.pl";
require "/var/www/customers/tubenet/public_html/cgi/taulukot.pl";
require "/var/www/customers/tubenet/public_html/cgi/lajit.pl"; }






$mailprogram = "/usr/sbin/sendmail -t -oi";

#omaemail = "admin\@tubenet.org";
$omaemail = "admin\@tubenet.org";

# Set expiration period ( in days)
#$exp_period="5";
#$exptime=365;
$erotin="|";  
# number of Ads will be displays on each page
$hits =5;
$flflfl=1;
# Set allowing html tags in the ad , 1- yes,  0- no.
$htmltag=0;

# Set max length in brief descriptions
$maxadln=350;
$maxpremadln=600;



 
#How much seconds ads pages will be in cache
# You can also add to this string others tags such as 
# <meta keyword> and <title>
$scache="<meta http-equiv=\"Expires\" content=\"3000\">";
 
# Set up general html header and footer for all ad categories
$ghead=" ";
$gfoot= <<HTMLF;
<P><HR WIDTH="100%">
<CENTER><A HREF="mailto:info\@tubenet.org">email: info\@tubenet.org</A>
<BR><FONT SIZE="-1">Copyright &copy; Juha Haapala. All rights reserved.</FONT></CENTER>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<BR><BR><BR><BR><BR><BR><BR><BR><BR>.
HTMLF
 


# Using local time (local) or GMT time (gmt)
$localgmt="local";
 

############################################################
# Congratulations!  You've finished defining the variables.#
############################################################

&parse_get;
$ctmd="md";



$alue=$GET{'alue'};
$laji=$GET{'laji'};

$time_now=time; chomp($time_now);


$action=$urlbase.$catname.".pl";
$action2=$urlbase.$catname2.".pl";

#seuraava siksi jotta menee usa:han jos ei ole mitään parametrejä

$subtitle=$lajit{"$alue"};
$catheadt=$lajit{"$laji"};



$namefl="add";
# Names of database files that kept in the same directory
$filename =$basepath.$namefl.".dat";
&kirjoitafileen3("$filename");


if ($alue eq "usa") {$subtitle="USA, Canada &amp; South America";
$wallibase="http://www.tubenet.org";
}
if ($alue eq "eur") {$subtitle="Europe";
$wallibase="http://www.tubenet.org.uk"}

if ($alue eq "asi") {$subtitle="Asia &amp; Australasia";
$wallibase="http://www.tubenet.us";
}
if ($alue eq "afr") {$subtitle="Africa &amp; Middle-East";
$wallibase="http://www.tubenet.org";
}


 

&parse_form;

   


if (($GET{'md'}) and ($GET{'alue'}) and ($GET{'laji'})) {
  if  (($GET{'md'} eq "confirmaa") || ($GET{'md'} eq "addform") || ($GET{'md'} eq "addad") || ($GET{'md'} eq "confirmaa2")) {
&addstart;
} 
}


#&generalerror;
&virhemessu("general");

exit;


#XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx







sub addstart
{

    if ($GET{'md'} eq "addad") {&addad;}
    if ($GET{'md'} eq "otaprev") {&otaprev;}
    if ($GET{'md'} eq "otanext") {&otanext;}
      
    if ($GET{'md'} eq "addform") {&addform("Add");}
    if ($GET{'md'} eq "editform") {&addform("Edit");}
    if ($GET{'md'} eq "confirmaa") {&confirmaa;}
    if ($GET{'md'} eq "confirmaa2") {&confirmaa2;}
 
    if ($GET{'md'} eq "edit") {&edit;}
    if ($GET{'md'} eq "loged") {&loged;}
    exit;
}











sub getrecord
{

$file66=$basepath."usa".$FORM{'laji'}.".dat";
 open(file66, "$file66");
&lock(file66);
@lines=<file66>;
$count = $#lines+2;
#$count=66;
@lines=();
&unlock(file);
 close(file);

$ipadd=$ENV{'REMOTE_ADDR'};


$FORM{'brief'}  = 	siivoa_kommentit(\$FORM{'brief'});
$emailbrief=$FORM{'brief'};
$brief=$FORM{'brief'};

$FORM{'title'}  = 	siivoa_kommentit(\$FORM{'title'});

$FORM{'firma'}  = siivoa_otsikot(\$FORM{'firma'});
$FORM{'firma'}  = 	siivoa_kommentit(\$FORM{'firma'});

$FORM{'puhelin'}  = siivoa_otsikot(\$FORM{'puhelin'});
$FORM{'puhelin'}  = 	siivoa_kommentit(\$FORM{'puhelin'});

$FORM{'fax'}  = siivoa_otsikot(\$FORM{'fax'});
$FORM{'fax'}  = 	siivoa_kommentit(\$FORM{'fax'});

$FORM{'attn'}  = siivoa_otsikot(\$FORM{'attn'});
$FORM{'attn'}  = 	siivoa_kommentit(\$FORM{'attn'});



&somecheck;

$idmodd="";
$mjlength= length($FORM{'urlpage'});
if (($FORM{'urlpage'} =~ /^http/) and ($mjlength < 12)) {$FORM{'urlpage'} = ""};


$time_now=time;


#if ($FORM{'kumpirek'} eq "0") {$exptime="1"} else {$exptime=$time_now + 31536000}
#$exptime=$time_now + 86400;
$tamapv=date_format($time_now);
$erapaiva=date_format($exptime);

$record=$count."|".$FORM{'passw'}."|".$FORM{'title'}."|".$time_now."|".$FORM{'email'};
$record=$record."|850000000|".$FORM{'urlpage'}."|".$brief;
$record=$record."|".$ipadd."|".$namefl."|2|".$idmodd;
$record=$record."|".$FORM{'firma'}."|".$FORM{'maa'}."|".$FORM{'osavaltio'};
$record=$record."|".$FORM{'attn'}."|".$FORM{'puhelin'}."|".$FORM{'fax'}."|".$FORM{'paiva'}."|".$FORM{'kuu'}."|".
$FORM{'vuosi'}."|".$FORM{'email2'}."|usa".$FORM{'laji'}."|".$FORM{'url'}."|";

$logfilename2="$FORM{'alue'}.$FORM{'laji'}.bak";
open(lfile,">>$logfilename");
&lock(lfile);
print lfile "$record\n";
&unlock(lfile);
close(lfile);


$erapaiva=date_format($exptime);

          $viesti = "* * * * * Please save this message for future use. * * * * * \n";
$viesti=$viesti."Thank you for your interest in TubeNet. \n";
$viesti=$viesti."Your message information has been received.  \n";
$viesti=$viesti."Below please find the details of your message.\n";
$viesti=$viesti."-------------------------------------------------------------------------------------\n";
$viesti=$viesti."Company : ".$FORM{'firma'}."\n";
$viesti=$viesti."Your password : ".$FORM{'passw'}."\n";
$viesti=$viesti."Date posted : ".$tamapv."\n";
$viesti=$viesti."Expiry date : ".$erapaiva."\n";
$viesti=$viesti."Primary email address : ".$FORM{'email'}."\n";
$viesti=$viesti."Secondary email address : ".$FORM{'email2'}."\n";  
$viesti=$viesti."Category : ".$catheadt."\n";
$viesti=$viesti."Web site : ".$FORM{'urlpage'}."\n";
$viesti=$viesti."Your IP address recorded : ".$ipadd."\n";
#$viesti=$viesti."Company name : ".$FORM{'firma'}."\n";
$viesti=$viesti."Country : ".$FORM{'maa'}."\n";
if (($FORM{'maa'} eq "USA") or ($FORM{'maa'} eq "United States")) {$viesti=$viesti."State : ".$FORM{'osavaltio'}."\n"};
#$viesti=$viesti."Contact person : ".$FORM{'attn'}."\n";
#$viesti=$viesti."Phone : ".$FORM{'puhelin'}."\n";
#$viesti=$viesti."Fax : ".$FORM{'fax'}."\n\n";
#$viesti=$viesti."Short description : ".$FORM{'title'}."\n";
#$viesti=$viesti."Long description below:\n\n";
#$viesti=$viesti.$emailbrief;
#$viesti=$viesti."\n\nThank you. \n\nBest regards,\nJuha Haapala";
$viesti=$viesti."---------------------------------------------------\n";
$viesti=$viesti."TubeNet - The Site for Tube and Pipe Industries\n";
$viesti=$viesti."US site: www.tubenet.org  Asia site: www.tubenet.us\n";
$viesti=$viesti."E-mail: info\@tubenet.org\n";
$viesti=$viesti."Fax: +1-206-666-1795 (to USA)\n";
$viesti=$viesti."Fax: +358-6-3344505 (to Finland)\n";
$viesti=$viesti."Addr: Kanervatie 3, 66400 Laihia, Finland\n";
$viesti=$viesti."---------------------------------------------------\n";

if ($ostype eq "u") {
###pannaan tämä kommentiksi jotta ei lähetä mitään jonsei maksa ensin.
   open (MAIL,"|$mailprogram");
   print MAIL "To: $FORM{'email'}\n";
   print MAIL "From: $omaemail\n";
   print MAIL "Subject: Your TubeNet Message Board Posting\n";
   print MAIL "$viesti\n";
  close (MAIL);
open (MAIL,"|$mailprogram");
   print MAIL "To: $omaemail\n";
   print MAIL "From: $omaemail\n";
   print MAIL "Subject: Tubenet Message Board posting\n";
   print MAIL "$viesti\n";
  close (MAIL);
}

}









sub confirmaa
{
$ipadd=$ENV{'REMOTE_ADDR'};

$subact=$action."?$ctmd=confirmaa2&alue=$alue&laji=$laji";
&htmhead2;
&omahead;


print <<HTMLF;
<table border=0 width=400><tr><td>

<CENTER><font  face="Arial, Helvetica"   color="#ffffff"><B>Please read this agreement<BR> before continuing</B></font></CENTER><br>




<FONT SIZE="-1" color="#ffffff"  face="Arial, Helvetica">
TubeNet Registering Service is designed for professional
use only. Please note the following instructions: 
</font><table border=0>
HTMLF
print "<tr><td><FONT SIZE=\"-1\" color=\"#ffffff\"  face=\"Arial, Helvetica\">1.</font></td><td><FONT SIZE=\"-1\" color=\"#ffffff\"  face=\"Arial, Helvetica\">Message can be changed at any time from your own computer. For security reasons, you need to enter a <font color=\"#ffff00\"> password </font> when making message.</font></td></tr> ";
print "<tr><td><FONT SIZE=\"-1\" color=\"#ffffff\"  face=\"Arial, Helvetica\">2.</font></td><td><FONT SIZE=\"-1\" color=\"#ffffff\"  face=\"Arial, Helvetica\">Be extra careful with spelling of your <font color=\"#ffff00\">email address</font>. Wrong email address will bring you nothing. After you have submitted your message, the system will automatically send you a confirmation message by email. In case you don't receive this email, it's a sign that you gave a wrong email address. </font></td></tr>";
print "<tr><td><FONT SIZE=\"-1\" color=\"#ffffff\"  face=\"Arial, Helvetica\">3.</font></td><td><FONT SIZE=\"-1\" color=\"#ffffff\"  face=\"Arial, Helvetica\">On Internet, the services like TubeNet are subject to the availablility of their servers and TCP/IP technology. From time to time these servers and network are maintained which will make also downtime for TubeNet. </font></td></tr>";
print "<tr><td><FONT SIZE=\"-1\" color=\"#ffffff\"  face=\"Arial, Helvetica\">4.</font></td><td><FONT SIZE=\"-1\" color=\"#ffffff\"  face=\"Arial, Helvetica\">All spamming and misbehave will be noticed and if necessary, actions will be taken to eliminate any kind of misuse of this service. For protection against misuse and spamming, your server's IP address (<font color=\"#ffff00\">$ipadd</font>) will be recorded.</font></td></tr> ";
print "</table><P>";




print "<center><FONT SIZE=\"-1\" color=\"#ffffff\"  face=\"Arial, Helvetica\">Do you agree ?</FONT></center> ";
print "<center>";
print "<form action=\"$subact\" method=\"post\"><INPUT TYPE=\"submit\" value=\"Yes, I agree\"></FORM>";





$subact="http://www.tubenet.org";
print <<HTMLF;

<a href="http://www.tubenet.org"><FONT SIZE="+1" color="#ffff00"  face="Arial, Helvetica"><B>No, I want to go back</B></font></A><BR><br>
<FONT SIZE="-1" color="#ffffff"  face="Arial, Helvetica"><B>Click only once. This may take some time.</B></font><P><BR></center>
</TD></TR>
</TABLE>

HTMLF

&omaend;
&htmend2;
exit;
}
















sub omahead
{
print "<center>";
print "<table border=1 cellspacing=0  bgcolor=\"#000050\" width=\"70%\">";
print "<tr>";
print "<td>";
print "<table border=1 cellspacing=0   bgcolor=\"#000050\" width=\"100%\"><tr bgcolor=\"#505070\"><td bgcolor=\"#000050\" align=left>";
print "<center>";
print "<BR>";
}











 
sub addform
{

my ($kumpi) = @_;

&htmhead2;


#tällä mennään suoraan uuden lisäämiseen jos kyse ei ole editoinnista, mikä tarkistetaan tossa alapuolella
$olioikia=1;
$rivijemma="";

$kumpi = "Add";


	$rivijemma="";
	($luku,$pass,$title,$time_now,$email,$exptime,$urlpage,$brief,$ipadd,$namefl,$kumpirek,$idmodd,$firma,$maa,$osavaltio,$attn,$puhelin,$fax,$paiva,$kuu,$vuosi,$email2,$category,$url) = split(/\s*\|\s*/, $rivijemma);





if ($kumpi eq "Add") {$urlpage = "http://"}
if ($stat{'addad'} eq "members") {&addpassw;}
if ($stat{'oneperday'} eq "yes"){&oneperday;}
$subact=$action."?$ctmd=addad&alue=$alue&laji=$laji";
$nocashe="";
#&htmhead2;



($sec,$min,$hour,$day,$mon,$year,$wday,$yday,$isdst)= localtime(time) ;
#   $sec = "0$sec" if ($sec < 10);
#  $min = "0$min" if ($min < 10);
#   $hour = "0$hour" if ($hour < 10);
$day = "0$day" if ($day < 10);
#$month = "0$month" if ($month < 10);

$ppaiva=$day;
$pmon=$mon;
$pyear=$year;

#$exp_dt= $time_now + $stat{'expperiod'}*86400;
#$exp_date=date_format($exp_dt);



print <<HTMLF;


<form action="$subact" method="post">


<center>
<table border=1 cellspacing=0  bgcolor=#000050 width=70% >
<tr>
<td>


<table border=1 cellspacing=0   bgcolor=#000050 width=100%><tr bgcolor=#505070><td bgcolor=#000050 align=left>
<CENTER>
<font   face="Arial, Helvetica"   color=#ffffff>
<BR>
<font size=+2  face="Arial, Helvetica" ><B>Message Submit Form</B></font><BR>
<font face="Arial, Helvetica" size=+1 color=#ffff00><B>*</B></font> <font face="Arial, Helvetica" size=2 color=#ffffff><B>Required information</B></font>
<br><BR></font></CENTER>
</td></tr></table>

<!-- ################
##             tää seuraava ei saanu mitään arvoa..onkohan se turha vai onko vika jossain.
##
# <INPUT TYPE="hidden" NAME="numero" value=$luku>
-->
<INPUT TYPE="hidden" NAME="kumpi" value=$kumpi>

<table border=1 cellspacing=0   bgcolor=#000050 width=100%>

<tr bgcolor=#000050><td valign="top"><font face="Arial, Helvetica" size=2 color=#ffffff>
<B>Company Name </B></font><font size="+1"  color=#ffff00><B>*</B></font></td><td bgcolor=#000050><font  face="Arial, Helvetica"  size=2>
<INPUT TYPE=text NAME=firma SIZE=30 MAXLENGTH="45" value="$firma"></font></td></tr>

HTMLF
;

print "<tr bgcolor=#000050><td valign=\"top\"><font face=\"Arial, Helvetica\" size=2 color=#ffffff>";
print "<B>Country</B></font><font size=\"+1\"  color=#ffff00><B>*</B></font></td><td bgcolor=#000050><font  face=\"Arial, Helvetica\"  size=2>";
print "<Select Name=\"maa\">";



foreach $alkio (@maataulu) {
	print "<OPTION ";
	if (($kumpi eq "Add") and ($alkio eq "United States")) {print "SELECTED "}
		if (($kumpi eq "Edit") and ($alkio eq $maa)) {print "SELECTED "}
		print " VALUE=\"$alkio\">$alkio";
}

print "</SELECT></font></td></tr>";




print "<tr bgcolor=#000050><td valign=\"top\"><font face=\"Arial, Helvetica\" size=2 color=#ffffff>";
print "<B>State</B></font><font size=\"+1\"  color=#ffff00><B>*</B></font><FONT color=#ffffff face=\"Arial, Helvetica\" SIZE=\"-2\"><B>(Needed only if you are from US)</B></FONT></td><td bgcolor=#000050>";
print "<font  face=\"Arial, Helvetica\"  size=2><Select  Name=\"osavaltio\">";
foreach $alkio (@osavaltiotaulu) {
	print "<OPTION ";
	if (($kumpi eq "Edit") and ($maa eq "United States") and ($alkio eq $osavaltio)) {print "SELECTED "}
		print " VALUE=\"$alkio\">$alkio";
}
print "</SELECT></font>";
print "</td></tr>";

print <<HTMLF;





<tr bgcolor=#000050><td valign="top"><font face="Arial, Helvetica" size=2 color=#ffffff>
<B>Contact person</B></font><font size="+1"  color=#ffff00><B>*</B></font></td><td bgcolor=#000050><font face="Arial, Helvetica"  size=2>
<INPUT TYPE=text NAME=attn SIZE=30 MAXLENGTH="30" value="$attn"></font></td></tr>

<tr bgcolor=#000050><td valign="top"><font face="Arial, Helvetica" size=2 color=#ffffff>
<B>Email 1</B></font><font size="+1"  color=#ffff00><B>*</B><FONT color=#ffffff face=\"Arial, Helvetica\" SIZE=\"-2\"><b>(Only one address please)</B>
</FONT></font></td><td bgcolor=#000050><font  face="Arial, Helvetica"  size=2><INPUT TYPE=text NAME=email SIZE=30 MAXLENGTH="50" value="$email"></font></td></tr>

<tr bgcolor=#000050><td valign="top"><font face="Arial, Helvetica" size=2 color=#ffffff>
<B>Email 2</B></font><font size="+1"  color=#ffff00><B>*</B><FONT color=#ffffff face=\"Arial, Helvetica\" SIZE=\"-2\"><b>(Important! This will be used for reporting <BR>about possible problems with  the above email address)</B></FONT></font></td><td bgcolor=#000050><font  face="Arial, Helvetica" size=2><INPUT TYPE=text NAME=email2 SIZE=30 MAXLENGTH="50" value="$email2"></font></td></tr>



<tr bgcolor=#000050><td valign="top"><font face="Arial, Helvetica" size=2 color=#ffffff>
<B>Phone</B></font></td><td bgcolor=#000050><font  face="Arial, Helvetica"  size=2><INPUT TYPE=text NAME=puhelin SIZE=30 MAXLENGTH="25" value="$puhelin"></font></td></tr>

<tr bgcolor=#000050><td valign="top"><font face="Arial, Helvetica" size=2 color=#ffffff>
<B>Fax</B></font></td><td bgcolor=#000050><font  face="Arial, Helvetica"  size=2><INPUT TYPE=text NAME=fax SIZE=30 MAXLENGTH="25" value="$fax"></font></td></tr>

<tr bgcolor=#000050><td valign="top"><font face="Arial, Helvetica" size=2 color=#ffffff>
<B>WEB-Site</B></font></td><td bgcolor=#000050><font  face="Arial, Helvetica"  size=2><INPUT TYPE=text NAME=urlpage SIZE=30 MAXLENGTH="50"  value="$urlpage"></font></td></tr>

<tr bgcolor=#000050><td><font face="Arial, Helvetica" size=2 color=#ffffff>
<B>Enter something for Password</B></font><font size="+1"  color=#ffff00><B>*</B></font></td><td bgcolor=#000050 align=left>
<font  face="Arial, Helvetica"  size=2> <INPUT TYPE=text NAME=passw SIZE=30  MAXLENGTH="10" value="$passw"></font></td></tr>

<tr bgcolor=#000050><td valign="top"><font face="Arial, Helvetica" size=2 color=#ffffff>
<B>Re-type the above Password</B></font><font size="+1"  color=#ffff00><B>*</B></font></td><td bgcolor=#000050>
<font  face="Arial, Helvetica"  size=2><INPUT TYPE=text NAME=pass2 SIZE=30  MAXLENGTH="10" value="$pass2"></font>



HTMLF
;


print "</td></tr></table>";

	#print "<INPUT TYPE=hidden NAME=kumpirek SIZE=4 value=60>";
	
	
	print "<table width=100% border=1><tr bgcolor=#000050>\n";
	
	

	foreach $alkio (sort %ms2) {
		if ($laji eq $alkio) {
			print "<td valign=\"top\" height=10><font face=\"Arial, Helvetica\" size=2 color=#ffffff><B>Select the category for machine manufacturers and dealers</B></font><font size=\"+1\"  color=#ffff00><B>*</B></font><BR><table>";
			foreach $alkio (sort %ms2) {
				if ($ms2{$alkio} ne "") {
						print "";
					print "<tr><td>\n";
					print "<INPUT TYPE=\"radio\" NAME=\"laji\" VALUE=\"$alkio\"";
					if ($laji eq $alkio) {print " checked"}
						print "></td><td><font face=\"Arial, Helvetica\" size=2 color=#ffffff>$msg{$alkio}</font></td></tr>\n"
				}
			}
			print "</table>";
		} #if
		
	} #foreach
	




	
	print "</td></tr></table>";
	
	
#	print "<table border=1 width=100%><tr bgcolor=#000050><td valign=\"top\"><font face=\"Arial, Helvetica\" size=2 color=#ffffff>\n";
#	print "<B>\n";
#	print "Select your geographical Location</B></font><font size=\"+1\"  color=#ffff00><B>*</B></font><BR><table>\n";
#	foreach $alkio (sort %alueet) {
#		if ($alueet{$alkio} ne "") {print "<tr><td><INPUT TYPE=\"radio\" NAME=\"alue\" VALUE=\"$alkio\"\n";
#			if ($alue eq $alkio) {print " checked"}
#			print "></td><td><font face=\"Arial, Helvetica\" size=2 color=#ffffff>$alueet{$alkio}</font></td></tr>\n"}
#	}
#	print " </table></td></tr>";

# print "</TABLE>";
	
print <<HTMLF;



<table border=1 cellspacing=0 bgcolor=#000050 width=100%><tr bgcolor=#505070><td  bgcolor=#000050><font face="Arial, Helvetica" size=2 color=#ffffff>
<B>Short description </B></font><font size="+1" color=#ffff00><B>*</B></font></td></tr><tr><td><font  face="Arial, Helvetica"   size=-1>
<INPUT TYPE="text" NAME="title" SIZE="60" MAXLENGTH="60" value="$title"></font></td></tr></table>


<table border=1 cellspacing=0 bgcolor=#000050 width=100%><tr bgcolor=#505070><td  bgcolor=#000050><font face="Arial, Helvetica" size=2 color=#ffffff>
<B>Long description below.  </B></font><font size="+1"  color=#ffff00><B>*</B></font></td></tr><tr><td><font  face="Arial, Helvetica"  size=-1>
HTMLF
;
print "<TEXTAREA NAME=\"brief\" ROWS=\"4\" COLS=\"60\">";



$brief =~ s/<br>//g;
$brief =~ s/\n//g;
print "$brief";
print "</TEXTAREA>";

print "</font></td></tr></table>";

print "<table border=1 cellspacing=0 bgcolor=#000050 width=100%><tr bgcolor=#505070><td  bgcolor=#000050><font face=\"Arial, Helvetica\" size=2 color=#ffffff>";
print "<B>Picture URL </B></font><FONT color=#ffffff  face=\"Arial, Helvetica\"  SIZE=\"-2\"><b>(If you have a picture on your website, you can enter it's address here and it will show with your message)</B></font>";
print "</td></tr><tr><td><font  face=\"Arial, Helvetica\"   size=-1>";
print "<INPUT TYPE=\"text\" NAME=\"url\" SIZE=\"60\"  value=\"$url\"></font></td></tr></table>";


$erapaiva=date_format(time+31536000);




#print "<table border=1 cellspacing=0 bgcolor=#000050 width=100%>";

print "</td></tr></table>";




print <<HTMLF;


<CENTER><FONT face="Arial, Helvetica"  SIZE="-1" color=#ffffff>After you have finished the form above, please click button below.<BR>
<INPUT TYPE="submit" value="Click here to submit your message to TubeNet"> <BR>
<B>Click only once. This may take some time.</B></FONT>
</CENTER></TD></TR>
</TABLE>

</center>



</form>
HTMLF






&htmend2;
exit;
}












sub omaend 
{
print "</center></td></tr></table>";
print "</td></tr></table></center>";
}









 






sub kirjoitafileen3
{
my ($kumpi) = @_;

$file66=$basepath.$namefl."tsekki.dat";

open(file3, ">>$file66");
&lock(file3);
print file3 "$kumpi\n";
&unlock(file3);
close(file3);
}




 

sub htmend2
{

print "</td></tr></table></center>\n";

print <<HTMLF;
$stat{'blinkf'} 

$gfoot
HTMLF
print " </td></tr></table></body></html>\n";
}






 

 

sub printheader
{
print "Content-type: text/html\n\n";
}

 





 
 


 




sub addad {



if (($FORM{'passw'} eq "") || ($FORM{'pass2'} eq "") || ($FORM{'title'} eq "") || ($FORM{'brief'} eq "") || ($FORM{'firma'} eq "")  ||  ($FORM{'paiva'} eq "00") ||  ($FORM{'attn'} eq "") || ($FORM{'email'} eq "") ) {

 &htmhead2;
 &omahead;
 print "<P>";
 print "<h2><font color=#ffffff  face=\"Arial, Helvetica\">Missing information</font></h2><HR><H3><font color=#ffffff  face=\"Arial, Helvetica\">Check out below what fields you need to fill up.</font></H3><P>";
 print "<table><tr><TD><font color=#ffffff  face=\"Arial, Helvetica\"><UL>";
 if ($FORM{'title'} eq "") {print "<LI><B>Short description</B>" }
 if ($FORM{'brief'} eq "") {print "<LI><B>Long description</B>" }
 if ($FORM{'firma'} eq "") {print "<LI><B>Company name</B>" }
 if ($FORM{'attn'} eq "") {print "<LI><B>Contact person</B>" }
 if ($FORM{'email'} eq "") {print "<LI><B>Primary email address</B>" }
 if ($FORM{'passw'} eq "") {print "<LI><B>Password</B>" }
 if ($FORM{'pass2'} eq "") {print "<LI><B>Password confirmation</B>" }
# if ($FORM{'kumpirek'} eq "") {print "<LI><B>Registration type: Basic or Premium registration</B>" }

 print "</UL></font></TD></TR></Table> <P><font size=-1 color=#ffff00  face=\"Arial, Helvetica\"><B>Click your browser's Back-button</B></font><P><BR>";

 &omaend;
 &htmend2;
 exit;

}






 
$exptime=$exptime+15724800;

&getrecord;

$namefl2="usa.".$laji;


open(file,">>$filename");
&lock(file);
print file "$record\n";
&unlock(file);
close(file);




## Record added successfully
&htmhead2;
&omahead;

print "<table><tr><td width=350>";
print "<font color=#ffffff size=+1  face=\"Arial, Helvetica\">";
print "<B>Confirm Message posting</B></font><P>\n";


print "<A HREF=\"http://www.tubenet.org.uk/cgi/envtest5msg2.pl?&seed=$alue$laji$time_now\">\n";
print "<font   color=#ffff00><B>Click here for sending the message</B></font></A><BR><BR>";
print "<BR> <P> </font>\n";
print "</td></tr></table>";
&omaend;
&htmend2;

exit;

}




sub email31
{
&htmhead2;
&omahead;
print "<font  face=\"Arial, Helvetica\"  color=#ffffff size=5> <B>Invalid 2:nd email address<BR><HR></font> <font  face=\"Arial, Helvetica\"  color=#ffffff size=2><BR><B>Email address needs to have format: <font size=4 color=#ffff00>xxxxx\@xxx.xx</font><br><br>For example:<table><tr><td><br><font  face=\"Arial, Helvetica\"  color=#ffffff size=2>admin\@tubenet.org<br>bill.clinton\@whitehouse.com<br>peterpan\@mycompany.de</font></td></tr></table>  </B></font><P> <font  face=\"Arial, Helvetica\"  size=2 color=#ffff00><B>Click your browser's Back-button</B></font><P><BR>\n";
&omaend;
&htmend2;
exit;
}


sub urlerror
{
&htmhead2;
&omahead;
print "<font  face=\"Arial, Helvetica\"  color=#ffffff size=5> <B>Invalid homepage URL<BR><HR></font> <font  face=\"Arial, Helvetica\"  color=#ffffff size=2><BR><B>URL needs to have format: <font size=4 color=#ffff00>http://xxxxxxx.xxx</font><br><br>For example:<table><tr><td><br><font  face=\"Arial, Helvetica\"  color=#ffffff size=2>http://www.tubenet.org<br>http://mysite.com<br>http://www.walli.uwasa.fi</font></td></tr></table>  </B></font><P> <font  face=\"Arial, Helvetica\"  size=2 color=#ffff00><B>Click your browser's Back-button</B></font><P><BR>\n";
&omaend;
&htmend2;
exit;
}


sub confirmaa2
{
$ipadd=$ENV{'REMOTE_ADDR'};

$subact=$action."?$ctmd=addform&alue=$alue&laji=$laji";
&htmhead2;
&omahead;

print <<HTMLF;
<center><table border=0 width=400><tr><td><font face=verdana  color=ffffff>
<CENTER><B>Tube & Pipe Producers and <BR>Machine Manufacturers</B></CENTER><br>

<FONT SIZE="-1">
<CENTER><P>Don't advertise here. <p>TubeNet Marketplace is not a place for<BR> promoting new products. Instead, you can<BR> 
 use TubeNet's Registers for <a href="http://www.tubenet.org.uk/supply_f.html"><font color=#ffff00>Tube Suppliers</font></a> <BR>and 
<a href="http://www.tubenet.org.uk/manuf_f.html"><font color=#ffff00>Machine Manufacturers</font></A>.</CENTER> <P>
<!-- If you do, it only shows that you are <U>just nothing but a trouble for everyone</U> 
and something that cannot be taken seriously. <P>
 --><center>Do you agree ?</center> </FONT>
<center>
<form action="$subact" method="post"><INPUT TYPE="submit" value="Yes, I agree"></FORM>
HTMLF

$subact=$action."?$ctmd=md&$refr";
print <<HTMLF;

<form action="$subact" method="post"><INPUT TYPE="submit" value="No, I want to go back"></form>
<FONT SIZE="-1"><B>Click only once. This may take some time.</B></font><P><BR></center>
</font></TD></TR>
</TABLE></center>

HTMLF

&omaend;
&htmend2;
exit;
}






