Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!defined('VG')){ die; }
- class Generic {
- function connectPerp() {
- global $config;
- if(!mysql_connect($config['serverDB']['host'], $config['serverDB']['username'], $config['serverDB']['password'])){
- return false;
- }else{
- mysql_select_db($config['serverDB']['database']);
- return true;
- }
- }
- function connectForum() {
- global $config;
- if(!mysql_connect($config['siteDB']['host'], $config['siteDB']['username'], $config['siteDB']['password'])){
- return false;
- }else{
- mysql_select_db($config['siteDB']['database']);
- return true;
- }
- }
- function setempty($str) {
- if(isset($str) && !empty($str)){ return true; }else{ return false; }
- }
- function red($url){
- header('Location: '.$url);
- ob_end_flush();
- }
- function date($time, $format = 'm/d/Y h:i A') {
- return date($format, $time);
- }
- function initCaching($cachefile, $cachereset, $location = 'top'){
- if($location == 'top'){
- if(file_exists($cachefile) && ((time() - $cachereset) < filemtime($cachefile))){
- include($cachefile);
- exit;
- }
- }else{
- $fp = fopen($cachefile, 'w');
- fwrite($fp, "<? if(!defined('VG')){ die; } ?>".ob_get_contents());
- fclose($fp);
- ob_end_flush();
- }
- }
- function banPointCron() {
- $this->connectPerp();
- $q = mysql_query("SELECT `steamid`, `id` FROM `server_bans_points` WHERE `time` < '".time()."'");
- while($a = mysql_fetch_array($q)){
- mysql_query("UPDATE `ip_intel` SET `strikes` = strikes - 1 WHERE `steamid` = '".mysql_escape_string($a['steamid'])."'");
- mysql_query("DELETE FROM `server_bans_points` WHERE `id` = '".$a['id']."'");
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement