[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

4.2

PERL Programming question, about emailing a dynamic link from one perl script to an email address in a log file

Asked by livegirllove in CGI Scripting

Tags: payment_method_code, perl, status_code

Ok I have a script PBcomplete.pl it outputs a link on a webpage that has a token for livechat minutes.  I need to email that link to an email address that is in a log file.

###############################this is the log file.  The new lines start at authorized. ####################################

AUTHORIZED QNPCYEYGOY 1061855480  zip=94611 username=user1@domain1.net transaction_time=07:54:44 transaction_nmb=382927 transaction_date=08/25/2003 transaction_amount=14.95 success_redirect=http://www.livegirllove.com/cgi-bin/PBcompleted.pl status_code=PAID state=CA rebill=NO pon=1052920 payment_option_description=10 minutes payment_method_code=VISA password=dan merchant_website_name=Live Girl Love last_name=user1 user1 hash=QNPCYEYGOY first_name=user1 failure_redirect=http://www.livegirllove.com/cgi-bin/PBfailure.pl expiration_time=07:54:45 expiration_date=08/26/2003 email=user1@domain1.net country_name=United States country_code=US conversion=NO city=user1 address=90 user1 action=ADD
AUTHORIZED LKUTHPOAOJ 1061856993  zip=94611 username=user2@domain1.net transaction_time=08:19:56 transaction_nmb=383017 transaction_date=08/25/2003 transaction_amount=14.95 success_redirect=http://www.livegirllove.com/cgi-bin/PBcompleted.pl status_code=PAID state=CA rebill=NO pon=1052920 payment_option_description=10 minutes payment_method_code=VISA password=dan merchant_website_name=Live Girl Love last_name=user2 user2 hash=LKUTHPOAOJ first_name=user2 failure_redirect=http://www.livegirllove.com/cgi-bin/PBfailure.pl expiration_time=08:19:57 expiration_date=08/26/2003 email=user2@domain1.net country_name=United States country_code=US conversion=NO city=user2 address=user2 action=ADD
AUTHORIZED  1061923013
AUTHORIZED DQRNKRDUEM 1061923931  zip=94611 username=user3@domain1.net transaction_time=02:55:33 transaction_nmb=385038 transaction_date=08/26/2003 transaction_amount=14.95 success_redirect=http://www.livegirllove.com/cgi-bin/PBcompleted.pl status_code=PAID state=CA rebill=NO pon=1052920 payment_option_description=10 minutes payment_method_code=VISA password=dan merchant_website_name=Live Girl Love last_name=user3 user3 hash=DQRNKRDUEM first_name=user3 failure_redirect=http://www.livegirllove.com/cgi-bin/PBfailed.pl expiration_time=02:55:34 expiration_date=08/27/2003 email=user3@domain1.net country_name=United States country_code=US conversion=NO city=user3 address=user3 action=ADD
AUTHORIZED CGLSWGHUDG 1061925191  zip=94611 username=user4@domain1.net transaction_time=03:16:33 transaction_nmb=385084 transaction_date=08/26/2003 transaction_amount=14.95 success_redirect=http://www.livegirllove.com/cgi-bin/PBcompleted.pl status_code=PAID state=CA rebill=NO pon=1052920 payment_option_description=10 minutes payment_method_code=VISA password=dan merchant_website_name=Live Girl Love last_name=user4 user4 hash=CGLSWGHUDG first_name=user4 failure_redirect=http://www.livegirllove.com/cgi-bin/PBfailed.pl expiration_time=03:16:34 expiration_date=08/27/2003 email=username=user4@domain1.net country_name=United States country_code=US conversion=NO city=user4 address=user4 action=ADD
AUTHORIZED RBUUYUOGYY 1061925392  zip=94611 username=user5@domain1.net transaction_time=03:19:54 transaction_nmb=385098 transaction_date=08/26/2003 transaction_amount=14.95 success_redirect=http://www.livegirllove.com/cgi-bin/PBcompleted.pl status_code=PAID state=CA rebill=NO pon=1052920 payment_option_description=10 minutes payment_method_code=VISA password=dan merchant_website_name=Live Girl Love last_name=user5 user5 hash=RBUUYUOGYY first_name=user5 failure_redirect=http://www.livegirllove.com/cgi-bin/PBfailed.pl expiration_time=03:19:55 expiration_date=08/27/2003 email=user5@domain1.net country_name=United States country_code=US conversion=NO city=user5 address=user5 action=ADD
AUTHORIZED AHGLAYSWDS 1061925538  zip=94611 username=user6@domain1.net transaction_time=03:22:20 transaction_nmb=385101 transaction_date=08/26/2003 transaction_amount=14.95 success_redirect=http://www.livegirllove.com/cgi-bin/PBcompleted.pl status_code=PAID state=CA rebill=NO pon=1052920 payment_option_description=10 minutes payment_method_code=VISA password=dan merchant_website_name=Live Girl Love last_name=user6 hash=AHGLAYSWDS first_name=user6 failure_redirect=http://www.livegirllove.com/cgi-bin/PBfailed.pl expiration_time=03:22:21 expiration_date=08/27/2003 email=user6@domain1.net country_name=United States country_code=US conversion=NO city=user6 address=user6 action=ADD
AUTHORIZED GWRVJAJLPK 1063478562  zip=27312 username=user7@domain2.net transaction_time=04:00:49 transaction_nmb=429207 transaction_date=09/13/2003 transaction_amount=14.95 success_redirect=http://www.livegirllove.com/cgi-bin/PBcompleted.pl status_code=PAID state=NC rebill=NO pon=1052920 payment_option_description=10 minutes payment_method_code=VISA password=asdf merchant_website_name=Live Girl Love last_name=Lastname7 hash=GWRVJAJLPK first_name=Firstname7 failure_redirect=http://www.livegirllove.com/cgi-bin/PBfailed.pl expiration_time=04:00:50 expiration_date=09/14/2003 email=user7@domain2.net country_name=United States country_code=US conversion=NO city=city7 address=address7 action=ADD
AUTHORIZED BWITLUVDXH 1063509547  zip=27312 username=user8@domain2.net transaction_time=12:37:10 transaction_nmb=430487 transaction_date=09/14/2003 transaction_amount=60.00 success_redirect=http://www.livegirllove.com/cgi-bin/PBcompleted.pl status_code=PAID state=NC rebill=NO pon=1055482 payment_option_description=25 Minutes payment_method_code=VISA password=asdf merchant_website_name=Live Girl Love last_name=Lastname8 hash=BWITLUVDXH first_name=Firstname8 failure_redirect=http://www.livegirllove.com/cgi-bin/PBfailed.pl expiration_time=12:37:11 expiration_date=09/15/2003 email=user8@domain2.net country_name=United States country_code=US conversion=NO city=city8 address=address8 action=ADD
AUTHORIZED PINQROLXNH 1063512701  zip=27312 username=user7@domain2.net transaction_time=01:29:43 transaction_nmb=430564 transaction_date=09/14/2003 transaction_amount=15.00 success_redirect=http://www.livegirllove.com/cgi-bin/PBcompleted.pl status_code=PAID state=nc rebill=NO pon=1055481 payment_option_description=5 Minutes payment_method_code=VISA password=asdf merchant_website_name=Live Girl Love last_name=Lastname7 hash=PINQROLXNH first_name=Firstname7 failure_redirect=http://www.livegirllove.com/cgi-bin/PBfailed.pl expiration_time=01:29:44 expiration_date=09/15/2003 email=user7@domain2.net country_name=United States country_code=US conversion=NO city=city7 address=address7 action=ADD

###################THIS IS, I BELIEVE, THE PERTINANT PART OF THE SCRIPT###########################

if($authorized && !$claimed) {
      #      set $allowance based on timecard purchase

      my $allowance = $optionTime{$params{'pon'}};

      #      retrieve a valid token from Sidekick
      
      my $token = &retrieveToken($allowance);
      #print "GOT $token !!!\n";

      #
      #      append log line...
      #
      &log($fileClaimed, 'CLAIMED', $hash, $pairs, " token=$token");

      #      generate html page

      &displayHtmlPage($token);

} else {
      #
      #      append log line...
      #
      &log($fileFailed, 'REJECTED', $hash, $pairs);

      # generate html page with Rejected!

      &displayHtmlPageRejected();
}


#
#      append line to log file
#      - pass filename
#      - pass action
#      - pass any misc data to write...
#
sub log
{
      my $file = shift(@_);
      my $action = shift(@_);
      my $hash = shift(@_);

      my $t = time;
      open(ASSIGNED, ">>$file");
      print ASSIGNED "$action $hash $t ", join(' ', @_), "\n";
      close(ASSIGNED);
}



#
#      is hash in the log file?
#      - pass filename
#      - pass action
#      - pass any misc data to write...
#
sub hashPresent
{
      my $file = shift(@_);
      my $action = shift(@_);
      my $hash = shift(@_);
      my $line;

      my $found = 0;
      open(FILE, $file);
      while($line = <FILE>) {
            if($line =~ /^$action $hash/) {
                  $found = 1;
                  last;
            }
      }
      close(FILE);

      return $found
}

#
#      call out to Sidekick to retrieve a valid token
#      - pass allowable time in seconds
#
sub retrieveToken
{
      my $allowance = $_[0];
      my $token = "0";

      my $r = new HTTP::Request 'GET', "$getTokenUrl?allowance=$allowance";
      my $ua = new LWP::UserAgent;
      my $res = $ua->request($r);
      if($res->is_success) {
        $token = $res->content;
      }
      
      return $token;
}


sub displayHtmlPage
{
      my $token = $_[0];

print "Content-type:text/html\n\n";

print <<END

<html>

<head>
      <title>Payment Information Approved</title>
</head>
<body bgcolor="#5B81A8" text="#CCCCCC" link="#CCCCCC">
<body>

<p><p align="center">
<img src="http://www.livegirllove.com/images/name.gif" width="750" height="113" align="top"></p>
<p><p align="center"><font color="#CCcccc" size="4" face="Comic Sans MS"><strong>Your Payment Information Was Approved!!<br>
You Are On Your Way To Chatting With The Hottest, Sluttiest Girls On The Net!!</strong></font></p>
<br>
      
<p align="center"><font color="#CCcccc" size="4" face="Comic Sans MS"><strong>
      <a href="$whosLivePrivateUrl?token=$token">Click Here To See Who's Live</a></strong></font></p>

</body>
</html>


#################Three lines up is the url that needs to be emailed.######################
[+][-]09/14/03 04:30 PM, ID: 9359217Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09/14/03 07:56 PM, ID: 9359844Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/15/03 03:22 AM, ID: 9361653Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/15/03 10:06 AM, ID: 9364420Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/16/03 11:56 AM, ID: 9372597Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/16/03 02:41 PM, ID: 9373819Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/16/03 07:35 PM, ID: 9375101Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/16/03 08:15 PM, ID: 9375278Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/17/03 08:08 AM, ID: 9378777Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/17/03 08:31 AM, ID: 9378965Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/17/03 08:48 AM, ID: 9379074Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/17/03 08:50 AM, ID: 9379098Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/17/03 08:56 AM, ID: 9379137Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/17/03 09:01 AM, ID: 9379175Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/17/03 09:03 AM, ID: 9379194Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/17/03 09:12 AM, ID: 9379256Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/17/03 10:09 AM, ID: 9379782Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/17/03 10:33 AM, ID: 9379969Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/17/03 11:16 AM, ID: 9380340Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/17/03 11:42 AM, ID: 9380540Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/17/03 12:18 PM, ID: 9380822Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/17/03 01:56 PM, ID: 9381579Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: CGI Scripting
Tags: payment_method_code, perl, status_code
Sign Up Now!
Solution Provided By: _nn_
Participating Experts: 2
Solution Grade: A
 
[+][-]09/17/03 05:04 PM, ID: 9382729Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/17/03 05:10 PM, ID: 9382756Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/17/03 05:31 PM, ID: 9382839Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/17/03 06:58 PM, ID: 9383199Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/17/03 07:21 PM, ID: 9383306Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/17/03 09:06 PM, ID: 9383713Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/17/03 09:25 PM, ID: 9383780Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09/18/03 01:01 AM, ID: 9384549Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/18/03 08:37 AM, ID: 9387088Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/18/03 01:15 PM, ID: 9389173Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89