Are you getting a lot of spam, or junk messages sent via your Joomla site?

I know certain components of Joomla let you put banned words but I know of even more that don't.  If you find all your forms need extra plugins and captchas (such as JezRecaptcha), then the website security isn't amazing.  I used to have Captcha on my K2 by Joomlaworks but if you did the sound version, it didn't work properly.  I found that sometimes the captcha wouldn't even match what you typed and what it displayed!!!

I have written this article to be another one of those programmer's tweaks.  This is quite a simple fix and I will hopefully be able to keep it simple for non-programmers.  The tweak below will stop any of your pages submitting content containing your banned words.

We're going to modify a file containing 2 lines of code by default.  The file is index2.php in your Joomla root folder.  Make a copy of it, back it up or do whatever you usually do when you modify a server-side file... ahem...

The code by to look for (joomla default) should be as follows:

copyraw
$_REQUEST['tmpl'] = 'component';
include('index.php');
  1.  $_REQUEST['tmpl'] = 'component'
  2.  include('index.php')

There is some more text but it's in /* lines */ which means these are comments.

 

The quick solution is:

copyraw
$_REQUEST['tmpl'] = 'component';
$offensive_words=array("viagra","cialis","[url=","porn","pfizer");
if (is_array($_GET)) $GotVars.=implode(",", $_GET).",";
if (is_array($_POST)) $GotVars.=implode(",", $_POST).",";
for($i=0;$i<count($offensive_words);$i++) { if (stripos($GotVars, $offensive_words[$i])) $offense=true; } 
if (!$offense) include('index.php');
  1.  $_REQUEST['tmpl'] = 'component'
  2.  $offensive_words=array("viagra","cialis","[url=","porn","pfizer")
  3.  if (is_array($_GET)) $GotVars.=implode(",", $_GET).","; 
  4.  if (is_array($_POST)) $GotVars.=implode(",", $_POST).","; 
  5.  for($i=0;$i<count($offensive_words);$i++) { if (stripos($GotVars, $offensive_words[$i])) $offense=true} 
  6.  if (!$offense) include('index.php')

The reporting solution (which tells your visitor what word caused an offense) is:

copyraw
# CREATE AN ARRAY OF BANNED WORDS
$offensive_words=array();
$offensive_words[]="viagra";
$offensive_words[]="cialis";
$offensive_words[]="[url=";
$errors="";
 
# CONVERT THE SUBMITTED DATA INTO STRING(S)
$GotVars="";
if (is_array($_GET)) $GotVars.=strtolower(implode(",", $_GET).",");
if (is_array($_POST)) $GotVars.=strtolower(implode(",", $_POST).",");
 
# NOW CHECK EACH BANNED WORD DOES NOT EXIST IN THE STRING
for ($i=0; $i<count($offensive_words); $i++) {
	$offensive_string.=(stripos($GotVars, $offensive_words[$i])!==false)?"- ".$offensive_words[$i].", ":"";
}
# IF THE OFFENSIVE STRING WAS POPULATED (=FOUND BANNED WORDS) THEN CREATE A MESSAGE
$errors.=(trim($offensive_string)!="")?"You have submitted word(s) that the website administrator has banned:".$offensive_string.".  Please try again without the banned words.":"";
 
# IF THE ERRORS STRING IS EMPTY PROCEED AS NORMAL, IF NOT THEN DISPLAY MESSAGE
if (trim($offensive_string)=="") {
	include('index.php');
} else {
	echo $errors;
}
  1.  # CREATE AN ARRAY OF BANNED WORDS 
  2.  $offensive_words=array()
  3.  $offensive_words[]="viagra"; 
  4.  $offensive_words[]="cialis"; 
  5.  $offensive_words[]="[url="; 
  6.  $errors=""; 
  7.   
  8.  # CONVERT THE SUBMITTED DATA INTO STRING(S) 
  9.  $GotVars=""; 
  10.  if (is_array($_GET)) $GotVars.=strtolower(implode(",", $_GET).",")
  11.  if (is_array($_POST)) $GotVars.=strtolower(implode(",", $_POST).",")
  12.   
  13.  # NOW CHECK EACH BANNED WORD DOES NOT EXIST IN THE STRING 
  14.  for ($i=0$i<count($offensive_words)$i++) { 
  15.      $offensive_string.=(stripos($GotVars, $offensive_words[$i])!==false)?"- ".$offensive_words[$i].", ":""; 
  16.  } 
  17.  # IF THE OFFENSIVE STRING WAS POPULATED (=FOUND BANNED WORDS) THEN CREATE A MESSAGE 
  18.  $errors.=(trim($offensive_string)!="")?"You have submitted word(s) that the website administrator has banned:".$offensive_string.".  Please try again without the banned words.":""; 
  19.   
  20.  # IF THE ERRORS STRING IS EMPTY PROCEED AS NORMAL, IF NOT THEN DISPLAY MESSAGE 
  21.  if (trim($offensive_string)=="") { 
  22.      include('index.php')
  23.  } else { 
  24.      echo $errors
  25.  } 

