Access denied from link in popup

Started by Krashsite, September 12, 2013, 05:04:18 PM

Previous topic - Next topic

Sir Osis of Liver


Opening a popup from a button in main menu.  Text in popup contains direct link to member's Paid Subs section -



<a href="#" onClick="window.opener.document.location.href=\'http://xxxxxx.com/forum/index.php?action=profile;u=1;area=subscriptions;confirm\'; window.self.close();">Profile -> Paid Subscriptions</a> 



Link doesn't work, nothing happens, debug shows 'Access denied' error.

Popup contains button that opens 'Help' in same popup window.  'Help' contains same link, and it works. 

If I open popup with 'Help' as first page, link doesn't work.

Same result in IE and FF. 

It all works fine on my server.

Any ideas?

When in Emor, do as the Snamors.
                              - D. Lister

mashby

Which member though? I see u=1 in that URL...
Always be a little kinder than necessary.
- James M. Barrie

Sir Osis of Liver


That link takes any registered member directly to Paid Subs page in their Profile.

Appears to be something server-side.  Links (any link) don't work in the page that opens when popup is launched.  I can fix it by launching the popup with a dummy file that just has a header redirect to the first page (making it second page), but not comfortable using a workaround on someone else's business site unless I understand the problem.

When in Emor, do as the Snamors.
                              - D. Lister

All Colours Sam

Quote from: Krash. on September 13, 2013, 02:01:15 PM

That link takes any registered member directly to Paid Subs page in their Profile.

Nope, it would take whoever clicks on it to the paid subscription page of the user with ID 1

http://www.simplemachines.org/community/index.php?action=profile

http://www.simplemachines.org/community/index.php?action=profile;u=271166

http://www.simplemachines.org/community/index.php?action=profile;u=245528

Check out the differences, if there is a link with no u var been set SMF then will load whoever's ID whos viewing that page.

Each page in the profile page will check if the current user has the permission to be there.

In other words, just remove the u=1 from your url.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Sir Osis of Liver


Yes, I know.  Was doing some tinkering and had changed the link for test purposes.  Correct link is $scripturl . '?action=profile;area=subscriptions',.  Link is not the problem, no url works from first page that loads in the popup.

When in Emor, do as the Snamors.
                              - D. Lister

All Colours Sam

Using window.opener.document.location.href  gives me "window.opener" is not an object.

Maybe using a separate function: onclick="newWin()" ?

function newWin
{
  newWin = window.open(....);
newWin.opener.document.location.href = 'url';
}

As far as my JS skills goes, before using .opener you gotta use window.open first.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Sir Osis of Liver


JS makes me , but it works as is in four browsers (yes, even Opera), so I'll leave it alone. 

When in Emor, do as the Snamors.
                              - D. Lister

Sir Osis of Liver


Don't know who checked it, but this problem is not resolved.  Still have no explanation why this is occurring, and would appreciate any help.

When in Emor, do as the Snamors.
                              - D. Lister

All Colours Sam

It certainly wasn't me.

I tried to replicate your issue but I couldn't.

So, the issue is not the code to generate the pop up but the code that appears in the pop up?  perhaps the entire subscription page isn't suited to be loaded via JS.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

emanuele

TBH I don't really understand what you are trying to do...

The code you posted in the first message doesn't work in any browser I test, all of them don't know what to do with the "opener" part.
What exactly are trying to achieve?


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Sir Osis of Liver


<sigh>

I can't replicate it either, it all works fine on my test install.  What I'm doing is opening a popup that loads main.php, which contains links to member's Paid Subs order page in Profile, and a couple of buttons for other pages, one of which contains the same Paid Subs link.  The popup opens and loads the page properly, but the links do nothing, and debug shows 'Access denied'.  This only happens in the first file loaded.  If I click a button to the FAQ (help.php) the same link works fine.  If I open the popup with help.php as the first page, link doesn't work.  Doesn't matter what url I use (i.e., www.simplemachines.org), link doesn't work in first page loaded in the popup.

The workaround I'm using has the popup load a dummy page (main1.php) first, which contains a header redirect to main.php, nothing else.  The links work because main.php is now the second page loaded into the popup (main1.php is first).

Don't think it's the JS because that's client-side, so should have the same problem in same browser regardless of host.  Seems to be something server-side.

When in Emor, do as the Snamors.
                              - D. Lister

Advertisement: