Znote / ZnoteAAC

Developement repository for the Znote AAC project. A website portal to represent and manage your Open Tibia server.
MIT License
147 stars 127 forks source link

Player guild invite/join issue #485

Open BoozieII opened 3 years ago

BoozieII commented 3 years ago

I have an issue with inviting players to guild on my server, when i try to invite this error message pops up:

string(72) "INSERT INTO guild_invites (player_id, guild_id) VALUES ('53', '3')" (query` - SQLerror) Type: voidQuery (voidQuery is used for update, insert or delete from database) Field 'date' doesn't have a default value

Now i got around this issue by modifying the /html/engine/function/users.php file and changing the following: from:

// Invite character to guild function guild_invite_player($cid, $gid) { $cid = (int)$cid; $gid = (int)$gid; mysql_insert("INSERT INTO guild_invites (player_id, guild_id, date) VALUES ('$cid', '$gid')");

to:

// Invite character to guild function guild_invite_player($cid, $gid) { $cid = (int)$cid; $gid = (int)$gid; mysql_insert("INSERT INTO guild_invites (player_id, guild_id, date) VALUES ('$cid', '$gid', UNIX_TIMESTAMP(NOW()))"); }

This allows me to send the invite to the player and it shows on the website. However when i then log into the players account and attempt to join, i encounter this error message in red on the guild site.

Join guild request sent from wrong account.

At this point I am unsure what else i could do, as somehow the site doesnt see the logged in account as the right account? even tho it is the player that has been invited. Please help

Znote commented 3 years ago

Do you use Znote AAC 1.6 or 2.0? Which server are you using?

BoozieII commented 3 years ago

I apologise i forgot to mention this information, i am using znote aac 1.6 version and i am running otservbr-global. The latest distro

Znote commented 3 years ago

Hmm, I recently did an update to guilds, I might have botched it up somehow. Try to revert this: https://github.com/Znote/ZnoteAAC/commit/ddd54a932e4b4e7b4e1adf19215f48864500cfdb#diff-e4e46ad278c6b7fe37d32dafb04f4d8cb78184ba784c35b8433455b5428ed4b9R366-R372

BoozieII commented 3 years ago

The above worked, players can join guild now with no problems. Also this was the same issue for leaving the guild, i made similar changes to guilds.php for leaving the guild and that worked as well!

Thanks a bunch!

Emerald2630 commented 3 months ago

Issue is created by comparing string with integer with !==. $join_account is integer, $session_user_id is string.

Wirless commented 3 weeks ago
if ((string)$leave_account !== $session_user_id) {

if ((string)$join_account !== $session_user_id) {