My comments in the code above are prefixed with #. As you can see I actually tell the user what word they've used that's been banned. You could easily not do this by replacing echo $errors="" with the word Return in the second to last line.

To sum up: my code does the following:

  1. Add words to the "offensive_words" array
  2. Joins any submitted data into 1 long string
  3. Tries to find each "offensive word" (case-insensitive) in the submitted data
  4. Creates a message if there was a banned word found
  5. If no message created, it proceeds as per usual; if not, it does not submit the form

To add more banned words, simply keep adding lines using the following syntax

copyraw
# CREATE AN ARRAY OF BANNED WORDS
$offensive_words=array();
$offensive_words[]="viagra";
$offensive_words[]="cialis";
$offensive_words[]="[url=";
$offensive_words[]="porn";
$offensive_words[]="a banned phrase";
#...
  1.  # CREATE AN ARRAY OF BANNED WORDS 
  2.  $offensive_words=array()
  3.  $offensive_words[]="viagra"; 
  4.  $offensive_words[]="cialis"; 
  5.  $offensive_words[]="[url="; 
  6.  $offensive_words[]="porn"; 
  7.  $offensive_words[]="a banned phrase"; 
  8.  #... 

or

copyraw
# CREATE AN ARRAY OF BANNED WORDS
$offensive_words=array("viagra","cialis","[url=","porn","a banned phrase");
#...
  1.  # CREATE AN ARRAY OF BANNED WORDS 
  2.  $offensive_words=array("viagra","cialis","[url=","porn","a banned phrase")
  3.  #... 

Additional Information: The Open Web Application Security Project (OWASP)

Category: Joomla :: Article: 237

The Issue

People have reported that although they have manually set the date/time on their computer, this gets changed by the windows time server (time.windows.com) when connected to the Internet and for some reason it doesn't display the right date/time.


The Quick Fix

First off, check there aren't any Update for Windows 7 releases at Microsoft's Windows Update


 In this case, I want to display the current month with today highlighted.  As I was trying to get my head round writing this in a program using the qHTM.dll (to include HTML in an autohotkey GUI), the calendar will be in a HTML-autohotkey mixed code.  Obviously just omit the HTML rubbish if you want to create a calendar using just autohotkey syntax.

Actually, the following code is an excerpt from my program which checks an online server (for IT Events during this month) and if it can't download the calendar, it had to display an offline version in the GUI.  To display the following code in this website though, I've had to omit a lot of the HTML part.


Applies to:
  • Microsoft Windows XP
How?
 I keep having to do this every year as I reghost all my machines (=restore to sorta factory settings), so instead of googling it and going through other websites that work and don't; I thought I might as well post the way I do it:

  1. Open up windows explorer
  2. Go to Tools -> Folder Options
  3. Click on the File Types tab
  4. Scroll down and select (NONE) Folder as file type
  5. Click on Advanced
  6. Click on New...
  7. For the Action type what ever you want the context menu to display, I use Command prompt from here
  8. For the Application value type c:\windows\system32\cmd.exe (this will be different on winnt, browse if unsure to your cmd.exe program)
  9. Click on OK > OK > Close

Notes:
  • Added by default since Microsoft Windows 7

 Couldn't find this anywhere on the net and kinda needed it so am making a note of how to do it here.

