A steady frustration for new Joomla users is the "Welcome to the Frontpage" text that appears on the site.

To remove this, go to Menu Manager (or the "Menu" Dropdown menu in your site's Control Panel), select Main Menu, then click on the Home link.

Click on Parameters (System) and you'll see Page Title controls which will allow you to change or suppress the page title.

There are two controls to be concerned with here:

  1. Page Title: This sets the page title, which may appear on the page itself (This causes the most frustration) but also appears in the title bar.  Typically you don't want to remove this as you want your page title to appear in the titlebar of the browser
  2. Show Page Title: This determines whether the page title appears on the page itself.
 

Prevent SQL Injection attacks in PHP and MySQL

On August 17, 2009, in MySQL, PHP, by Rob

Place this code in your database connect include, just before the database connection is made.

This ensures that SQL injection attempts are handled before the database is opened.

By doing it up front like this, the input is already escaped and we don't have to deal with it in our other scripts as we use input data.

1
2
3
4
5
6
7
8
9
10
11
12
// ~~~~~~~~~~~~~~~~~~~~ SECURE ALL INPUT FROM SQL INJECTION ~~~~~~~~~~~~~~~~~~~~~~~~ //
// --- escape special characters in input data to prevent SQL injection attacks ---- //
 
// Prevent SQL Injection attacks in POST vars
foreach ($_POST as $key => $value) {
  $_POST[$key] = mysql_real_escape_string($value);
}
// Prevent SQL Injection attacks in GET vars
foreach ($_GET as $key => $value) {
  $_GET[$key] = mysql_real_escape_string($value);
}
// ~~~~~~~~~~~~~~~~~~~ /secure all input from sql injection ~~~~~~~~~~~~~~~~~~~~~~~~ //
 

This error can arise when you try to safely remove a memory chip from an internal reader by right clicking the drive and selecting "Safely Remove".

Resolve the error by rebooting the machine, the reader should be reset at startup.

Now follow these steps:

  • Go into Computer Management,
  • Expand Storage, select Disk Management,
  • In the lower center pane, right-click and select Properties to view the property sheet for the card reader's drive letter,
  • Click the Policies tab and ensure that Optimize for quick removal is selected.

This disables write caching for the card slot, ensuring that no cached information can be lost when you remove the card.

 

Unlocking PDF files

On August 10, 2009, in Uncategorized, by Rob

Some .pdf files come with restrictions on printing etc.

Without comment, this site releases those restrictions.

FreeMyPDF.com

 

Sharing authentication between a WordPress log and a co-resident webapp is handy, but can be a bit of a challenge.

Today I needed to find a way for my webapp to pick up my WordPress username in order to use that as a filter criterion in an SQL query.

A little searching and experimenting led me to the following snippet of code which I put in my WordPress header.php file, just below the  tag.

1
2
3
4
<?php
$user = wp_get_current_user();
setcookie("username", $use-->user_login);
?>

This drops a cookie called 'username' which I can retrieve in my PHP webapp

1
echo "Username cookie is  ".$_COOKIE["username"];

There is no doubt a more efficient way of doing this, like ensuring that it only happens once in the session or attaching it to the login code, which I will explore when time permits.  For the moment this works and I can get on with my webapp!

Later:

A look at the wp-login.php suggests that the place to put this in the login script is in the wp_signon() function of user.php. This approach would be much preferable to putting it in the header – there's no sense in dropping the cookie every time a page is loaded. I'll report back when I've had a chance to test this out.