The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Recursive Member Requests via AJAX Causes Bugs

Go down

Recursive Member Requests via AJAX Causes Bugs Empty Recursive Member Requests via AJAX Causes Bugs

Post by Ange Tuteur April 1st 2016, 10:06 pm

Hi,

This is rather a very technical problem, so if any of you would be able to report this to the higher ups for clarification, I'd love you for that. loove

Description : When sending recursive requests to the profiles, after about 50 or so I begin to experience some wonky results. Which are :

1. When trying to view a user's profile it's never the correct user associated with the id. e.g. Viewing user 1 would show user 5
2. When trying to view a topic it always goes to topic 1.

Demonstration :
Example of what I'm doing :
Recursive Member Requests via AJAX Causes Bugs Captur10

Result after prolonged use :

It's like I'm playing some kinda random user game ! Shocked

Solution / Quirks : I can stop this buggy result from happening after clearing my cookies ( usually just the session id Recursive Member Requests via AJAX Causes Bugs Whistle ) or logging out. HOWEVER, I can send plenty of AJAX requests to the user page while logged out and NEVER get this wonky result. I wouldn't have a problem with this, but I need to be logged in to edit the user profiles.

Code : I whipped up an example code similar to what I'm doing. Go to your forum while logged in, press F12, go to console and paste the following code :
Code:
window.member_crawler = {
  index : 0,
  quota : 100,
  data : '#field_id-6',

  get : function() {
    if (++member_crawler.index <= member_crawler.quota) {
      console.log('Getting user ' + member_crawler.index + '/' + member_crawler.quota + '...');

      $.get('/u' + member_crawler.index, function(d) {
        var name = $('#cp-main h1', d).text(),
            field = $(member_crawler.data, d).text();

        console.log((field ? name.replace(/All about /, '') + ' = ' + field : 'USER NOT FOUND.') + '\n\n');
        window.setTimeout(member_crawler.get, 1000);
      });

    } else {
      console.log('COMPLETE!');
    }
  }
};

member_crawler.get();
Make sure to change the quota property so it reads the total amount of members on your forum. Once you're finished hit enter and the code will begin crawling your members to get their posts amount. After awhile of crawling the results will begin repeating some users due to the bug mentioned above. NOTE : That you must have a large amount of members on your forum for this to occur.

The requests are delayed 1 second after they're completed. I tried raising this to 3 seconds, 5 seconds, and even 10 seconds, but I still end up with the same result. What I don't get is that I can continuously get members profiles while logged out without this happening. I'm assuming it has something to do with cookies or I could be wrong. Think

Why am I doing this ? : I'm doing this because I need to check the user information AND update a specific profile field to reflect the user's achievements.

If you need more information lemme know. Have a good weekend. bye
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3001
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Recursive Member Requests via AJAX Causes Bugs Empty Re: Recursive Member Requests via AJAX Causes Bugs

Post by Ange Tuteur April 2nd 2016, 6:55 pm

Well, I wrote a workaround solution for what I'm doing, so I'm not too worried about this anymore. However, I still think this should be reported when possible, because it appears to be some sort of bug. Think

There's no rush though, take your time. Doff
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3001
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum