magic_quotes_gpc, magic_quotes_runtime

Magic quotes is the name of a PHP feature that automatically quotes input
data, by using the addslashes() function. Historically, this was used so that
form data could be used directly in SQL queries without any security or quoting
issues. Today, form data is used for much more, and magic quotes quickly
get in the way. We recommend that you disable this feature, but portable code
must be aware of these settings and deal with them appropriately by calling
stripslashes() on GPS (GET, POST, and cookie) data.

Website SWOT Analysis

A classic staple of business school is the SWOT analysis—identifying strengths, weaknesses,
opportunities, and threats faced by a business or project. By combining data from your business
asset assessment and historical tracking data (and visitor analytics), you can create some very
compelling analyses of your organization and its marketplace.
Identifying strengths is typically one of the easier objectives:

• What sources of traffic are working well for your site/business?
• Which projects/properties/partnerships are driving positive momentum toward traffic/
revenue goals?
• Which of your content sections/types produces high traffic and ROI?
• What changes have you made historically that produced significant value?
Sourcing out the weaknesses can be tougher (and takes more intellectual honesty and courage):
• What content is currently sending low levels of search/visitor traffic?
• Which changes that were intended to produce positive results have shown little/no value?
• Which traffic sources are underperforming or underdelivering?
• What projects/properties/partnerships are being leveraged poorly?

keys to getting links,

Since creating emotional reactions can result in links, building content that plays to the
emotions of potential linkers can be a powerful tool for obtaining links. Sometimes this
process is referred to as link baiting. One key decision for a business is whether such an
approach to link building is consistent with the company’s brand image, but even a
conservative brand can often find worthy link bait topics to be acceptable.

Create quality reference material. Providing unique and powerful information to users
can be a great way to get links, particularly if you can make sure the publishers of
authoritative sites in your market space learn about what you have created, including why
it would be of value to their website visitors.

 Leverage business relationships. In our example, we suggested that you might be someone
who has a network of resellers. If this is your business model, having a link back to you
as a standard term in your reseller agreement is sound business.

rel microformats

Remember the rel attribute from earlier? That attribute is often used in microformats,
and the usage is generally very simple. The rel-license format, for instance, looks like this:
<a rel="license" href="http://creativecommons.ca
/licenses/by-nc-sa/2.5/">
Creative Commons License</a>
By including a rel attribute with a value of license in the anchor tag, you can indicate
that the destination of the hyperlink is a license for the content contained on the current
page. The example I’m using is from my own design blog Unfortunately Paul, where the
content has been made available under a “Creative Commons Attribution-NonCommercial-
ShareAlike 2.5 License,” which means that people are free to copy, distribute, and display
my published entries and to make derivative works so long as I’m credited, it’s for nonprofit
purposes, and any derivations are released under the same license. Creative
Commons is an organization that provides a variety of “some rights reserved” copyright
licenses, allowing content authors to release their content into the wild but retain some
level of copyright.

Associative Arrays?

You can use string values as keys. For example, you might create an array
like this:

$myStuff = array();
$myStuff[“name”] = “andy”;
$myStuff[“email”] = “andy@fsdsd.ca”;
Print $myStuff[“name”];

Associative arrays are different than normal (numeric-indexed) arrays in
some subtle but important ways:
The order is undefined. Regular arrays are always sorted based on the
numeric index. You don’t know what order an associative array will be
because the keys aren’t numeric.

 You must specify a key. If you’re building a numeric-indexed array, PHP
can always guess what key should be next. This isn’t possible with an
associative array.

 Associative arrays are best for name-value pairs. Associative arrays are
used when you want to work with data that comes in name/value pairs.
This comes up a lot in PHP and XHTML. XHTML attributes are often in
this format, as are CSS rules and form input elements.

✦ Some of PHP’s most important values are associative arrays. The $_
REQUEST variable (described in Chapter 3 of this minibook) is an important
associative array. So are $_GET, $_POST, and several others.

Make sure to include quotation marks if you’re using a string as an array
index.

Arrays and HTML

Arrays are great because they’re used to hold lists of data in your programming
language. Of course, HTML already has other ways of working with
lists. The <ul> and <ol> tags are both used for visual representations of
lists, and the <select> object is used to let the user choose from a list. It’s
very common to build these HTML structures from arrays.

Learning the MySQL Data Types

MySQL uses many different data types, broken into three categories: numeric, date and time, and string types.

 INT—A normal-sized integer that can be signed or unsigned. If signed, the
allowable range is from –2147483648 to 2147483647. If unsigned, the allowable
range is from 0 to 4294967295. You can specify a width of up to 11 digits.

. TINYINT—A small integer that can be signed or unsigned. If signed, the allowable
range is from –128 to 127. If unsigned, the allowable range is from 0 to
255. You can specify a width of up to 4 digits.

 SMALLINT—A small integer that can be signed or unsigned. If signed, the
allowable range is from –32768 to 32767. If unsigned, the allowable range is
from 0 to 65535. You can specify a width of up to 5 digits.

 MEDIUMINT—A medium-sized integer that can be signed or unsigned. If signed,
the allowable range is from –8388608 to 8388607. If unsigned, the allowable
range is from 0 to 16777215. You can specify a width of up to 9 digits.

 BIGINT—A large integer that can be signed or unsigned. If signed, the allowable
range is from –9223372036854775808 to 9223372036854775807. If
unsigned, the allowable range is from 0 to 18446744073709551615. You can
specify a width of up to 11 digits.

FLOAT(M,D)—A floating-point number that cannot be unsigned. You can
define the display length (M) and the number of decimals (D). This is not
required and defaults to 10,2, where 2 is the number of decimals and 10 is the
total number of digits (including decimals). Decimal precision can go to 24
places for a FLOAT.

 DOUBLE(M,D)—A double-precision floating-point number that cannot be
unsigned. You can define the display length (M) and the number of decimals
(D). This is not required and will default to 16,4, where 4 is the number of
decimals. Decimal precision can go to 53 places for a DOUBLE. REAL is a synonym
for DOUBLE.


DECIMAL(M,D)—An unpacked floating-point number that cannot be unsigned.
In unpacked decimals, each decimal corresponds to 1 byte. Defining the display
length (M) and the number of decimals (D) is required. NUMERIC is a synonym
for DECIMAL.

$_GET , $_POST,$_COOKIE??

$_GET contains any variables provided to a script through the GET method.
 $_POST contains any variables provided to a script through the POST method.
 $_COOKIE contains any variables provided to a script through a cookie.

What line should you add to the Apache configuration file to ensure that the .php extension is recognized?

This line ensures that Apache will treat files ending with the .php extension as
PHP scripts:
AddType application/x-httpd-php .php

php.ini Basics

After you have compiled or installed PHP, you can still change its behavior
with the php.ini file. On Linux/UNIX systems, the default location for this file is
/usr/local/php/lib or the lib subdirectory of the PHP installation location you
used at configuration time. On a Windows system, this file should be in the PHP
directory or another directory as specified by the value of PHPIniDir in the Apache