2 of 2
2
EE page results in “Disallowed Key Characters”; RegExp failing on ’$’ character in 3rd-party cookie string
Posted: 03 July 2008 02:10 PM   [ Ignore ]   [ # 19 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1727
Joined  03-26-2006

Well, the first change works great. I can purposely set a bad cookie in Firefox - one that starts with ‘cm’ and has a dollar sign in it - and I won’t see the “Disallowed” message at all.

The second change doesn’t work at all (and man, the docs could use some examples! I’m looking at the Functions in the docs, and there isn’t a single real example under “Redirect”). What I’d like to do is redirect users to a real basic page that at least allows them to email the webmaster, or generically explain how they might have gotten there. No matter what I do…I can’t redirect here, I end up just getting a white page.

Seems that if I put any $FNS class stuff in that function that nothing works (and yes, I added “global $FNS”). Seems that doing anything other then echoing some text on the page with that function isn’t allowed.

If I even put this line in that function, anywhere:

$return_url = $FNS->create_url('site/error');


the resulting page blanks out.

Shouldn’t I be able to redirect from here?

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 06 July 2008 10:23 AM   [ Ignore ]   [ # 20 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23522
Joined  05-20-2002

What happens if you just hard code the redirect:

if ( ! ereg("^[A-Za-z0-9\:\_\/\-]+$", $str))
  
{
     
header
('Location: http://www.mysite.com/basic/error/');
    exit;
etc...

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 08 July 2008 10:34 AM   [ Ignore ]   [ # 21 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1727
Joined  03-26-2006

Robin, that does not seem to work. I’ve tried your code, and there really seems to be a problem with “exit”. I’m in the PHP docs now, looking to see if there is something about “exit” I’m missing.

Anyway, Firefox throws an error that says

“Firefox has detected that the server is redirecting the request for this address in a way that will never complete.”

There has GOT to be a way to do something gracefully here, rather than stopping the site cold. Granted, this will only be for users of the site who have visited previously and are stuck in this “bad cookie” loop, but on this site, that could mean thousands of users.

Here’s where I’m at:

function clean_input_keys($str)
    
{
      
     
if ( ! ereg("^[A-Za-z0-9\:\_\/\-]+$", $str))
     
{
       header
('Location: http://www.site.com/site/error/');
       exit;
     
}

        
if ( ! get_magic_quotes_gpc())
        
{
            $str
= addslashes($str);
        
}
        
        
return $str;
    
}


All that says is if it fails the test, redirect to page x and exit - but I get into the eror loop with Firefox.

I’ve tried redirecting to different pages that I know exist, but I don’t think that’s the problem here. I’ve also attached a pic of the error message.

ADD: Might the .htaccess file be interfering with the redirect?

Image Attachments
redirect_error.jpg
Click thumbnail to see full-size image
 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 08 July 2008 10:45 AM   [ Ignore ]   [ # 22 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1727
Joined  03-26-2006

I think I’ll probably have to just resort to something like the following exit message and hope the users have any idea how to clear cookies!

exit('Disallowed Key Characters: '.$str.' To solve this, please clear your cookies for site.com.
We are sorry for the inconvenience.'
);

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 09 July 2008 08:22 AM   [ Ignore ]   [ # 23 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23522
Joined  05-20-2002

Hm- were we creating a loop trying to redirect?  Now that I look at it- maybe.  Except- you were redirecting to a non-EE page, so unless htaccess was snagging it in anyway, I don’t see how that would be in play.

Strikes me as weird, though.  Not sure- you want me to close this one out?  I’m thinking it’s about done- and if the issue crops up again, this thread could simply be referenced.

Or I may need to poke the crew- as I don’t quite get why it borks on exit.

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 09 July 2008 08:24 AM   [ Ignore ]   [ # 24 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1727
Joined  03-26-2006

Actually I was redirecting to an EE page. Maybe I should try redirecting to a non-EE page?

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 11 July 2008 10:06 AM   [ Ignore ]   [ # 25 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32861
Joined  05-14-2004

hey, mdesign; this has gone quite a bit beyond what we can offer as standard tech support. Did you want me to move this to How To?

 Signature 
Profile
MSG
 
 
Posted: 11 July 2008 10:18 AM   [ Ignore ]   [ # 26 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1727
Joined  03-26-2006

Sure, I even suggested splitting this thread over into How To back at the bottom of comment #21 wink

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
   
2 of 2
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64915 Total Logged-in Users: 18
Total Topics: 81870 Total Anonymous Users: 20
Total Replies: 440148 Total Guests: 167
Total Posts: 522018    
Members ( View Memberlist )
Newest Members:  Suman KumarsmilepolitelyrvmcleodbjmohrAqua193Bios Elementmjpoteetguimogranwelshmrcf