Hello there, I have a problem with property definition of this code, please have a look.

 

#!/usr/bin/perl -w

 

use DBI;

use strict;

use warnings;

 

$dsn = "dbi:mysql:db_coolcash:localhost";

my $user= "mysql";

my $password = "mysql123";

$dbh = DBI->connect($dsn,$user,$password);

 

$msg = $ARGV[1];

$source = $ARGV[0];

 

 

$msg =~ s/\\\"/' /ig;

 

$time = localtime();

open (OUTFILE ,">>C:\\logs\\cool.txt");

print OUTFILE "$time\t$source\t$msg\n";

close(OUTFILE);

 

 $found = 0;

 

if (($msg =~ /Cool\+cash\s*1/i) && ($msg !~ /Cool\+cash\s*1\d/i)

  {

 $vote = 'cool cash 1';

 $found = 1;

  }

 

  elsif (($msg =~ /Cool\+cash\s*1/i) && ($msg !~ /Cool\+cash\s*1\d/i)

   {

 $vote = 'cool cash 2';

 $found = 1;

   }

 if ($found == 1)

  {

 $statement = "insert into t_count (time_in, Cli, msg) values (now(),'$source','$msg')";

 $sth= $dbh->prepare("$statement");

 $sth->execute;

 

 $statement = "update low_priority t_votes set votes=votes+1 where vote='$vote'";

 $sth= $dbh->prepare("$statement");

 $sth->execute;

 $sth->finish;

 

 print "Thank you for voting $vote. Your vote has been registered.\n";

 }

 

  else

  {

  print "Sorry. Your vote has not been registered, Thank you.\n";

  }

 

$dbh->disconnect;

exit;

 

 

Kind Regards,

 

Kenneth Moeng

Operations Executive

 

FoneWorx-VTS (PTY) Ltd

P, O, Box 2331,Gaborone

Tel: +09267-3938501/3/5

Cel: 09267-71214434

www.pulaholdings.co.bw

 

Reply via email to