hice esto en Perl::
Using perl Syntax Highlighting
use DBI;
use Oraperl;
$ENV{"ORACLE_HOME"} = "/opt/oracle/product/9.2.0";
$dbh = DBI-> connect("dbi:Oracle:host=algunhost;sid=algunSID", "esquema", "secreto");
DBI-> errstr;
my $ipuser =$ENV{"REMOTE_ADDR"};
$user_exists = "select ip from hit_cri where ip = '$ipuser'";
$sth = $dbh->prepare($user_exists);
$rv = $sth->execute;
my $userip = $sth->fetchrow_array;
$sth->finish;
if ($userip = $ipuser) {
$value = "select main from hit_cri where ip = '$ipuser'";
$stha = $dbh->prepare($value);
$rva = $stha->execute;
my $value_keep = $stha->fetchrow_array();
$stha->finish;
$increase = "update hit_cri set main = $value_keep + 1 where ip = '$ipuser'";
$sthb = $dbh->prepare($increase);
$rvb = $sthb->execute;
$sthb->finish;
}
else {
$new = "insert into hit_cri values(seq_visitor.nextval, '$ipuser', 1, 0, 0, 0, 0, 0, 1)";
$sthc = $dbh->prepare($new);
$rvc = $sthc->execute;
$sthc->finish;
}
$dbh->disconnect;
use Oraperl;
$ENV{"ORACLE_HOME"} = "/opt/oracle/product/9.2.0";
$dbh = DBI-> connect("dbi:Oracle:host=algunhost;sid=algunSID", "esquema", "secreto");
DBI-> errstr;
my $ipuser =$ENV{"REMOTE_ADDR"};
$user_exists = "select ip from hit_cri where ip = '$ipuser'";
$sth = $dbh->prepare($user_exists);
$rv = $sth->execute;
my $userip = $sth->fetchrow_array;
$sth->finish;
if ($userip = $ipuser) {
$value = "select main from hit_cri where ip = '$ipuser'";
$stha = $dbh->prepare($value);
$rva = $stha->execute;
my $value_keep = $stha->fetchrow_array();
$stha->finish;
$increase = "update hit_cri set main = $value_keep + 1 where ip = '$ipuser'";
$sthb = $dbh->prepare($increase);
$rvb = $sthb->execute;
$sthb->finish;
}
else {
$new = "insert into hit_cri values(seq_visitor.nextval, '$ipuser', 1, 0, 0, 0, 0, 0, 1)";
$sthc = $dbh->prepare($new);
$rvc = $sthc->execute;
$sthc->finish;
}
$dbh->disconnect;
Coloreado en 0.003 segundos, usando GeSHi 1.0.8.4
El problema que tengo es que no funciona.
Si cambio el valor de $ipuser por un valor "normal" (tipo "algo"), funciona el if. Pero si lo uso con un browser no anda. No hace nada.
Probé de todo, pero no me sale.
Por favor, ayudenme.
Gracias