From d7b0c04459a6ec42a37255c38d67cea14fb60e61 Mon Sep 17 00:00:00 2001 From: BlueRaja Date: Sat, 26 Jan 2013 03:30:45 -0600 Subject: Moved usersData table to users table, added a few more columns to users (currently unused) --- includes/chats.php | 8 +++----- includes/datas.php | 33 +++++++++------------------------ 2 files changed, 12 insertions(+), 29 deletions(-) (limited to 'includes') diff --git a/includes/chats.php b/includes/chats.php index 56c88d1..4ecf6ce 100644 --- a/includes/chats.php +++ b/includes/chats.php @@ -37,12 +37,10 @@ function getChat($startID = 0) { SELECT chat.ID, chat.userID, chat.message, chat.dateSent, users.displayName, - userData.displayColor, - userData.wallColor, - userData.wallEmblem + users.displayColor, + users.wallColor, + users.wallEmblem FROM `chat` - LEFT JOIN `userData` - ON chat.userID = userData.userID LEFT JOIN `users` ON chat.userID = users.ID WHERE chat.ID > '$startID' diff --git a/includes/datas.php b/includes/datas.php index e8e24a3..c6a0788 100644 --- a/includes/datas.php +++ b/includes/datas.php @@ -17,16 +17,14 @@ function topScores($mapid, $top = 5, $bottom = 0) { users.displayName as display, solutions.moves as m, users.ID as ID, - userData.displayColor, - userData.wallColor, - userData.wallEmblem, + users.displayColor, + users.wallColor, + users.wallEmblem, solutions.dateModified as cdate FROM `users` JOIN `solutions` ON users.ID = solutions.userID - LEFT JOIN `userData` - ON users.ID = userData.userID WHERE solutions.mapID = '$mapid' ORDER BY solutions.moves DESC, solutions.dateModified ASC LIMIT $bottom, $top @@ -43,16 +41,6 @@ function topScores($mapid, $top = 5, $bottom = 0) { $output .= ""; while (list($diff, $display, $moves, $userID, $displayColor, $wallColor, $wallEmblem, $cdate) = mysql_fetch_row($result)) { $i++; - if (!isset($displayColor)) { - $sql = "INSERT INTO `userData` (`userID`, `displayColor`, `wallColor`) - VALUES ('$userID', '#cccccc', '#666666')"; - mysql_query($sql); - $displayColor = '#cccccc'; - $wallColor = '#666666'; - $wallEmblem = 'blank.png'; - } - if ($wallEmblem == '') - $wallEmblem = 'blank.png'; //$cdate = date("g:i A (T)", strtotime($cdate)); $cdate = relativeTime(strtotime($cdate)); @@ -791,13 +779,12 @@ function getMembers($pageNumber = 1, $pageDivide = 50, $order = 'DESC', $orderBy users.totalMazes as totalMazes, users.totalWins as totalWins, users.totalTies as totalTies, - IfNull(userData.wallColor, '#666666') as wallColor, - IfNull(userData.displayColor, '#cccccc') as displayColor, - userData.wallEmblem as wallEmblem, + users.wallColor, + users.displayColor, + users.wallEmblem, users.datejoined as dateJoined, users.dateLogin as dateLogin FROM `users` - LEFT JOIN `userData` ON users.ID = userData.userID $sqlOrder LIMIT $limitTop, $pageDivide "; @@ -928,16 +915,14 @@ function getScores($mapID, $pageNumber = 1, $pageDivide = 10) { users.displayName as display, solutions.moves as moves, users.ID as ID, - IfNull(userData.displayColor, '#cccccc') as displayColor, - IfNull(userData.wallColor, '#666666') as wallColor, - IfNull(userData.wallEmblem, 'blank.png') as wallEmblem, + users.displayColor, + users.wallColor, + users.wallEmblem, solutions.dateModified as cdate FROM `users` JOIN `solutions` ON users.ID = solutions.userID - LEFT JOIN `userData` - ON users.ID = userData.userID WHERE solutions.mapID = '$mapID' ORDER BY solutions.moves DESC, solutions.dateModified ASC, solutions.ID DESC "; -- cgit v1.2.3