X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffix_user_points.php;h=d17e02515be147c0b7b75ba0e2e0bfdc7f190698;hb=a636d6415605b148ba0989f51442145cd8361ee4;hp=bcb648ced491125b4c8b075f856c7b46bdde45fd;hpb=0851db137e420b90617f47b77de2302e770f5f02;p=mailer.git diff --git a/inc/fix_user_points.php b/inc/fix_user_points.php index bcb648ced4..d17e02515b 100644 --- a/inc/fix_user_points.php +++ b/inc/fix_user_points.php @@ -42,7 +42,11 @@ if (!defined('__SECURITY')) { // Get all user points $result = SQL_QUERY('SELECT - `userid`, `points` + `userid`, + `points`, + `locked_points`, + `order_points`, + `locked_order_points` FROM `{?_MYSQL_PREFIX?}_user_points` WHERE @@ -54,8 +58,31 @@ ORDER BY if (!SQL_HASZERONUMS($result)) { // Load row by row while ($row = SQL_FETCHARRAY($result)) { - // We have to fix this amount, so first pay it directly - addPointsDirectly('user_null_fix', $row['userid'], $row['points']); + // Update the database again + foreach (array_keys($row) as $column) { + // Not userid itself + if ($column != 'userid') { + // Update amount + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_points` SET `%s`=`%s`+%s WHERE `userid`=%s AND `ref_depth` IS NULL", + array( + $column, + $column, + $row[$column], + $row['userid'] + ), __FILE__, __LINE__); + + // Nothing has been updated? + if (SQL_HASZEROAFFECTED()) { + // Then insert it + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_points` (`userid`,`ref_depth`,`%s`) VALUES (%s,NULL,%s)", + array( + $column, + $row['userid'], + $row[$column] + ), __FILE__, __LINE__); + } // END - if + } // END - if + } // END - foreach } // END - while } // END - if