Skip to content

Instantly share code, notes, and snippets.

@earnhardt3rd
Created June 19, 2023 14:03
Show Gist options
  • Select an option

  • Save earnhardt3rd/e262830ae8b33828d8186d545a449097 to your computer and use it in GitHub Desktop.

Select an option

Save earnhardt3rd/e262830ae8b33828d8186d545a449097 to your computer and use it in GitHub Desktop.
require 'getopts.pl';
Getopts('m:d:t');
my $MODE = uc($opt_m) || "";
my $DEBUG = $opt_d || 0;
if (defined $opt_t) { my %TEST = &_SETUP_LIC();}
1;
sub _SETUP_LIC {
my $appKey = shift || "";
if ($appKey eq "") {return;}
if (scalar(keys %LICS) == 0) {
print " Hello $USERNAME\n";
#PDM=RRR1RRR-HOSTNAME-USER-ACCESS-EXPIRE (NEED TO BE LENGTH 10)
#print " PDM-12025-ANY-ANY-ADMIN-9999999999\n";
#print " PDM-12025-ANY-ANY-DEVELOPER-9999999999\n";
print " Enter '$appKey' License Key:";
my $lans = <STDIN>;
chomp($lans);
if ($lans eq ""){
&displayMessageInBox(" ERROR! Invalid License Key code:=00001 (Empty) \n");
&_EXIT_CLEAN();
}
if ($lans !~ /^$appKey/) {
&displayMessageInBox(" ERROR! Invalid License Key code:=00002 (Wrong APP) \n");
&_EXIT_CLEAN();
}
$LICS{$appKey}=$lans;
my $pdmLicChk = &_LIC_CHK($appKey);
if ($pdmLicChk =~ /CURRENT/) {
print " License Confirmed!\n";
$LICS{$appKey}=$lans . "," . $DT;
} else {
print " $pdmLicChk\n";
&_EXIT_CLEAN();
}
} else {
if (exists($LICS{$appKey})) {
my ($lApp,$lSym,$lHost,$lUser,$lAccess,$lExpire) = split('-',$LICS{$appKey});
} else {
print " Enter '$appKey' License Key:";
my $lans = <STDIN>;
chomp($lans);
if ($lans eq ""){
&displayMessageInBox(" ERROR! Invalid License Key code:=00001 (Empty) \n");
&_EXIT_CLEAN();
}
if ($lans !~ /^$appKey/) {
&displayMessageInBox(" ERROR! Invalid License Key code:=00002 (Wrong APP) \n");
&_EXIT_CLEAN();
}
$LICS{$appKey}=$lans;
my $pdmLicChk = &_LIC_CHK($appKey);
if ($pdmLicChk =~ /CURRENT/) {
print " License Confirmed!\n";
$LICS{$appKey}=$lans . "," . $DT;
} else {
print " $pdmLicChk\n";
&_EXIT_CLEAN();
}
}
if ($USER_ACCESS eq "") {
&displayMessageInBox(" ERROR! Invalid User Access for ( $ORIG_USER ) \n");
&_FH_USERS("ADMIN");
&_EXIT_CLEAN();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment