require ("config.php"); require("kcsm.php"); kc_auth_admin(); if (!empty($clientID)) $Session["clientID"] = "$clientID"; else unset($Session["clientID"]); // If submit is set, shove the data into the database (well, after some error checking) if (isset($submit)) { // Do error checking // If ID is not set, it should be a null-value for the auto_increment $message = $strClientModified; if (empty($Session["clientID"])) { $Session["clientID"] = "null"; $message = $strClientAdded; } if (strtolower($unlimitedviews)=="on") $views=-1; if (strtolower($unlimitedclicks)=="on") $clicks=-1; if (strtolower($unlimiteddays_left)=="on") $expire = '0000-00-00'; else $expire = "DATE_ADD(CURDATE(), INTERVAL $days_left DAY)"; if($clicks>0 OR $views>0 OR $clicks==-1 OR $views==-1) { $active="true"; db_query("UPDATE $phpAds_tbl_banners SET active='$active' WHERE clientID='$clientID'"); } $clientID=$Session["clientID"]; $res = db_query(" REPLACE INTO $phpAds_tbl_clients(clientID, clientname, contact, email, views, clicks, clientusername, clientpassword, expire) VALUES ('$clientID', '$clientname', '$contact', '$email', '$views', '$clicks', '$clientusername', '$clientpassword', $expire)") or mysql_die(); Header("Location: admin.php$fncpageid&message=".urlencode($message)); exit; } page_header("$phpAds_name"); // If we find an ID, means that we're in update mode if (isset($clientID)) { show_nav("1.2"); $res = db_query(" SELECT *, to_days(expire) as expire_day, to_days(curdate()) as cur_date FROM $phpAds_tbl_clients WHERE clientID = $clientID ") or mysql_die(); $row = mysql_fetch_array($res); if ($row["expire"]=="0000-00-00") $days_left=-1; else $days_left=$row["expire_day"] - $row["cur_date"]; } else { show_nav("1.1"); } if (empty($row["views"])) $row["views"]=-1; if (empty($row["clicks"])) $row["clicks"]=-1; if (empty($days_left)) $days_left=-1; ?>
page_footer(); ?>