miniBB ®

miniBB

®
Support Forums
  
 · Start · Sign in · Register · Search · Statistics · File Bank · Manual ·
Master Class miniBB Support Forums / Master Class /  
 

Is this line in the index.php file necessary?

 
Author tom322
Active Member
#1 · Posted: 28 Jan 2026 21:19
In the index.php file, there are these 3 lines of code:

$queryStr=preg_replace("@[^0-9a-zA-Z./#_&=%-]@", '', $queryStr);
$queryStrDisp=str_replace('&', '&', $queryStr);
$queryStr=str_replace('&', '&', $queryStr);// is this one needed?
My question is — is the 3rd line necessary? It seems it doesn't do anything once the first two lines of code are executed (the first line seems to already take care of the ampersand, or I'm wrong)..

Author Paul
Lead Lead Developer
#2 · Posted: Today 18:18
All these lines are necessary.

The first line removes everything except what is defined in square brackets. It doesn't handle the ampersand. It just secures up this query.

The third line converts the HTML entity of the ampersand which could come from a valid HTML source. Later it could be used in the header page redirection, where no entities are allowed.

Author tom322
Active Member
#3 · Posted: Today 18:53
Thanks for the explanation, it makes sense now.

Master Class miniBB Support Forums / Master Class /
 Is this line in the index.php file necessary?
Share Link Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Check out the File and Picture Attachments add-on: extend your miniBB-forums, attaching images and files.