implement some user input length checks.

This commit is contained in:
SilicaAndPina 2021-06-11 10:34:39 +12:00
parent 323d5f4408
commit fc10d85d27
5 changed files with 44 additions and 9 deletions

View file

@ -49,13 +49,24 @@
"motd_format":"<FONT COLOR='#FF0000'><B>Today's Note:</B> %MOTD%</FONT>",
"login_format":"Player %USERNAME% has logged in",
"logout_format":"Player %USERNAME% has disconnected",
"profile_save":"Your profile changes were saved.",
"profile":{
"save":"Your profile changes were saved.",
"too_long":"Profile TOO LONG, 4,000 char max!",
"blocked":"Profile NOT SAVED, Chat Violations Present! (%REASON%)",
"profanity":"Profanity detected.",
"personal_info":"No giving out personal info/websites.",
},
"private_notes_save":"Saved Private Notes.",
"buddy_request":"Attempting to Add Buddy. The other player must click ADD BUDDY as well. (Many players reserve this for just a couple players so don't feel insulted if they do not).",
"click_nothing_message":"Nothing interesting here...",
"playtime_timeout":"You have run out of playtime for now. In one minute you will be disconnected. You gain one minute of playtime every 8 minutes. Please come back later!",
"random_movement":"You are sooo <B>%STAT%</B>. You wander dizzily in a different direction.",
"movement_key":[{"stat":"THIRSTY", "msg":"dizzily"}, {"stat":"HUNGERY", "msg":"stumble"}, {"stat":"TIREDNESS", "msg":"???"}],
"movement_key":[
{"stat":"THIRSTY", "msg":"dizzily"},
{"stat":"HUNGERY", "msg":"stumble"},
{"stat":"TIREDNESS", "msg":"???"}
],
"incorrect_password":"Incorrect. You will have to find the correct answer somewhere...",
"player_here":"%USERNAME% here",
"no_telescope":"You do not have a telescope to use! You try making circles with your hands and placing them in front of one eye, but it is of minimal aid...",
@ -593,6 +604,7 @@
"unowned_ranch_click":"Unowned Ranch",
"click_message":"%USERNAME%'s %TITLE%",
"no_dorothy_shoes":"You do not have Dorothy Shoes. They come with a ranch.",
"dorothy_message":"There's no place like home... There's no place like home...",
"dorothy_prison_isle":"You tap them together a bunch of times, but nothing.. They don't work here!",

View file

@ -585,10 +585,17 @@ namespace HISP.Game
// Records
public static string ProfileSavedMessage;
public static string PrivateNotesSavedMessage;
public static string PrivateNotesMetaFormat;
// Profile
public static string ProfileSavedMessage;
public static string ProfileTooLongMessage;
public static string ProfileViolationFormat;
public static string ProfileViolationPersonalInfo;
public static string ProfileViolationProfanity;
// Hay Pile
public static string HasPitchforkMeta;

View file

