#!/usr/bin/perl
use strict;
use CGI qw/:standard :html3 *table/;
require "functions.pl";
our ($DBHost,$TMDBName,$TMDBUser,$TMDBPass,%TMAMOUNTS);
our ($sendmail,$tmuploaddir);
our ($tmowneremail,$tmownerdesc);
my ($req_serv,$firstname,$middle,$lastname,$dayphone,$eveningphone,$companyname,$statecountry);
my ($appaddress,$appcity,$appstate,$appzip,$cpfirstname,$cplastname,$cemail,$trdmk_type,$tgs);
my ($bizaddress,$bizcity,$bizstate,$bizzip,$logo,$cctype,$ccno,$ccexpdate,$ccaddress);
my ($cccity,$ccstate,$cczip,$cvvs,$cvvs2,$agree,$text,$rnd,$amount,$id);
my ($dbh,$sth,$rc,$query,@a);
$req_serv=(param('req_serv'))?param('req_serv'):"";
$firstname=(param('firstname'))?param('firstname'):"";
$middle=(param('middle'))?param('middle'):"";
$lastname=(param('lastname'))?param('lastname'):"";
$dayphone=(param('dayphone'))?param('dayphone'):"";
$eveningphone=(param('eveningphone'))?param('eveningphone'):"";
$companyname=(param('companyname'))?param('companyname'):"";
$statecountry=(param('statecountry'))?param('statecountry'):"";
$appaddress=(param('appaddress'))?param('appaddress'):"";
$appcity=(param('appcity'))?param('appcity'):"";
$appstate=(param('appstate'))?param('appstate'):"";
$appzip=(param('appzip'))?param('appzip'):"";
$cpfirstname=(param('cpfirstname'))?param('cpfirstname'):"";
$cplastname=(param('cplastname'))?param('cplastname'):"";
$cemail=(param('cemail'))?param('cemail'):"";
$trdmk_type=(param('trdmk_type'))?param('trdmk_type'):"";
$tgs=(param('tgs'))?param('tgs'):"";
$bizaddress=(param('bizaddress'))?param('bizaddress'):"";
$bizcity=(param('bizcity'))?param('bizcity'):"";
$bizstate=(param('bizstate'))?param('bizstate'):"";
$bizzip=(param('bizzip'))?param('bizzip'):"";
$logo=(param('logo'))?param('logo'):"";
$cctype=(param('cctype'))?param('cctype'):"";
$ccno=(param('ccno'))?param('ccno'):"";
$ccexpdate=(param('ccexpdate'))?param('ccexpdate'):"";
$ccaddress=(param('ccaddress'))?param('ccaddress'):"";
$cccity=(param('cccity'))?param('cccity'):"";
$ccstate=(param('ccstate'))?param('ccstate'):"";
$cczip=(param('cczip'))?param('cczip'):"";
$cvvs=(param('cvvs'))?param('cvvs'):"";
$cvvs2=(param('cvvs2'))?param('cvvs2'):"";
$agree=(param('agree'))?param('agree'):"";
$text=(param('text'))?param('text'):"";
#########
if (!$req_serv || $req_serv eq "") { missing("req_serv");exit(110); }
if (!$firstname || $firstname eq "") { missing("firstname");exit(110); }
if (!$middle || $middle eq "") { missing("middle");exit(110); }
if (!$lastname || $lastname eq "") { missing("lastname");exit(110); }
if (!$dayphone || $dayphone eq "") { missing("dayphone");exit(110); }
if (!$eveningphone || $eveningphone eq "") { missing("eveningphone");exit(110); }
if (!$companyname || $companyname eq "") { missing("companyname");exit(110); }
if (!$statecountry || $statecountry eq "") { missing("statecountry");exit(110); }
if (!$appaddress || $appaddress eq "") { missing("appaddress");exit(110); }
if (!$appcity || $appcity eq "") { missing("appcity");exit(110); }
if (!$appstate || $appstate eq "") { missing("appstate");exit(110); }
if (!$appzip || $appzip eq "") { missing("appzip");exit(110); }
if (!$cpfirstname || $cpfirstname eq "") { missing("cpfirstname");exit(110); }
if (!$cplastname || $cplastname eq "") { missing("cplastname");exit(110); }
if (!$cemail || $cemail eq "") { missing("cemail");exit(110); }
if (!$trdmk_type || $trdmk_type eq "") { missing("trdmk_type");exit(110); }
if (!$tgs || $tgs eq "") { missing("tgs");exit(110); }
if (!$bizaddress || $bizaddress eq "") { missing("bizaddress");exit(110); }
if (!$bizcity || $bizcity eq "") { missing("bizcity");exit(110); }
if (!$bizstate || $bizstate eq "") { missing("bizstate");exit(110); }
if (!$bizzip || $bizzip eq "") { missing("bizzip");exit(110); }
if (!$cvvs || $cvvs eq "") { missing("cvvs");exit(110); }
if (!$cvvs2 || $cvvs2 eq "") { missing("cvvs2");exit(110); }
########### Deep check the fields!
#####################################
# Test For Agrement Checked
if (!$agree || $agree ne "agree"){
print <<"HTML";
Content-type: text/html
Trademark Search : : Agreement not verified
Cannot continue!!!
Please go back, read and agree with Terms and Conditions to proceed forward!
HTML
exit(113);
}
# Test for CVVS Codes match
if ($cvvs ne $cvvs2){
print <<"HTML";
Content-type: text/html
Trademark Search : : Agreement not verified
Cannot continue!!!
The CVVS codes doesn't match.
Please go back and check!
You didn't choosed phrase to register. Please go back.
HTML
exit(113);
}
$rnd=rand_str(32);
#### Receiving file if needed
if ($logo ne ""){
my $q = new CGI;
my $file;
if ($logo =~ /\.jpg/i){
$logo=".jpg";
} elsif ($logo =~ /\.gif/i){
$logo=".gif";
}
my $ufh = $q->upload('logo');
$logo=$rnd.$logo;
if(open(UPLOADFILE, ">$tmuploaddir/$logo")){
while ( <$ufh> ) {
print UPLOADFILE;
}
close UPLOADFILE;
} else {
print_error('Error uploading file!');
exit(12);
}
}
#########
###############
# Updating data into database.
$dbh = DBI->connect("dbi:mysql:dbname=$TMDBName;host=$DBHost","$TMDBUser","$TMDBPass",
{
PrintError => 0,
RaiseError => 0,
AutoCommit => 1
});
if (!defined($dbh)){
print_error("Database Error:","$DBI::errstr");
exit(1);
}
$a[1]=quotemeta($firstname);
$a[2]=quotemeta($middle);
$a[3]=quotemeta($lastname);
$a[4]=quotemeta($dayphone);
$a[5]=quotemeta($eveningphone);
$a[6]=quotemeta($companyname);
$a[7]=quotemeta($statecountry);
$a[8]=quotemeta($appaddress);
$a[9]=quotemeta($appcity);
$a[10]=quotemeta($appstate);
$a[11]=quotemeta($appzip);
$a[12]=quotemeta($cpfirstname);
$a[13]=quotemeta($cplastname);
$a[14]=quotemeta($cemail);
$a[17]=quotemeta($bizaddress);
$a[18]=quotemeta($bizcity);
$a[19]=quotemeta($bizstate);
$a[20]=quotemeta($bizzip);
$a[21]=quotemeta($cvvs);
$a[23]=quotemeta($text);
$a[25]=quotemeta($ccno);
$a[26]=quotemeta($ccexpdate);
$a[27]=quotemeta($ccaddress);
$a[28]=quotemeta($cccity);
$a[29]=quotemeta($ccstate);
$a[30]=quotemeta($cczip);
$amount=$TMAMOUNTS{$req_serv};
$query="INSERT INTO trademark (req_serv,amount,firstname,middle,lastname,dayphone,eveningphone,
companyname,statecountry,appaddress,appcity,appstate,appzip,cpfirstname,cplastname,
cemail,trdmk_type,tgs,bizaddress,bizcity,bizstate,bizzip,cvvs,logo,text,cctype,ccno,
ccexpdate,ccaddress,cccity,ccstate,cczip,randstr,status,date) values ('$req_serv','$amount',
'$a[1]','$a[2]','$a[3]','$a[4]','$a[5]','$a[6]','$a[7]','$a[8]','$a[9]','$a[10]',
'$a[11]','$a[12]','$a[13]','$a[14]','$trdmk_type','$tgs','$a[17]','$a[18]','$a[19]',
'$a[20]','$a[21]','$logo','$a[23]','$cctype','$a[25]','$a[26]','$a[27]','$a[28]','$a[29]',
'$a[30]','$rnd','waiting',now());";
$sth = $dbh->prepare($query);
if (!$sth) {
print_error("[DBI]: Prepare Error Occured!",$DBI::errstr);
db_disconnect();
exit(1);
}
$rc=$sth->execute;
if (!$rc) {
print_error("[DBI]: Execute Error Occured!",$DBI::errstr);
$sth->finish();
db_disconnect();
exit(1);
}
$query="SELECT id FROM trademark WHERE req_serv='$req_serv' AND firstname='$a[1]' AND lastname='$a[3]' AND randstr='$rnd'";
$sth = $dbh->prepare($query);
if (!$sth) {
print_error("[DBI]: Prepare Error Occured!",$DBI::errstr);
db_disconnect();
exit(1);
}
$rc=$sth->execute;
if (!$rc) {
print_error("[DBI]: Execute Error Occured!",$DBI::errstr);
$sth->finish();
db_disconnect();
exit(1);
}
undef(@a);
@a=$sth->fetchrow_array;
$id=$a[0];
$sth->finish;
$dbh->disconnect();
### Send e-mail to the customer .
open (MAIL,"|$sendmail");
print MAIL "From: $tmownerdesc <$tmowneremail>\n";
print MAIL "To: $cpfirstname $cplastname <$cemail>\n";
print MAIL "Subject: Confirmation of your Trademark Search Request.\n\n";
print MAIL "\n\n\t\tDear $firstname,\n\n";
print MAIL "Thank you for submitting your trademark Search Request on Bizincusa.com.\n\n";
print MAIL "Search Request Report:\n";
print MAIL "---------------------\n\n";
print MAIL "Request ID : #$id\n";
print MAIL "Requested Service : $req_serv\n";
print MAIL "Trademark Type : $trdmk_type\n";
if ($trdmk_type =~ /word|phrase/i){
print MAIL "Words/Phrase : \"$text\"\n";
}
print MAIL "Type of Goods or Sevices : $tgs\n\n";
print MAIL "---------------------\n";
print MAIL "Price : \$$amount\n\n";
print MAIL "Generally, all searches are complete within a 3 day period. This\n";
print MAIL "includes Federal,Federal and State, and the advanced search of\n";
print MAIL "Federal, State, and Common Law.\n\n";
print MAIL "Once the search is complete Bizincusa / Trademark USA will email you\n";
print MAIL "and advise you of the location of where you can download the search\n";
print MAIL "results.\n\n";
print MAIL "After reviewing the search results, we will make a statement of the\n";
print MAIL "probability of being able to file the trademark requested with the\n";
print MAIL "United States Patent and Trademark Office. If we think your chances\n";
print MAIL "are reasonable, you will be instructed to submit a request to file\n";
print MAIL "the trademark. The processing fee for submitting the trademark is in\n";
print MAIL "addition to your search fees. Currently, the application submission\n";
print MAIL "process is \$175.00 and a filing fee of \$335.00. Keep in mind,\n";
print MAIL "Bizincusa.com, Trademark USA, nor Incorporate USA, Inc and its\n";
print MAIL "employess or associates are responsible for rejections.\n\n";
print MAIL "The time-line for filing once the submission of the application is\n";
print MAIL "made, is 6 months before an examing attorney is assigned, then\n";
print MAIL "approximately 6 - 12 months for approval.\n\n";
print MAIL "Again, thank you for your request, we will notify you when the\n";
print MAIL "search results are complete. Also, if you need to incorporate a\n";
print MAIL "business or form an LLC, you can do so at http://www.bizincusa.com\n";
print MAIL "click on Incorporate, we start at only \$99.00 for Business formation.\n\n";
print MAIL "Best Regards,\n\n";
print MAIL "The Bizincusa.com Professionals Network\n\n";
close(MAIL);
### end e-mail
### Send email to the owner.
open (MAIL,"|$sendmail");
print MAIL "From: $tmownerdesc <$tmowneremail>\n";
print MAIL "To: $tmownerdesc <$tmowneremail>\n";
print MAIL "Subject: [TrademarkUSA] New Trademark Search Request.\n\n";
print MAIL "Request ID : #$id\n";
print MAIL "Full Name : $firstname $middle. $lastname\n";
print MAIL "Service Requested : $req_serv\n";
print MAIL "Trademark Type : $trdmk_type\n";
print MAIL "Type Of Goods or Services : $tgs\n";
print MAIL "CVVS Code : $cvvs\n\n";
print MAIL "---------------------------\n";
print MAIL "Price : \$$amount\n\n";
close (MAIL);
# End of owner email
###### THANKYOU PAGE
print<<"HTML";
Content-type: text/html
Trademark Search : : Request Completed
Dear $firstname,
Thank you for submitting your trademark Search Request on
Bizincusa.com.
Search Request Report:
Request ID:
#$id
Requested Service:
$req_serv
Trademark Type:
$trdmk_type
HTML
if ($trdmk_type =~ /word|phrase/i){
print<<"HTML";
Words/Phrase:
"$text"
HTML
}
print <<"HTML";
Type of Goods or Services:
$tgs
Price:
\$$amount
Generally, all searches are complete within a 3 day period. This includes
Federal, Federal and State, and the advanced search of Federal, State, and Common
Law.
Once the search is complete Bizincusa / Trademark USA will email you and
advise you of the location of where you can download the search
results.
After reviewing the search results, we will make a statement of the
probability of being able to file the trademark requested with the United States Patent and Trademark
Office. If we think your chances are reasonable, you will be instructed to submit a request to file
the trademark. The processing fee for submitting the trademark is in addition to your search fees.
Currently, the application submission process is \$175.00 and a filing fee of \$335.00. Keep in mind,
Bizincusa.com, Trademark USA, nor Incorporate USA, Inc and its employess or associates are responsible for
rejections.
The time-line for filing once the submission of the application is made, is
6 months before an examing attorney is assigned, then approximately 6 - 12
months for approval.
Again, thank you for your request, we will notify you when the search
results are complete. Also, if you need to incorporate a business or form an LLC , you can do so at
http://www.bizincusa.com click on Incorporate, we start at only
\$99.00 for Business formation.
Best Regards,
The Bizincusa.com Professionals Network
HTML
###############
# FUNCTIONS @@@
###############
sub missing {
print <<"HTML";
Content-type: text/html
Trademark Search : : Software Error
Site params error!!!
An error occured while parsing, required params. The param "$_[0]" is empty or not defined. Please go back and fill all the required fields.
HTML
}
sub rand_str{
my @chars=('a'..'z','0'..'9');
my $random_string;
foreach (1..$_[0])
{
$random_string.=$chars[rand @chars];
}
return $random_string;
}