Post Reply 
Referrer & index.php
09-Aug-2010, 09:34 PM
Post: #1
Referrer & index.php
If you add Commentics to an index.php file then it can usually be accessed by two different URLs:

1. domain.com/
2. domain.com/index.php

This will be an issue when trying to submit a comment as you may be banned for 'incorrect referrer'.

The following is the solution for Commentics v1.1:

Find this function in comments/includes/functions/processor.php (line 1145):
PHP Code:
function clean_url ($url) { //cleans up a URL
    
    
$url strtolower($url); //convert to lowercase
    
    
if (stripos($url"?") !== false) { //remove any parameters
        
$parameter substr($urlstripos($url"?"));
        
$url str_ireplace($parameter""$url);
    }
    
    
$url urldecode($url); //decode any special characters
    
    
return $url//return cleaned URL
    
//end of clean-url function 

Replace with:
PHP Code:
function clean_url ($url) { //cleans up a URL
    
    
$url strtolower($url); //convert to lowercase
    
    
if (stripos($url"?") !== false) { //remove any parameters
        
$parameter substr($urlstripos($url"?"));
        
$url str_ireplace($parameter""$url);
    }
    
    
$url str_ireplace("index.php"""$url); //remove index.php if there
    
    
$url urldecode($url); //decode any special characters
    
    
return $url//return cleaned URL
    
//end of clean-url function 

The Commentics v1.1 download will be updated shortly to include this fix.

Have you completed the interview?
Find all posts by this user
Quote this message in a reply
09-Aug-2010, 09:58 PM
Post: #2
RE: Incorrect Referrer & index.php
I'm not sure removing index.php from the header is the best solution. In the extremely rare case that the user decides something else to be the default filename in a directory, this won't work.

I'm giving you three guesses...
Find all posts by this user
Quote this message in a reply
09-Aug-2010, 10:29 PM
Post: #3
RE: Incorrect Referrer & index.php
Okay I acknowledge the extremely rare case.

Have you completed the interview?
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Keep getting Incorrect Referrer ban james 5 967 27-Jul-2010 03:07 PM
Last Post: Steven

Forum Jump:


User(s) browsing this thread: 1 Guest(s)