Ideas, and Help needed!

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch
Hey guys. I am running a free blog hosting site, and I am having a problem with 'referrers'. You know the cookie thing in your browser that says where you just came from. Well here is the problem, I can't get this code to work correctly, it always dies, even if it shounldn't:

PHP:
function check_admin_referer() {
  $adminurl = strtolower(get_settings('siteurl')).'/wp-admin';
  $referer = strtolower($_SERVER['HTTP_REFERER']);
  if ( !strstr($referer, $adminurl) ) {
    die('Sorry, you need to enable sending referrers, for this feature to work.');
  }

I dont understand why its not working.

I am wondering if there is a way to "trick" it into thinking it if it dies (false) it is still true.

Or is there a way to fix this. This is the only script I have ever had this problem with.

Anyone have any Ideas, or solutions.

Thanks
OulZac

:wave:
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
maybe the global registers is off?

PHP:
function check_admin_referer() {
global $_SERVER;
  $adminurl = strtolower(get_settings('siteurl')).'/wp-admin';
  $referer = strtolower($_SERVER['HTTP_REFERER']);
  if ( !strstr($referer, $adminurl) ) {
    die('Sorry, you need to enable sending referrers, for this feature to work.');
  }

not sure... but that could be the problem :)

just realized this is my 400th post :)
 
Last edited:
0
Close
Thanks for the reply axilant, but I am afraid that didn't work either.

Here is what I have now, I also added a https checker to veryify either way, just in case, but to no prevail:

PHP:
function check_admin_referer() {
 global $_SERVER;  
  $adminurl = strtolower(get_settings('siteurl')).'/wp-admin';
   preg_match("/^https?:\/\/(.*)/", $adminurl, $matches);
  $adminurl = $matches[1];
  $referer = strtolower($_SERVER['HTTP_REFERER']);  
   preg_match("/^https?:\/\/(.*)/", $referer, $matches);
  $referer = $matches[1];
  if ( !strstr($referer, $adminurl) ) {
    die('Sorry, you need to enable sending referrers, for this feature to work.');
  }

I am thinking there must be a way to turn this function off by altering the code, but I am not sure what. Is there a way I can loop the referer to true without it checking? I know I can't remove the function all together, as the script would need a complete overhual, and Im not at that point yet.

Any other ideas?

:)
 
0
Close
PHP:
function check_admin_referer() {
global $_SERVER;  
  //$adminurl = strtolower(get_settings('siteurl')).'/wp-admin';
  // preg_match("/^https?:\/\/(.*)/", $adminurl, $matches);
  //$adminurl = $matches[1];
  //$referer = strtolower($_SERVER['HTTP_REFERER']);  
   //preg_match("/^https?:\/\/(.*)/", $referer, $matches);
  //$referer = $matches[1];
  //if ( !strstr($referer, $adminurl) ) {
  //  die('Sorry, you need to enable sending referrers, for this feature to work.');
  }

code wont be executed.
 
1
Close
YOU ARE THE MAN!!! :loveyou:

I never thought of that. Playing with this thing for 12 hours straight, and I didn't even think of the simplist thing.

I can't thank you enough, I can finally stop looking at code for the next 10 hours. :lol:

axilant <--- :great:
 
0
Close
OulZac said:
YOU ARE THE MAN!!! :loveyou:

I never thought of that. Playing with this thing for 12 hours straight, and I didn't even think of the simplist thing.

I can't thank you enough, I can finally stop looking at code for the next 10 hours. :lol:

axilant <--- :great:

np thanks for the donations :)
 
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back