Author Topic: Invalid characters error  (Read 3333 times)

Offline alex.popa

  • Newbie
  • *****
  • Posts: 1
  • Karma: +0/-0
Invalid characters error
« on: May 13, 2011, 10:16:19 AM »
phpEnter Web Hosting
Every time I try to add a news moderator account I get an "Invalid character <- Go Back" error.
Tested in 3.3 and 3.4.
Recomandations?
« Last Edit: January 01, 1970, 03:00:00 AM by Guest »

Offline aleks

  • Administrator
  • Full Member
  • *****
  • Posts: 266
  • Karma: +0/-0
Re: Invalid characters error
« Reply #1 on: May 13, 2011, 03:12:29 PM »
Replace (in link.php, post.php)
Code: [Select]
if (ereg("^.", $name))
{
echo "<center>Invalid Characters:<a href="javascript:history.go(-1)">Go Back</a></center>";
die();
}
if (ereg("javascript", $name))
{
echo "<center>Invalid Characters: <font color = "red"><strong>javascript</strong></font> <a href="javascript:history.go(-1)">Go Back</a></center>";
die();
}
with this:
Code: [Select]
if (preg_match("/%/", $name)) {
            echo "<center><div id="toprow">Invalid Characters "%" </div>";
            Die();
        }
        if (preg_match("/;/", $name)) {
            echo "<center><div id="toprow">Invalid Characters ";" </div>";
            Die();
        }
        if (preg_match("/</", $name)) {
            echo "<center><div id="toprow">Invalid Characters "<" HTML is not allowed";
            Die();
        }
        if (preg_match("/\[/", $name)) {
            echo "<center><div id="toprow">Invalid Characters "[" BB code is not allowed";
            Die();
        }

Ereg() function has been deprecated as of PHP 5.3.0 and removed as of PHP 6.0.0.
« Last Edit: January 01, 1970, 03:00:00 AM by Guest »