%@ Language=JScript %> <% var userid = String(Request.QueryString("userid")); if (userid == "undefined") userid = Session("userid"); var content = ""; //get the username var rsUser = Server.CreateObject("adodb.recordset"); var sql = "SELECT * "; sql += ", (select top 1 completetime from game where gamestatusid = 3 AND rated = 1 AND user1rating IS NOT NULL "; sql += "AND (user1id = user.id OR user2id = user.id) "; sql += "order by completetime desc) as completetime "; sql += " FROM (([user] left join country on user.countryid = country.id) "; sql += "left join timezone on timezone.id = user.timezoneid) "; sql += "WHERE user.id = " + userid; rsUser.Open(sql, connStr); var dlimit = new Date(); dlimit = dlimit.setMonth(dlimit.getMonth() - 3); var name = String(rsUser("user.name")); if (name == "null") name = ""; var icq = String(rsUser("icq")); if (icq == "null") icq = ""; var description = prepScreen(String(rsUser("description"))); if (description == "null") description = ""; var country = prepScreen(String(rsUser("country.name"))); if (country == "null") country = ""; var timezone = prepScreen(String(rsUser("timezone"))); if (timezone == "null") timezone = ""; content += "
";
content += "Player data"; content += "Username: " + rsUser("username") + " (rating: " + rsUser("rating") + ") "; if (Session("userid") != rsUser("user.id") && isLoggedIn()) content += ""; content += ""; if (String(rsUser("gameinterest")) == "1") content += "- looking for new games "; else content += "- NOT looking for new games at the moment "; //get the time of the lastest completed game var completedate = String(rsUser("completetime")); var y = completedate.substr(0, 4); var m = completedate.substr(5, 2); var d = completedate.substr(8, 2); cd = new Date(y, m - 1, d); if (dlimit > cd) content += " THIS PLAYER IS NOT ACTIVE (i.e. has not completed a game within the last 3 months)"; content += " "; content += "
| ";
content += "|||||||||||||
";
content += "Games record"; content += "(Rated and not rated games)"; content += "
"; content += "Highest rating achieved: "; //get all games that are finished var rsGame = Server.CreateObject("adodb.recordset"); sql = "select * from game where gamestatusid = 3 AND rated = 1 AND user1rating IS NOT NULL "; sql += "AND (user1id = " + userid + " OR user2id = " + userid + ") "; sql += "order by completetime"; rsGame.Open(sql, conn); var totalpoints = 1000; var maxpoints = 0; while (!(rsGame.eof || rsGame.bof)) { if (String(rsGame("user1id")) == userid) var points = Number(rsGame("user1rating")); else var points = Number(rsGame("user2rating")); totalpoints += points; if (totalpoints > maxpoints) { maxpoints = totalpoints; //get the time var maxdate = String(rsGame("completetime")); var y = maxdate.substr(0, 4); var m = maxdate.substr(5, 2); var d = maxdate.substr(8, 2); cd = new Date(y, m - 1, d); } rsGame.movenext(); } if (maxpoints > 0) { content += maxpoints + " (" + cd.toLocaleDateString() + ") "; } else content += "No finished games yet!"; content += " See all current and finished games "; content += "See all current and finished tournament games" content += " | ";
content += "