diff --git a/www/login/config.php b/www/login/config.php new file mode 100644 index 00000000..62c13d2d --- /dev/null +++ b/www/login/config.php @@ -0,0 +1,15 @@ + diff --git a/www/login/css/login.css b/www/login/css/login.css new file mode 100644 index 00000000..2d178016 --- /dev/null +++ b/www/login/css/login.css @@ -0,0 +1,3 @@ +.loginBody { + background-color: #EFEFEF; +} \ No newline at end of file diff --git a/www/login/database.php b/www/login/database.php new file mode 100644 index 00000000..79aabc0b --- /dev/null +++ b/www/login/database.php @@ -0,0 +1,388 @@ +select_db($database); + $dataConnection->query("SET NAMES 'utf8'"); + + return $dataConnection; +} + +$g_databaseConnection = CreateDatabaseConnection($db_server, $db_username, $db_password, $db_database); + +function GenerateRandomSha224() +{ + mt_srand(microtime(true) * 100000 + memory_get_usage(true)); + return hash("sha224", uniqid(mt_rand(), true)); +} + +function VerifyUser($dataConnection, $username, $password) +{ + $statement = $dataConnection->prepare("SELECT id, passhash, salt FROM users WHERE name = ?"); + if(!$statement) + { + throw new Exception(__FUNCTION__ . " failed: " . $dataConnection->error); + } + + try + { + $statement->bind_param('s', $username); + if(!$statement->execute()) + { + throw new Exception(__FUNCTION__ . " failed."); + } + + $statement->bind_result($id, $storedPasshash, $salt); + if(!$statement->fetch()) + { + throw new Exception(__FUNCTION__ . " failed."); + } + + $saltedPassword = $password . $salt; + $hashedPassword = hash("sha224", $saltedPassword); + + if($hashedPassword !== $storedPasshash) + { + throw new Exception(__FUNCTION__ . " failed."); + } + + return $id; + } + finally + { + $statement->close(); + } +} + +function InsertUser($dataConnection, $username, $passhash, $salt, $email) +{ + { + $statement = $dataConnection->prepare("INSERT INTO users (name, passhash, salt, email) VALUES (?, ?, ?, ?)"); + if(!$statement) + { + throw new Exception(__FUNCTION__ . " failed: " . $dataConnection->error); + } + + try + { + $statement->bind_param('ssss', $username, $passhash, $salt, $email); + + if(!$statement->execute()) + { + throw new Exception(__FUNCTION__ . " failed."); + } + } + finally + { + $statement->close(); + } + } +} + +function RefreshOrCreateSession($dataConnection, $userId) +{ + try + { + $sessionId = GetSessionFromUserId($dataConnection, $userId); + RefreshSession($dataConnection, $sessionId); + } + catch(Exception $e) + { + $sessionId = CreateSession($dataConnection, $userId); + } + + return $sessionId; +} + +function CreateSession($dataConnection, $userId) +{ + //Delete any session that might be active + { + $statement = $dataConnection->prepare("DELETE FROM sessions WHERE userId = ?"); + if(!$statement) + { + throw new Exception("Failed to create session: " . $dataConnection->error); + } + + try + { + $statement->bind_param('i', $userId); + + if(!$statement->execute()) + { + throw new Exception("Failed to create session: " . $dataConnection->error); + } + } + finally + { + $statement->close(); + } + } + + //Create new session + { + $sessionId = GenerateRandomSha224(); + + $statement = $dataConnection->prepare("INSERT INTO sessions (id, userid, expiration) VALUES (?, ?, NOW() + INTERVAL " . FFXIV_SESSION_LENGTH . " HOUR)"); + if(!$statement) + { + throw new Exception("Failed to create session: " . $dataConnection->error); + } + + try + { + $statement->bind_param('si', $sessionId, $userId); + + if(!$statement->execute()) + { + throw new Exception("Failed to create session: " . $dataConnection->error); + } + } + finally + { + $statement->close(); + } + + return $sessionId; + } +} + +function GetSessionFromUserId($dataConnection, $userId) +{ + $statement = $dataConnection->prepare("SELECT id FROM sessions WHERE userId = ? AND expiration > NOW()"); + if(!$statement) + { + throw new Exception("Failed to get session id: " . $dataConnection->error); + } + + try + { + $statement->bind_param('i', $userId); + + if(!$statement->execute()) + { + throw new Exception("Failed to get session id: " . $dataConnection->error); + } + + $statement->bind_result($sessionId); + if(!$statement->fetch()) + { + throw new Exception("Failed to get session id: " . $dataConnection->error); + } + + return $sessionId; + } + finally + { + $statement->close(); + } +} + +function RefreshSession($dataConnection, $sessionId) +{ + $statement = $dataConnection->prepare("UPDATE sessions SET expiration = NOW() + INTERVAL " . FFXIV_SESSION_LENGTH . " HOUR WHERE id = ?"); + if(!$statement) + { + throw new Exception("Failed to refresh session: " . $dataConnection->error); + } + + try + { + $statement->bind_param('s', $sessionId); + + if(!$statement->execute()) + { + throw new Exception("Failed to refresh session: " . $dataConnection->error); + } + } + finally + { + $statement->close(); + } +} + +function GetUserIdFromSession($dataConnection, $sessionId) +{ + $statement = $dataConnection->prepare("SELECT userId FROM sessions WHERE id = ? AND expiration > NOW()"); + if(!$statement) + { + throw new Exception("Could not get user id."); + } + + try + { + $statement->bind_param('s', $sessionId); + if(!$statement->execute()) + { + throw new Exception("Could not get user id."); + } + + $statement->bind_result($userId); + if(!$statement->fetch()) + { + throw new Exception("Could not get user id."); + } + + return $userId; + } + finally + { + $statement->close(); + } +} + +function GetUserInfo($dataConnection, $userId) +{ + $statement = $dataConnection->prepare("SELECT name FROM users WHERE id = ?"); + if(!$statement) + { + throw new Exception("Failed to get user information: " . $dataConnection->error); + } + + try + { + $statement->bind_param('i', $userId); + if(!$statement->execute()) + { + throw new Exception("Failed to get user information: " . $dataConnection->error); + } + + $result = $statement->get_result(); + if(!$result) + { + throw new Exception("Failed to get user information: " . $dataConnection->error); + } + + $row = $result->fetch_assoc(); + if(!$row) + { + throw new Exception("Failed to get user information: " . $dataConnection->error); + } + + return $row; + } + finally + { + $statement->close(); + } +} + +function GetUserCharacters($dataConnection, $userId) +{ + $statement = $dataConnection->prepare("SELECT id, name FROM characters WHERE userId = ?"); + if(!$statement) + { + throw new Exception(__FUNCTION__ . " failed: " . $dataConnection->error); + } + + try + { + $statement->bind_param('i', $userId); + if(!$statement->execute()) + { + throw new Exception(__FUNCTION__ . " failed: " . $dataConnection->error); + } + + $result = $statement->get_result(); + if(!$result) + { + throw new Exception(__FUNCTION__ . " failed: " . $dataConnection->error); + } + + $characters = array(); + + while(1) + { + $row = $result->fetch_assoc(); + if(!$row) + { + break; + } + array_push($characters, $row); + } + + return $characters; + } + finally + { + $statement->close(); + } +} + +function GetCharacterInfo($dataConnection, $userId, $characterId) +{ + $query = sprintf("SELECT * FROM characters WHERE userId = '%d' AND id = '%d'", + $userId, $characterId); + $result = $dataConnection->query($query); + if(!$result) + { + throw new Exception(__FUNCTION__ . " failed: " . $dataConnection->error); + } + + $row = $result->fetch_assoc(); + if(!$row) + { + throw new Exception(__FUNCTION__ . " failed: " . $dataConnection->error); + } + + return $row; +} + +function UpdateCharacterInfo($dataConnection, $characterId, $characterInfo) +{ + $statement = $dataConnection->prepare("UPDATE ffxiv_characters SET + name = ?, tribe = ?, size = ?, voice = ?, skinColor = ?, hairStyle = ?, hairColor = ?, hairOption = ?, + eyeColor = ?, faceType = ?, faceBrow = ?, faceEye = ?, faceIris = ?, faceNose = ?, faceMouth = ?, faceJaw = ?, + faceCheek = ?, faceOption1 = ?, faceOption2 = ?, guardian = ?, birthMonth = ?, birthDay = ?, allegiance = ?, + weapon1 = ?, weapon2 = ?, headGear = ?, bodyGear = ?, legsGear = ?, handsGear = ?, feetGear = ?, + waistGear = ?, rightEarGear = ?, leftEarGear = ?, rightFingerGear = ?, leftFingerGear = ? + WHERE id = ?"); + if(!$statement) + { + throw new Exception("Failed to update character information: " . $dataConnection->error); + } + + try + { + if(!$statement->bind_param("siiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii", + $characterInfo["name"], $characterInfo["tribe"], $characterInfo["size"], $characterInfo["voice"], + $characterInfo["skinColor"], $characterInfo["hairStyle"], $characterInfo["hairColor"], + $characterInfo["hairOption"], $characterInfo["eyeColor"], $characterInfo["faceType"], + $characterInfo["faceBrow"], $characterInfo["faceEye"], $characterInfo["faceIris"], + $characterInfo["faceNose"], $characterInfo["faceMouth"], $characterInfo["faceJaw"], + $characterInfo["faceCheek"], $characterInfo["faceOption1"], $characterInfo["faceOption2"], + $characterInfo["guardian"], $characterInfo["birthMonth"], $characterInfo["birthDay"], $characterInfo["allegiance"], + $characterInfo["weapon1"], $characterInfo["weapon2"], $characterInfo["headGear"], $characterInfo["bodyGear"], + $characterInfo["legsGear"], $characterInfo["handsGear"], $characterInfo["feetGear"], + $characterInfo["waistGear"], $characterInfo["rightEarGear"], $characterInfo["leftEarGear"], + $characterInfo["rightFingerGear"], $characterInfo["leftFingerGear"], + $characterId)) + { + throw new Exception("Failed to update character information: " . $dataConnection->error); + } + + if(!$statement->execute()) + { + throw new Exception("Failed to update character information: " . $dataConnection->error); + } + } + finally + { + $statement->close(); + } +} + +?> diff --git a/www/login/img/banner.png b/www/login/img/banner.png new file mode 100644 index 00000000..c1f68fd2 Binary files /dev/null and b/www/login/img/banner.png differ diff --git a/www/login/img/btLogin.gif b/www/login/img/btLogin.gif new file mode 100644 index 00000000..5a044723 Binary files /dev/null and b/www/login/img/btLogin.gif differ diff --git a/www/login/img/lbSQEXId_mem.gif b/www/login/img/lbSQEXId_mem.gif new file mode 100644 index 00000000..bef27324 Binary files /dev/null and b/www/login/img/lbSQEXId_mem.gif differ diff --git a/www/login/img/lbSQEXPass_mem.gif b/www/login/img/lbSQEXPass_mem.gif new file mode 100644 index 00000000..03992a63 Binary files /dev/null and b/www/login/img/lbSQEXPass_mem.gif differ diff --git a/www/login/img/logo.png b/www/login/img/logo.png new file mode 100644 index 00000000..f71cee4e Binary files /dev/null and b/www/login/img/logo.png differ diff --git a/www/login/index.php b/www/login/index.php new file mode 100644 index 00000000..fcfb3218 --- /dev/null +++ b/www/login/index.php @@ -0,0 +1,151 @@ +getMessage(); + } + } + +?> + + + + + + + + "); ?> + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + +
+
+

+
+ +
+ Don't have a awesome account? +
+ +
+ +
+ + \ No newline at end of file diff --git a/www/config.php b/www/login_su/config.php similarity index 100% rename from www/config.php rename to www/login_su/config.php diff --git a/www/control_panel.php b/www/login_su/control_panel.php similarity index 100% rename from www/control_panel.php rename to www/login_su/control_panel.php diff --git a/www/control_panel_common.php b/www/login_su/control_panel_common.php similarity index 100% rename from www/control_panel_common.php rename to www/login_su/control_panel_common.php diff --git a/www/control_panel_edit_character.php b/www/login_su/control_panel_edit_character.php similarity index 99% rename from www/control_panel_edit_character.php rename to www/login_su/control_panel_edit_character.php index 470b6f41..a05b895b 100644 --- a/www/control_panel_edit_character.php +++ b/www/login_su/control_panel_edit_character.php @@ -107,11 +107,11 @@ $g_yesno = array( ); $g_grandcompany = array( - 0 => "None", - /* TODO: Find correct order for 1+ */ - 1 => "Maelstrom", - 2 => "Order of the Twin Adder ", - 3 => "Immortal Flames" + 0 => "None", + /* TODO: Find correct order for 1+ */ + 1 => "Maelstrom", + 2 => "Order of the Twin Adder ", + 3 => "Immortal Flames" ); $g_profileMapping = array( diff --git a/www/control_panel_header.php b/www/login_su/control_panel_header.php similarity index 100% rename from www/control_panel_header.php rename to www/login_su/control_panel_header.php diff --git a/www/control_panel_login.php b/www/login_su/control_panel_login.php similarity index 100% rename from www/control_panel_login.php rename to www/login_su/control_panel_login.php diff --git a/www/control_panel_logout.php b/www/login_su/control_panel_logout.php similarity index 100% rename from www/control_panel_logout.php rename to www/login_su/control_panel_logout.php diff --git a/www/create_user.php b/www/login_su/create_user.php similarity index 100% rename from www/create_user.php rename to www/login_su/create_user.php diff --git a/www/create_user_success.php b/www/login_su/create_user_success.php similarity index 100% rename from www/create_user_success.php rename to www/login_su/create_user_success.php diff --git a/www/css/global.css b/www/login_su/css/global.css similarity index 100% rename from www/css/global.css rename to www/login_su/css/global.css diff --git a/www/css/reset.css b/www/login_su/css/reset.css similarity index 100% rename from www/css/reset.css rename to www/login_su/css/reset.css diff --git a/www/database.php b/www/login_su/database.php similarity index 100% rename from www/database.php rename to www/login_su/database.php diff --git a/www/favicon.ico b/www/login_su/favicon.ico similarity index 100% rename from www/favicon.ico rename to www/login_su/favicon.ico diff --git a/www/header.php b/www/login_su/header.php similarity index 100% rename from www/header.php rename to www/login_su/header.php diff --git a/www/img/logo.png b/www/login_su/img/logo.png similarity index 100% rename from www/img/logo.png rename to www/login_su/img/logo.png diff --git a/www/login.php b/www/login_su/login.php similarity index 100% rename from www/login.php rename to www/login_su/login.php diff --git a/www/presets_armor.json b/www/login_su/presets_armor.json similarity index 100% rename from www/presets_armor.json rename to www/login_su/presets_armor.json diff --git a/www/presets_weapon.json b/www/login_su/presets_weapon.json similarity index 100% rename from www/presets_weapon.json rename to www/login_su/presets_weapon.json diff --git a/www/patch/ffxiv/48eca647/metainfo/D2010.09.19.0000.torrent b/www/patch/ffxiv/48eca647/metainfo/D2010.09.19.0000.torrent new file mode 100644 index 00000000..a01c5ef6 Binary files /dev/null and b/www/patch/ffxiv/48eca647/metainfo/D2010.09.19.0000.torrent differ diff --git a/www/patch/ffxiv/48eca647/metainfo/D2010.09.23.0000.torrent b/www/patch/ffxiv/48eca647/metainfo/D2010.09.23.0000.torrent new file mode 100644 index 00000000..ba51ba5c Binary files /dev/null and b/www/patch/ffxiv/48eca647/metainfo/D2010.09.23.0000.torrent differ diff --git a/www/patch/ffxiv/48eca647/metainfo/D2012.05.20.0000.0001.torrent b/www/patch/ffxiv/48eca647/metainfo/D2012.05.20.0000.0001.torrent new file mode 100644 index 00000000..6cd55e8e Binary files /dev/null and b/www/patch/ffxiv/48eca647/metainfo/D2012.05.20.0000.0001.torrent differ diff --git a/www/patch/ffxiv/48eca647/patch/D2010.09.23.0000.patch b/www/patch/ffxiv/48eca647/patch/D2010.09.23.0000.patch new file mode 100644 index 00000000..d28c7adf Binary files /dev/null and b/www/patch/ffxiv/48eca647/patch/D2010.09.23.0000.patch differ diff --git a/www/patch/test.php b/www/patch/test.php new file mode 100644 index 00000000..a612015f --- /dev/null +++ b/www/patch/test.php @@ -0,0 +1,3 @@ + + +