-//
-function ADD_JACKPOT($points) {
- $result = SQL_QUERY("SELECT points FROM `{!_MYSQL_PREFIX!}_jackpot` WHERE ok='ok' LIMIT 1", __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 0) {
- // Create line
- SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_jackpot` (ok, points) VALUES ('ok','%s')", array($points), __FILE__, __LINE__);
- } else {
- // Free memory
- SQL_FREERESULT($result);
-
- // Update points
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_jackpot` SET points=points+%s WHERE ok='ok' LIMIT 1",
- array($points), __FILE__, __LINE__);
- }
-}
-//
-function SUB_JACKPOT($points) {
- // First failed
- $ret = "-1";
-
- // Get current points
- $result = SQL_QUERY("SELECT points FROM `{!_MYSQL_PREFIX!}_jackpot` WHERE ok='ok' LIMIT 1", __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 0) {
- // Create line
- SQL_QUERY("INSERT INTO `{!_MYSQL_PREFIX!}_jackpot` (ok, points) VALUES ('ok', 0.00000)", __FILE__, __LINE__);
- } else {
- // Read points
- list($jackpot) = SQL_FETCHROW($result);
- if ($jackpot >= $points) {
- // Update points when there are enougth points in jackpot
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_jackpot` SET points=points-%s WHERE ok='ok' LIMIT 1",
- array($points), __FILE__, __LINE__);
- $ret = $jackpot - $points;
- } // END - if
- }
-
- // Free memory
- SQL_FREERESULT($result);
-}
-//
-function IS_DEMO () {
- return ((EXT_IS_ACTIVE("demo")) && (get_session('admin_login') == "demo"));
-}
-//
-function LOAD_CONFIG ($no="0") {
- global $cacheArray;
- $CFG_DUMMY = array();
-
- // Check for cache extension, cache-array and if the requested configuration is in cache
- if ((is_array($cacheArray)) && (isset($cacheArray['config'][$no])) && (is_array($cacheArray['config'][$no]))) {
- // Load config from cache
- //* DEBUG: */ echo gettype($cacheArray['config'][$no])."<br />\n";
- foreach ($cacheArray['config'][$no] as $key => $value) {
- $CFG_DUMMY[$key] = $value;
- } // END - foreach
-
- // Count cache hits if exists
- if ((isset($CFG_DUMMY['cache_hits'])) && (EXT_IS_ACTIVE("cache"))) {
- $CFG_DUMMY['cache_hits']++;
- } // END - if
- } elseif ((!EXT_IS_ACTIVE("cache")) || (!isset($cacheArray['config'][$no]))) {
- // Load config from DB
- $result_config = SQL_QUERY_ESC("SELECT * FROM `{!_MYSQL_PREFIX!}_config` WHERE config=%d LIMIT 1",
- array(bigintval($no)), __FILE__, __LINE__);
-
- // Get config from database
- $CFG_DUMMY = SQL_FETCHARRAY($result_config);
-
- // Free result
- SQL_FREERESULT($result_config);
-
- // Remember this config in the array
- $cacheArray['config'][$no] = $CFG_DUMMY;
- }