@@ -351,13 +351,25 @@ function guild_list($TFSVersion) {
351351
352352 // Uninvite and joinguild is also used for visitors who reject their invitation.
353353 if (!empty ($ _POST ['uninvite ' ])) {
354- //
355- guild_remove_invitation ($ _POST ['uninvite ' ], $ gid );
356- header ('Location: guilds.php?name= ' . $ _GET ['name ' ]);
357- exit ();
354+ // Is this action being triggered by a vice leader+, or the invited player?
355+ $ u_player = (int )$ _POST ['uninvite ' ];
356+ $ u_player = user_character_name ($ u_player );
357+ $ u_player = (int )user_character_account_id ($ u_player );
358+ if (in_array ($ highest_access , array (2 ,3 )) || $ u_player === $ session_user_id ) {
359+ guild_remove_invitation ($ _POST ['uninvite ' ], $ gid );
360+ header ('Location: guilds.php?name= ' . $ _GET ['name ' ]);
361+ exit ();
362+ }
358363 }
359364 if (!empty ($ _POST ['joinguild ' ])) {
360365 $ joining_player_id = (int )$ _POST ['joinguild ' ];
366+ $ join_account = (int )user_character_account_id (user_character_name ($ joining_player_id ));
367+
368+ if ($ join_account !== $ session_user_id ) {
369+ echo '<font color="red" size="4">Join guild request sent from wrong account.</font> ' ;
370+ include 'layout/overall/footer.php ' ;
371+ exit ();
372+ }
361373 // Join a guild
362374 if ($ inv_data !== false ) foreach ($ inv_data as $ inv ) {
363375 if ((int )$ inv ['player_id ' ] == $ joining_player_id ) {
@@ -383,6 +395,14 @@ function guild_list($TFSVersion) {
383395 if (!empty ($ _POST ['leave_guild ' ])) {
384396 $ name = sanitize ($ _POST ['leave_guild ' ]);
385397 $ cidd = user_character_id ($ name );
398+
399+ $ leave_account = (int )user_character_account_id ($ name );
400+ if ($ leave_account !== $ session_user_id ) {
401+ echo '<font color="red" size="4">Leave guild request sent from wrong account.</font> ' ;
402+ include 'layout/overall/footer.php ' ;
403+ exit ();
404+ }
405+
386406 // If character is offline
387407 if ($ config ['ServerEngine ' ] !== 'TFS_10 ' ) $ chardata = user_character_data ($ cidd , 'online ' );
388408 else $ chardata ['online ' ] = (user_is_online_10 ($ cidd )) ? 1 : 0 ;
@@ -482,9 +502,8 @@ function guild_list($TFSVersion) {
482502 }
483503
484504 if (!empty ($ _POST ['disband ' ])) {
485- //
486- $ gidd = (int )$ _POST ['disband ' ];
487- $ members = get_guild_players ($ gidd );
505+ // $gidd = (int)$_POST['disband'];
506+ $ members = get_guild_players ($ gid );
488507 $ online = false ;
489508
490509 // First figure out if anyone are online.
@@ -534,8 +553,8 @@ function guild_list($TFSVersion) {
534553 }
535554
536555 if (!empty ($ _POST ['change_ranks ' ])) {
537- $ c_gid = (int )$ _POST ['change_ranks ' ];
538- $ c_ranks = get_guild_rank_data ($ c_gid );
556+ // $c_gid = (int)$_POST['change_ranks'];
557+ $ c_ranks = get_guild_rank_data ($ gid );
539558 $ rank_data = array ();
540559 $ rank_ids = array ();
541560
@@ -560,10 +579,13 @@ function guild_list($TFSVersion) {
560579 $ name = sanitize ($ _POST ['remove_member ' ]);
561580 $ cid = user_character_id ($ name );
562581
563- if ($ config ['ServerEngine ' ] !== 'TFS_10 ' ) guild_remove_member ($ cid );
564- else guild_remove_member_10 ($ cid );
565- header ('Location: guilds.php?name= ' . $ _GET ['name ' ]);
566- exit ();
582+ $ p_guild = get_player_guild_data ($ cid );
583+ if ($ p_guild ['guild_id ' ] == $ gid ) {
584+ if ($ config ['ServerEngine ' ] !== 'TFS_10 ' ) guild_remove_member ($ cid );
585+ else guild_remove_member_10 ($ cid );
586+ header ('Location: guilds.php?name= ' . $ _GET ['name ' ]);
587+ exit ();
588+ }
567589 }
568590
569591 if (!empty ($ _POST ['forumGuildId ' ])) {
0 commit comments