Unstoppable Domains — Get your daily AI drops report

Ideas, and Help needed!

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
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
•••
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
•••
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
•••
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
•••
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
•••
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
•••
Dynadot — .com TransferDynadot — .com Transfer
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back