Nickname active, but id provided should result in valid refid
authorRoland Häder <roland@mxchange.org>
Tue, 3 Nov 2009 15:52:44 +0000 (15:52 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 3 Nov 2009 15:52:44 +0000 (15:52 +0000)
ref.php

diff --git a/ref.php b/ref.php
index 33b656e..b308c84 100644 (file)
--- a/ref.php
+++ b/ref.php
@@ -79,8 +79,18 @@ if (!empty($ref)) {
                        // Load userid
                        list($ref) = SQL_FETCHROW($result);
                } else {
-                       // No entry found
-                       $ref = 0;
+                       // So do we have a userid?
+                       $result2 = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`='%s' LIMIT 1",
+                               array($ref), __FILE__, __LINE__);
+
+                       // Do we have an entry?
+                       if (SQL_NUMROWS($result2) == 0) {
+                               // No entry, so no referal id
+                               $ref = 0;
+                       } // END - if
+
+                       // Free result
+                       SQL_FREERESULT($result2);
                }
 
                // Free result