function userSetParams($user_id, $params) { global $database_cfg; $user = userGetById($user_id); if (!userExistsById($user_id)) { return; } foreach ($params as $i => $t) { if (array_key_exists($i, $user)) { $user[$i] = $t; } } databaseQuery("update " . $database_cfg["prefix"] . "users set username='******', " . " password='******', email='" . stringEncode($user["email"]) . "', nickname='" . stringEncode($user["nickname"]) . "', " . "last_visit='" . $user["last_visit"] . "' where id='" . intval($user_id) . "'", "Unable to set user params"); }
echo "E-mail:<br /><input type=\"text\" name=\"email\" value=\"" . stringDecode($user["email"]) . "\" /><br /><br />"; echo "Current password:<br /><input type=\"password\" name=\"password\" /><br /><br />"; echo "New password:<br /><input type=\"password\" name=\"pass1\" /><br /><br />"; echo "Confirm new password:<br /><input type=\"password\" name=\"pass2\" /><br /><br />"; echo "<input type=\"submit\" value=\"save\" />"; echo "</form>"; if (count($topics) > 0) { echo "<p class=\"item_top\">Your topics:</p>"; foreach ($topics as $i) { echo "<a href=\"index.php?topic_id=" . $i["id"] . "\">" . stringDecode($i["title"]) . "</a><br />"; } } } else { if (isset($_GET["user_id"])) { if (userExistsById($_GET["user_id"])) { $user = userGetById($_GET["user_id"]); $topics = topicGetByAuthor($user["id"]); echo "<h1>" . stringDecode($user["nickname"]) . "</h1><br />"; echo "E-mail:<br />" . stringDecode($user["email"]) . "<br /><br />"; echo "Last visit:<br />" . stringDecode($user["last_visit"]) . "<br /><br />"; echo "Karma:<br />" . intval($user["rating"]) . "<br /><br />"; if (count($topics) > 0) { echo "<p class=\"item_top\">User's topics:</p>"; foreach ($topics as $i) { if (!topicCheckPrivate($i["id"])) { echo "<a href=\"index.php?topic_id=" . $i["id"] . "\">" . stringDecode($i["title"]) . "</a><br />"; } } } } else { echo "<b>Error:</b> user not found";