<% @ Language="JavaScript" %> <% var usrId = Session("usrId"); var usrRole = Session("usrRole"); if (usrId == null || usrId == "") { // Response.Redirect("./login.html"); usrId = "guest"; usrRole = Role.GUEST_ROLE; } var gameMode = parseInt(Request("m")); switch (gameMode) { case Mode.MATCH_MODE: Response.Redirect("./error.html"); break; case Mode.EDIT_MODE: if (usrRole != Role.ADMIN_ROLE) { // Response.Redirect("./error.html"); gameMode = Mode.VIEW_MODE; } break; case Mode.VIEW_MODE: break; case Mode.SELF_MODE: Response.Redirect("./error.html"); break; default: Response.Redirect("./error.html"); break; } var roomId = Request("r"); if (!isValidSQLParameter(roomId)) { Response.Redirect("./error.html"); } var gameId = ("" + Request("g")); gameId = (gameId == null || gameId == "") ? 0 : parseInt(gameId); if (!isValidSQLParameter(gameId)) { Response.Redirect("./error.html"); } if (gameId == 0) { var newGame = Server.CreateObject("ADODB.Recordset"); newGame.open("select (max(ROW_ID) + 1) GAME_ID from D_GAME;", connection); gameId = parseInt(("" + newGame("GAME_ID"))); newGame.close(); newGame = null; connection.execute("insert into D_GAME(ROW_ID, LAST_MOVE, MOVES) values(" + gameId + ", 0, '[]');"); connection.execute("update D_ROOM set GAME_ID=" + gameId + " where ROW_ID=" + roomId + ";"); connection.close(); connection = null; Response.Redirect("http://www.rifchina.com/renju/game.asp?r=" + roomId + "&g=" + gameId + "&m=" + gameMode); } var rmSet = Server.CreateObject("ADODB.Recordset"); // // 1. To view previous games, use right outer join. // rmSet.open("select " + " (case when g.NAME='' then r.NAME else g.NAME end) GAME_TITLE, " + " (case when g.BLACK_PLAYER_NAME='' then b.USER_NAME else g.BLACK_PLAYER_NAME end) BLACK_PLAYER, " + " (case when g.WHITE_PLAYER_NAME='' then w.USER_NAME else g.WHITE_PLAYER_NAME end) WHITE_PLAYER, " + " g.RESULT RESULT, " + " g.MOVES MOVES, " + " g.LAST_MOVE LAST_MOVE " + " from " + " D_ROOM r " + " right outer join D_GAME g on r.GAME_ID=g.ROW_ID " + " left outer join D_USER b on g.BLACK_PLAYER=b.ROW_ID " + " left outer join D_USER w on g.WHITE_PLAYER=w.ROW_ID " + " where " + " g.ROW_ID=" + gameId + ";" , connection); // // 2. To play current game in a room, use left outer join. // // rmSet.open("select " // + " (case when g.NAME='' then r.NAME else g.NAME end) GAME_TITLE, " // + " (case when g.BLACK_PLAYER_NAME='' then b.USER_NAME else g.BLACK_PLAYER_NAME end) BLACK_PLAYER, " // + " (case when g.WHITE_PLAYER_NAME='' then w.USER_NAME else g.WHITE_PLAYER_NAME end) WHITE_PLAYER, " // + " g.RESULT RESULT, " // + " g.MOVES MOVES, " // + " g.LAST_MOVE LAST_MOVE " // + " from " // + " D_ROOM r " // + " left outer join D_GAME g on r.GAME_ID=g.ROW_ID " // + " left outer join D_USER b on g.BLACK_PLAYER=b.ROW_ID " // + " left outer join D_USER w on g.WHITE_PLAYER=w.ROW_ID " // + " where " // + " r.ROW_ID=" + roomId + ";" // , connection); if (!rmSet.EOF) { %> 中国连珠网棋谱库五子棋谱页
<% if (gameMode == Mode.EDIT_MODE) { %> <% } else { %> <% } %> <% if (gameMode == Mode.EDIT_MODE) { %> <% } else { %> <% } %> <% if (gameMode == Mode.EDIT_MODE) { %> <% } else { %> <% } %> <% if (gameMode == Mode.EDIT_MODE) { %> <% } else { %> <% } %>
标题:
<%= rmSet("GAME_TITLE") %>
黑: 黑:
<%= rmSet("BLACK_PLAYER") %>
白: 白:
<%= rmSet("WHITE_PLAYER") %>
结果:
<%= rmSet("RESULT") %>

核心设计:吴桐

<% } rmSet.close(); rmSet = null; connection.close(); connection = null; %>