finncr4
02-18-2003, 04:02 AM
I am working on a paid email site. I am looking for a way to determine if the visitor has view a site for at least 30 seconds.
I have seen this done with frames (timer on the top and the site on the bottom), but I'm not sure this would be the best way to accomplish this.
Thanks for your help. Here is the script where I want to put the code:
use CGI::Carp qw(fatalsToBrowser);
require "user-list.inc";
require "$datadir/iEarnings.pm";
$qinfo = $ENV{'QUERY_STRING'};
($uid, $linkid) = split(/\//, $qinfo);
&PrepareMySQL("SELECT linkurl FROM $orderstable WHERE linkid='$linkid'");
$ourl = $result->fetchrow_hashref();
$order_url = $ourl->{'linkurl'};
$result->finish;
&GetMemberInfo($uid);
if ($userid ne "" && $order_url ne "") {
&PrepareMySQL("SELECT COUNT(*) FROM $tracktable WHERE userid='$userid' AND linkid='$linkid'");
$dc = 0;
while ($dci = $result->fetchrow_array)
{ $dc = $dci; }
$result->finish;
&PrepareMySQL("SELECT maxclicks, clicks FROM $orderstable WHERE linkid='$linkid'");
$cdc = 0;
$cdci = $result->fetchrow_hashref();
$mclicks = $cdci->{'maxclicks'};
$clicks = $cdci->{'clicks'};
$result->finish;
if ($mclicks <= $clicks) {
&DoMySQL("UPDATE $orderstable SET datedone='$shortdate' WHERE linkid='$linkid'");
&PrintMessage("ERROR","The link you clicked on has expired ($mclicks|$clicks)...");
exit; }
if ($dc == 0) {
&DoMySQL("INSERT INTO $tracktable (userid, ipadd, linkid, date, time) VALUES ('$userid','$ipadd','$linkid','$shortdate','$timenow')");
&DoMySQL("UPDATE $orderstable SET clicks=(clicks + 1) WHERE linkid='$linkid'");
&DoMySQL("UPDATE $bookstable SET emailclicks=(emailclicks + 1), earned=(earned + $earn_eclick) WHERE userid='$userid'"); }
&CloseMySQL; }
if ($order_url eq "") { $order_url = $clickthru_url; }
print "Location: $order_url\n\n";
exit;
I have seen this done with frames (timer on the top and the site on the bottom), but I'm not sure this would be the best way to accomplish this.
Thanks for your help. Here is the script where I want to put the code:
use CGI::Carp qw(fatalsToBrowser);
require "user-list.inc";
require "$datadir/iEarnings.pm";
$qinfo = $ENV{'QUERY_STRING'};
($uid, $linkid) = split(/\//, $qinfo);
&PrepareMySQL("SELECT linkurl FROM $orderstable WHERE linkid='$linkid'");
$ourl = $result->fetchrow_hashref();
$order_url = $ourl->{'linkurl'};
$result->finish;
&GetMemberInfo($uid);
if ($userid ne "" && $order_url ne "") {
&PrepareMySQL("SELECT COUNT(*) FROM $tracktable WHERE userid='$userid' AND linkid='$linkid'");
$dc = 0;
while ($dci = $result->fetchrow_array)
{ $dc = $dci; }
$result->finish;
&PrepareMySQL("SELECT maxclicks, clicks FROM $orderstable WHERE linkid='$linkid'");
$cdc = 0;
$cdci = $result->fetchrow_hashref();
$mclicks = $cdci->{'maxclicks'};
$clicks = $cdci->{'clicks'};
$result->finish;
if ($mclicks <= $clicks) {
&DoMySQL("UPDATE $orderstable SET datedone='$shortdate' WHERE linkid='$linkid'");
&PrintMessage("ERROR","The link you clicked on has expired ($mclicks|$clicks)...");
exit; }
if ($dc == 0) {
&DoMySQL("INSERT INTO $tracktable (userid, ipadd, linkid, date, time) VALUES ('$userid','$ipadd','$linkid','$shortdate','$timenow')");
&DoMySQL("UPDATE $orderstable SET clicks=(clicks + 1) WHERE linkid='$linkid'");
&DoMySQL("UPDATE $bookstable SET emailclicks=(emailclicks + 1), earned=(earned + $earn_eclick) WHERE userid='$userid'"); }
&CloseMySQL; }
if ($order_url eq "") { $order_url = $clickthru_url; }
print "Location: $order_url\n\n";
exit;