Forbidden | Not having access to

Started by Nahuel, Thu 18/05/2023 08:49:45

Previous topic - Next topic

Nahuel

Forbidden

You don't have permission to access this resource.
Apache/2.4.57 (Ubuntu) Server at adventuregamestudio.co.uk Port 443




When clicking on profiles that contains [ ] white spaces, the url that is generated is returning a 403 Forbidden. I see there's no longer the index.php?action=profile;u={userId}, it has now the user name /forums/profile/{username} instead and when clicked it's returning a 403

Example of users:
  https://www.adventuregamestudio.co.uk/forums/profile/Crimson%20Wizard/ 
  https://www.adventuregamestudio.co.uk/forums/profile/Postmodern%20Adventures/
 
  Username (forbidden) https://www.adventuregamestudio.co.uk/forums/profile/Wavey%20Games/
  Userid (good I had it from an old message sent) https://www.adventuregamestudio.co.uk/forums/index.php?action=profile;u=17716


Life isn't a game. Let's develop a life-like-game.

Nahuel

It is also impossible to send messages to those profiles:

Life isn't a game. Let's develop a life-like-game.

AGA

This is a known issue with the rewrite plugin.  All the pages are still accessible via user ID rather than the rewritten name, like https://www.adventuregamestudio.co.uk/forums/pm/?sa=send;u=39 to send me a PM.

It's a bit longwinded, but if you go to https://www.adventuregamestudio.co.uk/forums/mlist/?sa=search and search for the username, the link in the Status column on the results page will include the user ID.  Then plug that into the address format from above, and you'll be able to do what you need.

Khris

#3
Here's a GreaseMonkey script that will fix this:

Code: JavaScript
// ==UserScript==
// @name     AGS profile link fix
// @version  1
// @grant    none
// @match https://www.adventuregamestudio.co.uk/forums/*
// ==/UserScript==

window.addEventListener("load", function () {
  document.querySelectorAll(".poster h4 a, .postby a, .moderators a").forEach(a => {
    a.href = a.href.replace(/%20/g, "+");
  });
});

(In case you don't want to use GreaseMonkey, simply replace the spaces in the username with + symbols)

Snarky

That's great, Khris. Thanks! I recently had to ban a couple of accounts with spaces, and it was a bit of a pain. This'll make it a lot easier.

AGA

Quote from: Khris on Tue 23/05/2023 23:13:46Here's a GreaseMonkey script that will fix this:

Code: JavaScript
// ==UserScript==
// @name     AGS profile link fix
// @version  1
// @grant    none
// @match https://www.adventuregamestudio.co.uk/forums/*
// ==/UserScript==

window.addEventListener("load", function () {
  document.querySelectorAll(".poster h4 a, .postby a, .moderators a").forEach(a => {
    a.href = a.href.replace(/%20/g, "+");
  });
});

(In case you don't want to use GreaseMonkey, simply replace the spaces in the username with + symbols)

Thanks!  I've added this to both themes' JS files, so no need for a local GreaseMonkey script.  It's not quite perfect, as there are other places profile links appear, but this is a great starting point I can use to add other classes as I find them.

AGA

#6
Quote from: AGA on Sat 27/05/2023 01:26:50Thanks!  I've added this to both themes' JS files, so no need for a local GreaseMonkey script.  It's not quite perfect, as there are other places profile links appear, but this is a great starting point I can use to add other classes as I find them.
Thanks, @Khris, I've adjusted it to the following, which is a bit more heavy handed, but should coves all eventualities.  Let's see if it slows things down at all!

Code: JavaScript
window.addEventListener("load", function () {
    document.querySelectorAll('a').forEach(a => {
        if (a.href.includes('https://www.adventuregamestudio.co.uk/forums/')) {
            a.href = a.href.replace(/%20/g, "+");
        }
    });
});

Nahuel

Working now, I've tested those profiles all looking good!  :cheesy:
Life isn't a game. Let's develop a life-like-game.

Khris

Here's an optimized version:

Code: JavaScript
window.addEventListener("load", function() {
  document.querySelectorAll('a[href^="https://www.adventuregamestudio.co.uk/forums/profile/"]')
  .forEach(a => a.href = a.href.replace(/%20/g, "+"));
});

AGA

Quote from: Khris on Sun 28/05/2023 13:58:56Here's an optimized version:

Code: JavaScript
window.addEventListener("load", function() {
  document.querySelectorAll('a[href^="https://www.adventuregamestudio.co.uk/forums/profile/"]')
  .forEach(a => a.href = a.href.replace(/%20/g, "+"));
});

Thanks, that's implemented!

SMF spam blocked by CleanTalk