finncr4
02-18-2003, 03:55 AM
I am working on a paid email program and I need to keep track of how long a site has been viewed 30 seconds or longer before the user is credit for visiting the site.
I've seen this done using frames, the paidemail site is on top and the url to view is on the bottom, but I don't see how you could really know if the person had visited the site for 30 seconds.
Thanks for your help.
Here is the script I am working with:
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've seen this done using frames, the paidemail site is on top and the url to view is on the bottom, but I don't see how you could really know if the person had visited the site for 30 seconds.
Thanks for your help.
Here is the script I am working with:
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;