Hi, 

I am using perl script to handle some function of squid redirector program . 
Actually its working fine. But after some time , that functions goes off. 
That's meant 
VALUE-A doesnt comes in to the request. 

I checked the DB , it also fine.
CPU also nothing

Can some body help me please ? 



#!/usr/bin/perl
use DBI;
use strict;
use warnings;

# no buffered output, auto flush
$|=1;

my ($dbh,$sth,$dbargs,$VALUE-A,$VALUE-B,$query);


$dbh = DBI->connect("dbi:mysql:List;localhost","root","") || "Error Opening 
DataBase: $DBI::errstr\n";

if (!$dbh->err()) {

    while (<STDIN>) {
       chomp;
       my ($url, $x, $ip) = split(/ /);
       $ip = substr($ip, 0, (length($ip)-2));
       
       
       $query = "SELECT * from ACCOUNT where someField = '" . $ip ."' order by 
xxx_yyy desc";
       $sth = $dbh->prepare($query);
       $sth->execute();

       if (my $ref = $sth->fetchrow_hashref()) {
           $VALUE-A = $ref->{'CallingStationId'};
       $VALUE-B = $ref->{'AcctSessionId'};
           
       }else{
           $VALUE-A = "NA";
       }

       if (!($url =~ m#xxxyyyy#)) {
           if ($url =~ m#\?#) {
              $url .= "&xxxyyyy=" . $VALUE-A . "-" . $ip . "-" . $VALUE-B;
           } else {
              $url .= "?xxxyyyy=" . $VALUE-A . "-" . $ip . "-" . $VALUE-B;
           }
           print $url."\n";
       } else {
           print "\n";
       }
    }
}else {
    print "\n";
}
   $sth->finish();
   $dbh->commit();
   
   $dbh->disconnect();


Many thanks
Luke

Send instant messages to your online friends http://uk.messenger.yahoo.com 

Reply via email to