]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/jackpot_functions.php
Mailer project continued:
[mailer.git] / inc / libs / jackpot_functions.php
index 013ba16b4014b41b9e7b65d25010f49cffd83c17..a71f843b6534434aafbe4edc87852a4651092cb2 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 10/23/2009 *
- * ===============                              Last change: 10/23/2009 *
+ * Mailer v0.2.1-FINAL                                Start: 10/23/2009 *
+ * ===================                          Last change: 10/23/2009 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : jackpot_functions.php                            *
  * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
  * $Author::                                                          $ *
- * Needs to be in all Files and every File needs "svn propset           *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
@@ -45,25 +44,25 @@ if (!defined('__SECURITY')) {
 // Getter for jackpot points
 function getJackpotPoints () {
        // Default is zero
-       $jackpot = '0.00000';
+       $data['points'] = '0.00000';
 
        // Read them
        $result = SQL_QUERY("SELECT `points` FROM `{?_MYSQL_PREFIX?}_jackpot` WHERE `ok`='ok' LIMIT 1", __FUNCTION__, __LINE__);
 
-       // Do we have an entry?
-       if (SQL_NUMROWS($result) == '0') {
+       // Is there an entry?
+       if (SQL_HASZERONUMS($result)) {
                // No, so create line
                SQL_QUERY("INSERT INTO `{?_MYSQL_PREFIX?}_jackpot` (`ok`, `points`) VALUES ('ok','0.00000')", __FUNCTION__, __LINE__);
        } else {
                // Read the line
-               list($jackpot) = SQL_FETCHROW($result);
+               $data = SQL_FETCHARRAY($result);
        }
 
        // Free result
        SQL_FREERESULT($result);
 
        // Return them
-       return $jackpot;
+       return $data['points'];
 }
 
 // Adds points to the jackpot
@@ -79,7 +78,7 @@ function addPointsToJackpot ($points) {
 // Subtracts points from the jackpot
 function subtractPointsFromJackpot ($points) {
        // First failed
-       $ret = '-1';
+       $ret = false;
 
        // Get jackpot points for dummy
        $jackpot = getJackpotPoints();
@@ -89,7 +88,7 @@ function subtractPointsFromJackpot ($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), __FUNCTION__, __LINE__);
-               $ret = $jackpot - $points;
+               $ret = (!SQL_HASZEROAFFECTED());
        } // END - if
 
        // Free memory