This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Referrer & index.php
#1

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:
<?php 
function clean_url ($url) { //cleans up a URL

$url = strtolower($url); //convert to lowercase

if (stripos($url, "?") !== false) { //remove any parameters
$parameter = substr($url, stripos($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:
<?php 
function clean_url ($url) { //cleans up a URL

$url = strtolower($url); //convert to lowercase

if (stripos($url, "?") !== false) { //remove any parameters
$parameter = substr($url, stripos($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?
Reply
#2

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...
Reply
#3

Okay I acknowledge the extremely rare case.

Have you completed the interview?
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post

Forum Jump:


Users browsing this thread: 1 Guest(s)