querySQL := 'SELECT COUNT(*) `article` FROM `sdvd_products` WHERE `article` = "'+article+'"';
qQuery.Close;
qQuery.SQL.Clear;
qQuery.SQL.Add(querySQL);
qQuery.Open;
if qQuery.FieldByName('article').AsInteger = 0 then
ShowMessage('Указанная запись '+article+' не существует!')
else
begin
qQuery.Close;
qQuery.SQL.Clear;
qQuery.SQL.Add('UPDATE `sdvd_products` SET `price` = :_price WHERE `article` = "'+article+'"');
qQuery.ParamByName('_price').Value := price;
qQuery.ExecSQL;
end;
#!/usr/bin/perl
use Net::Telnet;
use strict;
use warnings;
my $user = "admin";
my $pass = "12345";
open(my $iplist, "iplist.txt");
open(my $log, ">>log.txt");
open(my $counts, ">>counts.txt");
open(my $cmds, "commands");
my @commands = <$cmds>;
while (my $host = <$iplist>)
{
chomp($host);
my $th = new Net::Telnet(Timeout => 15, Telnetmode => 1,Errmode => "return");
print "\n======================= START =======================\n";
print "[+] Connecting to: ".$host."\n";
print "=====================================================\n";
print $log "\n======================= START =======================\n";
print $log "[+] Connecting to: ".$host."\n";
print $log "=====================================================\n";
$th->open($host);
$th->waitfor('/login|user name/i');
$th->print($user);
$th->waitfor('/password/i');
$th->print($pass);
my $i = 1;
foreach my $cmd (@commands)
{
$th->waitfor('/[$#]/');
my @out = $th->cmd($cmd);
print @out;
print $log @out;
foreach my $line (@out)
{
if ($line =~ /^(\d+)(?= MAC address learned)/)
{
print $counts $host.": ".$i.",".$1."\n";
$i++;
}
}
}
}
close($iplist);
close($log);
close($counts);
close($cmds);