The issue is that I wanted to make my autohotkey program change the image that the mouse hovers over (within it's own GUI).  No third-party component or dll needed, just a slight modification to the mousemove tooltip in the autohotkey manual.


The reason I did this is because AEC is now a commercial package and it is somewhat limited in terms of good customer service.  It only really manages the payment side and the complicated tasks of invoicing, but Community Builder provides more options for your website members.  If Joomlapolis ever complete the CB Subscription component then there is no need for AEC anymore.

For this we're basically going to follow the AEC installation instructions backwards.

1. Go to your admin panel (back-end)
2. Extensions > Plugin Manager
3. Go to the bottom and change the display # dropdown to ALL
4. Disable Authentication - AEC Access
5. Enable Authentication - Joomla
6. Re-enable any other authentication plugin you used to use.
7. Disable System - AEC Routing
8. Disable System - AEC ErrorHandling
9. Extensions > Install/Uninstall > Plugins
10. Tick Authentication - AEC Access
11. Tick System - AEC ErrorHandling
12. Tick System - AEC Routing
13. Tick User - AEC User
14. Click the Uninstall icon at the top of the page
15. Click on the Modules link (to uninstall modules)
16. Tick mod_acctexp (if you installed this) and Uninstall.
17. Click on the Components link (to uninstall components)
18. Select AcctExp and click on the Uninstall icon.

Now install Community Builder
1. Download the latest version from Joomlapolis.com
2. Unzip to a folder
3. Login to your admin panel
4. Go to Extensions > Install/Uninstall
5. Install com_comprofiler.zip (remember to wait till it confirms it says "Installation finished")
6. Go back to Extensions > Install/Uninstall
7. Install mod_cblogin.zip
8. Install mod_comprofilerModerator.zip
9. Install mod_comprofilerOnline.zip
10. Go to Components > Community Builder
11. Click on the Tools link and click on Synchronize Users
12. Go to Extensions > Module Manager
13. Tick next to CB Login, CB Workflows, CB Online and click Enable
14. Return to Components > Community Builder > Configuration
15. Click on the 'Registration' tab
16. Change Allow User Registration to Yes, ...
17. Make your custom configuration and Save the configuration file.
18. Go to Site > Global Configuration > System
19. Select No next to Allow User Registration and click Save
 


After I installed the rokstories module from www.rockettheme.com, if I clicked on one of the articles (rokstory), I would get a page with the article on it but with the following error (3x) above it:

copyraw
Warning: Invalid argument supplied for foreach() in /home/.../components/com_content/helpers/route.php on line 106
  1.  Warning: Invalid argument supplied for foreach() in /home/.../components/com_content/helpers/route.php on line 106 

After googling I found an unlikely solution which is becoming typical of Joomla. I hadn't switched the site to SEF friendly yet but I did this just to follow along with the solution. You need to make a menuitem to just one of the articles. I have a menu called "unused menuitems" (named unusedmenu), which isn't displayed anywhere on my site. I'm guessing the reference in the database is what corrects this.

Category: Joomla :: Article: 230

 It took a few google searches until I could find out how to change the default weblinks order.  A lot of websites showed how to do this via the admin back-end panel in the advanced configuration... I can't see this panel, there is no advanced parameters under a weblinks category.

The issue is that suppose a menuitem links to a category of weblinks, the default sort order (as in the first time you view the page) is the order in the admin panel (not even by most recent).  I'm going to show you how to do this by title in ascending order without installing any 3rd-party extension as well as by any of the database values used by each link.


 Well there's a lot of autohotkey sites saying that you can apply a transparency and then capture special mouse events to emulate the mouseover and mouseout effects of a button with an image as a background.  I couldn't get any of these working and they looked more confusing then anything else.

My solution is to set up the default button and the image to respond to the ENTER key after you typed something (this is for a search feature) in addition to having a button if the user would rather click then press the ENTER key.  Then create the mouseover and mouseout effects afterwards.


Malware Detected!

Warning: Visiting this site may harm your computer!

The website at .....ru appears to host malware - software that can hurt your computer or otherwise operate without your consent.  Just viisting a site that hosts malware can infect your computer.

For detailed information about the problems with this site, visit the Google Safe Browsing diagnostic page for this address

I understand that visiting this site may harm my computer.

Continue?

warning_malwaredetected.png


Thought I'd put this down as it took me ages to search the Internet for this solution.  In the end, I found it hidden away in the Autohotkey help file and not under the gui events...

The issue here is if you want to do something when a user resizes your program. 

If you search and search, you'll find that GuiClose responds to when you close the app, and GuiSize will run when you resize the app.


Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com

RSS Feed

Related Articles

Joes Revolver Map

Joes Word Cloud

case   error   script   form   list   find   note   code   version   time   order   uploaded   server   joomla   user   report   where   database   parameter   google   value   would   mysql   first   page   following   name   work   create   zoho   display   deluge   field   function   source   need   website   using   license   data   client   creator   table   date   files   added   file   used   system   windows   JoelLipman.Com

Accreditation

Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Paypal:
Donate to Joel Lipman via PayPal

Bitcoin:
Donate to Joel Lipman with Bitcoin bc1qf6elrdxc968h0k673l2djc9wrpazhqtxw8qqp4

Ethereum:
Donate to Joel Lipman with Ethereum 0xb038962F3809b425D661EF5D22294Cf45E02FebF
© 2024 Joel Lipman .com. All Rights Reserved.