@ -23,8 +23,8 @@ namespace HISP.Server
{
db.Open();
string UserTable = "CREATE TABLE IF NOT EXISTS Users(Id INT, Username TEXT(16), PassHash TEXT(128), Salt TEXT(128), Gender TEXT(16), Admin TEXT(3), Moderator TEXT(3))";
string ExtTable = "CREATE TABLE IF NOT EXISTS UserExt(Id INT, X INT, Y INT, LastLogin INT, Money INT, QuestPoints INT, BankBalance DOUBLE, BankInterest DOUBLE, ProfilePage Text(1028),IpAddress TEXT(1028),PrivateNotes Text(1028), CharId INT, ChatViolations INT,Subscriber TEXT(3), SubscribedUntil INT, Experience INT, Tiredness INT, Hunger INT, Thirst INT, FreeMinutes INT)";
string MailTable = "CREATE TABLE IF NOT EXISTS Mailbox(RandomId INT, IdTo INT, IdFrom INT, Subject TEXT(128), Message Text(1028), TimeSent INT, BeenRead TEXT(3))";
string ExtTable = "CREATE TABLE IF NOT EXISTS UserExt(Id INT, X INT, Y INT, LastLogin INT, Money INT, QuestPoints INT, BankBalance DOUBLE, BankInterest DOUBLE, ProfilePage Text(4000),IpAddress TEXT(1028),PrivateNotes Text(65535), CharId INT, ChatViolations INT,Subscriber TEXT(3), SubscribedUntil INT, Experience INT, Tiredness INT, Hunger INT, Thirst INT, FreeMinutes INT)";
string MailTable = "CREATE TABLE IF NOT EXISTS Mailbox(RandomId INT, IdTo INT, IdFrom INT, Subject TEXT(100), Message Text(65535), TimeSent INT, BeenRead TEXT(3))";
string BuddyTable = "CREATE TABLE IF NOT EXISTS BuddyList(Id INT, IdFriend INT)";
string MessageQueue = "CREATE TABLE IF NOT EXISTS MessageQueue(Id INT, Message TEXT(1028))";
string WorldTable = "CREATE TABLE World(Time INT, Day INT, Year INT, StartTime INT)";
@ -45,13 +45,13 @@ namespace HISP.Server
string SavedDrawings = "CREATE TABLE IF NOT EXISTS SavedDrawings(playerId INT, Drawing1 TEXT(65535), Drawing2 TEXT(65535), Drawing3 TEXT(65535))";
string DrawingRooms = "CREATE TABLE IF NOT EXISTS DrawingRooms(roomId INT, Drawing TEXT(65535))";
string DressupRooms = "CREATE TABLE IF NOT EXISTS DressupRooms(roomId INT, peiceId INT, active TEXT(3), x INT, y INT)";
string Horses = "CREATE TABLE IF NOT EXISTS Horses(randomId INT, ownerId INT, leaseTime INT, leaser INT, breed INT, name TEXT(128), description TEXT(1028), sex TEXT(128), color TEXT(128), health INT, shoes INT, hunger INT, thirst INT, mood INT, groom INT, tiredness INT, experience INT, speed INT, strength INT, conformation INT, agility INT, endurance INT, inteligence INT, personality INT, height INT, saddle INT, saddlepad INT, bridle INT, companion INT, autoSell INT, trainTimer INT, category TEXT(128), spoiled INT, magicUsed INT, hidden TEXT(3))";
string WildHorse = "CREATE TABLE IF NOT EXISTS WildHorse(randomId INT, originalOwner INT, breed INT, x INT, y INT, name TEXT(128), description TEXT(1028), sex TEXT(128), color TEXT(128), health INT, shoes INT, hunger INT, thirst INT, mood INT, groom INT, tiredness INT, experience INT, speed INT, strength INT, conformation INT, agility INT, endurance INT, inteligence INT, personality INT, height INT, saddle INT, saddlepad INT, bridle INT, companion INT, timeout INT, autoSell INT, trainTimer INT, category TEXT(128), spoiled INT, magicUsed INT)";
string Horses = "CREATE TABLE IF NOT EXISTS Horses(randomId INT, ownerId INT, leaseTime INT, leaser INT, breed INT, name TEXT(128), description TEXT(4000), sex TEXT(128), color TEXT(128), health INT, shoes INT, hunger INT, thirst INT, mood INT, groom INT, tiredness INT, experience INT, speed INT, strength INT, conformation INT, agility INT, endurance INT, inteligence INT, personality INT, height INT, saddle INT, saddlepad INT, bridle INT, companion INT, autoSell INT, trainTimer INT, category TEXT(128), spoiled INT, magicUsed INT, hidden TEXT(3))";
string WildHorse = "CREATE TABLE IF NOT EXISTS WildHorse(randomId INT, originalOwner INT, breed INT, x INT, y INT, name TEXT(128), description TEXT(4000), sex TEXT(128), color TEXT(128), health INT, shoes INT, hunger INT, thirst INT, mood INT, groom INT, tiredness INT, experience INT, speed INT, strength INT, conformation INT, agility INT, endurance INT, inteligence INT, personality INT, height INT, saddle INT, saddlepad INT, bridle INT, companion INT, timeout INT, autoSell INT, trainTimer INT, category TEXT(128), spoiled INT, magicUsed INT)";
string LastPlayer = "CREATE TABLE IF NOT EXISTS LastPlayer(roomId TEXT(1028), playerId INT)";
string SolvedRealTimeRiddles = "CREATE TABLE IF NOT EXISTS SolvedRealTimeRiddles(playerId INT, riddleId INT)";
string TrackingStats = "CREATE TABLE IF NOT EXISTS Tracking(playerId INT, what TEXT(128), count INT)";
string Treasure = "CREATE TABLE IF NOT EXISTS Treasure(randomId INT, x INT, y INT, value INT, type TEXT(128))";
string Ranches = "CREATE TABLE IF NOT EXISTS Ranches(ranchId INT, playerId INT, title TEXT(1028), description TEXT(1028), upgradeLevel INT, building1 INT, building2 INT, building3 INT, building4 INT, building5 INT, building6 INT, building7 INT, building8 INT, building9 INT, building10 INT, building11 INT, building12 INT, building13 INT, building14 INT, building15 INT, building16 INT, investedMoney INT)";
string Ranches = "CREATE TABLE IF NOT EXISTS Ranches(ranchId INT, playerId INT, title TEXT(50), description TEXT(250), upgradeLevel INT, building1 INT, building2 INT, building3 INT, building4 INT, building5 INT, building6 INT, building7 INT, building8 INT, building9 INT, building10 INT, building11 INT, building12 INT, building13 INT, building14 INT, building15 INT, building16 INT, investedMoney INT)";
string BannedPlayers = "CREATE TABLE IF NOT EXISTS BannedPlayers(playerId INT, ipAddress TEXT(1028), reason TEXT(1028))";
string RiddlesComplete = "CREATE TABLE IF NOT EXISTS RiddlesComplete(playerId INT, riddleId INT, solved TEXT(1028))";
string AuctionTable = "CREATE TABLE IF NOT EXISTS Auctions(roomId INT, randomId INT, horseRandomId INT, ownerId INT, timeRemaining INT, highestBid INT, highestBidder INT, Done TEXT(3))";

View file

@ -1365,10 +1365,16 @@ namespace HISP.Server
Messages.PotOfGoldFormat = gameData.messages.treasure.pot_of_gold;
// Records
Messages.ProfileSavedMessage = gameData.messages.profile_save;
Messages.PrivateNotesSavedMessage = gameData.messages.private_notes_save;
Messages.PrivateNotesMetaFormat = gameData.messages.meta.private_notes_format;
// Profile
Messages.ProfileSavedMessage = gameData.messages.profile.save;
Messages.ProfileTooLongMessage = gameData.messages.profile.too_long;
Messages.ProfileViolationFormat = gameData.messages.profile.blocked;
Messages.ProfileViolationProfanity = gameData.messages.profile.profanity;
Messages.ProfileViolationPersonalInfo = gameData.messages.profile.personal_info;
// Announcements

View file

@ -4258,6 +4258,16 @@ namespace HISP.Server
string profilePage = packetStr.Split('|')[1];
profilePage = profilePage.Substring(0, profilePage.Length - 2);
sender.LoggedinUser.CharacterId = characterId;
if (profilePage.Length > 4000)
{
byte[] notSaved = PacketBuilder.CreateChat(Messages.ProfileTooLongMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(notSaved);
return;
}
sender.LoggedinUser.ProfilePage = profilePage;
Logger.DebugPrint(sender.LoggedinUser.Username + " Changed to character id: " + characterId + " and set there Profile Description to '" + profilePage + "'");