just off the top of my head:
add two custom fields to the idx_links table. ppc_hits and ppc_limit. both integer type ( mediumint(9) if you use phpmyadmin ).
change your go.php file as follows:
Code:
<?php
include("application.php");
session_start();
// check if suspended
$conn = ConnectDB();
$query = "select suspended, ppc_hits, ppc_limit from idx_link where link_id = '$id'";
$result = $conn->Execute($query);
$suspended = $result->Fields("suspended");
$ppc_hits = $result->Fields("ppc_hits");
$ppc_limit = $result->Fields("ppc_limit");
if($suspended) {
$theme_name = GetTheme($COOKIE_USERNAME);
if(empty($theme_name)) $theme_name = "default";
$theme_path = $theme_path.$theme_name."/";
include($theme_path."msg.php");
DisplayTemplate($theme_path."header.html","\$title,\$cat");
DisplayTemplate($theme_path."suspended.html","\$novar");
DisplayTemplate($theme_path."footer.html","\$cat,\$ma");
exit();
}
if($ppc_hits => ppc_limit ) {
$theme_name = GetTheme($COOKIE_USERNAME);
if(empty($theme_name)) $theme_name = "default";
$theme_path = $theme_path.$theme_name."/";
include($theme_path."msg.php");
DisplayTemplate($theme_path."header.html","\$title,\$cat");
DisplayTemplate($theme_path."ppc_exceeded.html","\$novar");
DisplayTemplate($theme_path."footer.html","\$cat,\$ma");
exit();
}
$links_obj = new clsLink;
$links_obj->InitDB($dbServer,$dbHostname,$dbUsername,$dbPassword,$dbName);
$links_obj->table_name = "idx_link";
$links_obj->hot_limit = $hot_limit;
$ses_links = explode(";",$_SESSION['indexu_session_links']);
if(!in_array($id,$ses_links) || count($ses_links)==0) {
$_SESSION['indexu_session_links'] = $_SESSION['indexu_session_links']."$id;";
$links_obj->Go($id,true);
}
else {
$links_obj->Go($id,false);
}
?>
open the suspended.html file, make changes as appropriate and save as ppc_exceeded.html.
Finally, find the go function in link.class.php and make the following changes:
Code:
function Go($id,$count=true) {
// get current hits
$query = "select hits, url, ppc_hits from $this->table_name where link_id=$id";
$result = $this->db_connect->Execute($query);
$url = $result->Fields("url");
$hits = $result->Fields("hits");
$ppc_hits = $result->Fields("ppc_hits");
if($count) {
// update hits
$query = "update $this->table_name set hits = ($hits + 1) ppc_hits = ( $ppc_hits + 1 ) where link_id = $id";
$result = $this->db_connect->Execute($query);
This is untested. so use at your own risk. please post any flaws...
hmmm, I just re-read your post. It doesn't suspend the link. Just won't allow the go ( to homepage ) to work..
I'm off for some fried chicken. but may take a look at suspending the account later tonite.