! (logical operator), 38
!= (comparison operator), 37
!= (inequality operator), 40, 87
!== (comparison operator), 37
!== (non-identity operator), 40, 87
$result->fetch_assoc() function, 275
$type parameter, 829
% (modulus operator), 33
% (wildcard character), 293
%= (combined assignment operator), 35
& (bitwise operator), 38
& (reference operator), 36
&& (logical operator), 38
+ (addition operator), 33
++ (increment operator), 35–36
+= (combined assignment operator), 35
, (comma operator), 39
- (subtraction operator), 33
—(decrement operator), 35–36
-= (combined assignment operator), 35
. (string concatenation operator), 26–27
.= (combined assignment operator), 35
/ (division operator), 33
/= (combined assignment operator), 35
< (comparison operator), 37
<< (bitwise operator), 38
<= (comparison operator), 37
= (assignment operator), 34
== (comparison operator), 37
== (equality operator), 40, 87
== (equals comparison operator), 37
=== (comparison operator), 37
=== (identity operator), 40, 87
?: (ternary operator), 39
@ (error suppression operator), 39
a file mode, 63
a+ file mode, 63
about.php files (Tahuayo application), 819
absolute paths, 62
abstract classes, 186
access
associative array contents, 85
control (authentication)
implementing, 392–395
multiple pages, protecting, 399
passwords, 395–399
modifiers, 166–167
MySQL, 219–220
numerically indexed array contents, accessing, 83–84
to .php files, restricting, 374–375
restricting to sensitive data, 364
substrings, substr() function, 118–119
accounts
creating, 668–669
deleting, 670
modifying, 670
online newsletters, 702–705, 719
setting up, 666–668
ACID compliance transactions, 313
Acrobat Web site, 776
actions
Amazon, 826
MLM, 701
script architecture, 694
Add to Cart link, 817
add_bm() function, 597–598, 881
add_bms.php files (PHPBookmark application), 572
add_bm_form.php files (PHPBookmark application), 572
add_quoting() function, 766
addBMResponse() function, 874
adding Ajax elements to PHPbookmark projects, 871–880
addition (+) operator, 33
addNewBookmark() function, 873
addslashes() function, 114, 272, 296, 417
addToCart() function, 852
admin.php files (Shopping Cart application), 611
admin.php script (Shopping Cart application), 641–643
admin_fns.php files (Shopping Cart application), 612
administration menu (admin.php), 641–643
edit_book_form.php script, 646
functions, online newsletters, 721
insert_book.php script, 644–645
insert_book_form.php script, 644
show_book.php script, 646
users, 226–227
views, 609
Adobe
FDF Web site, 789
PostScript, 774–775
Web site, 776
Advanced Maryland Automated Network Disk Archiver (AMANDA), 358
advanced OO features, 184–186, 191
aggregate functions, MySQL, 256
aggregating data, 256–257
Ajax, 856
bookmarks, adding, 872
developer Web sites, 885
elements, 871–880
JavaScript libraries, 884
servers
communication, 863–864
response, 866
XMLHTTPRrequest object, 860–862
ajaxServerTime.html, 866–869
aliases, tables, 253–254
ALL privilege, 227
ALTER privilege, 225
ALTER TABLE statement, 261–263
AMANDA (Advanced Maryland Automated Network Disk Archiver), 358
Amazon
actions, 826
Associate ID, 813
books, showing in categories, 826–828
browse nodes, 816
checking out, 852–853
connecting, 807–808
constants.php file, 823
developer token, 813
index.php file, 820–826
PHP SOAP libraries, 814
project codes, installing, 853–854
sessions, creating, 823
shopping carts, building, 813, 849–852
SOAP (Simple Object Access Protocol), 845–846
solution overview, 815–820
Web Services interfaces, 813–814
XML, parsing, 814
AmazonResultSet class, 819, 828–829
Analog Web site, 330
anchoring strings, 126–127
and operator, 38
anomalies, avoiding (Web databases), 213
anonymous login (FTP), 462
ANSI Web site, 265
anti-aliasing text, 489
Apache
configurations, PHP installations, 904
HTTP server, 380–381
installation
binary installations, 890
source installations, 891
Windows, 902
parameters, MaxClients, 273
resources, 909
running, 897
Software Web site, 909
Today Web site, 909
Web server
basic authentication (HTTP), 400–406
htpasswd program, 405
mod_auth module, 402
mod_auth_mysql module, 406–408
Web site, 891
Week Web site, 909
archives, 7
Bob’s Auto Parts, 14, 17, 199–202
Book-O-Rama application
Database Search page, 268
content, 546
development environment, 544
documentation, 544–545
internationalization, 7
layer protocols, 414
logic, 546
optimizations, 546–547
PHPBookmark
creating, 569
extensions, 606
files, 572
planning, 536–537
prototypes, 545–546
rewriting code, 537–538
running, 536–537
Shopping Cart. See Shopping Cart application
Smart Form Mail
creating, 107–109
regular expressions, 128–129
software engineering, 536
Tahuayo (Amazon), 815–820
testing code, 548
tiers, 218
version control, 542–543
Web forum. See Web forum application
writing maintainable code, 538
breaking up, 541–542
code standards, 538
commenting, 540
directory structures, 542
function libraries, 542
indenting, 540–541
naming conventions, 538–540
architecture, Web databases, 216–218
archives
applications, 7
BUGTRAQ, 437
arguments, 22
Array data type (variables), 29
array() language construct, 82
array_count_values() function, 104
array_push() function, 713
array_reverse() function, 97–98
array_walk() function, 103–104
arrays, 81–82
associative, 85
contents, accessing, 85
each() function, 85–87
initializing, 85
list() function, 85–87
looping through, 85–87
bounding box contents, 497
categoryList, 827
converting to scalar variables, 105–106
elements, 82
applying functions, 103–104
counting, 104
functions, passing by reference, 104
indexes, 82
key-value pairs, getdate() function, 473
loading from files, 98–101
medium style form variable, 24
sorting, 93–95
three-dimensional arrays, 90, 92
two-dimensional arrays, 88–90
navigating within an array, 102
numerically indexed arrays
accessing with loops, 84
contents, accessing, 83–84
initializing, 82–83
reordering, 96
array_reverse() function, 97–98
shuffle() function, 96
set cardinality, 104
sorting, 92
asort() function, 93
ksort() function, 93
reverse order, 93
sort() function, 92
superglobal, 24
article list (Web forum application), 747, 749
adding new articles, 762–769
displaying articles, 752–753
plus symbols, 748
threads
collapsing, 748–752
expanding, 748–751
viewing individual articles, 760–762
ASCII, 772
ASINSearch() method, 829
asort() function, 93
ASP style (PHP tags), 19
combination assignment operators, 35
decrement operators, 35–36
equal sign (=), 25
increment operators, 35–36
reference operator, 36
returning values, 34–35
Associate ID (Amazon), 813
associative arrays, 85. See also arrays
contents, accessing, 85
each() function, 85–87
initializing, 85
list() function, 85–87
associativity, operators, 42–44
asterisk symbol (*), regular expressions, 126
atomic column values (databases), 214–215
attachments, email, 689
attributes, 162–166
creating, 162–164
overriding, 170–173
auditing, 357
authentication, 343, 350–351, 383–384, 401–406. See also security
access control
encrypting passwords, 397–399
implementing, 392–395
multiple pages, protecting, 399
storing passwords, 395
basic authentication (HTTP), 399–400
with Apache .htaccess files, 402–406
in PHP, 400–402
custom, creating, 408
digest authentication (HTTP), 400
identifying users, 391–392
mod_auth_mysql module, 406–408
documentation Web sites, 408
installing, 406–407
testing, 407
passwords, 350–351
session control, 517–524
authmain.php script, 517–522
logout.php script, 523–524
members_only.php script, 522–523
users
input data, validating, 580
logging in, 584–587
logging out, 587–588
passwords, 588–595
Web sites, 408
authmain.php script (authentication), 517–522
auto_append_file (php.ini file), 142–143
AUTO_INCREMENT keyword, 231
auto_prepend_file (php.ini file), 142–143
autocommit mode, 314
autoload()function, 187
automatic generation of images, 490–491
AVG(column) function, 256
b file mode, 63
backing up, 358
AMANDA (Advanced Maryland Automated Network Disk Archiver), 358
databases, 305–306
FTP functions, 459–463
checking update times, 464–465
closing connections, 466
downloads, 465–466
logins, 463
remote connections, 463
MySQL databases, 358
backticks, 448
backtrace (functions), 196
base canvases, 495
baseline descenders, 497
basic authentication (HTTP), 399–400
with Apache .htaccess files, 402–406
in PHP, 400–402
binary installations, 890
MySQL, 892–893
binary large objects (BLOB types), 239, 241
bind_param() method, 281
bindings, late static bindings, 185–186
bitwise operators, 38
BLOB types (binary large objects), 239–241
blocks, 47
catch (exception handling), 194
try (exception handling), 193
Bob’s Auto Parts application, 14, 17
exception handling, 199–202
book details page (Shopping Cart application), 616, 622–623, 646
Book-O-Rama application
Database Search page, 268
setting up, 243
tables, SQL code, 245
book_fns.php files (Shopping Cart application), 612
book_sc database (Shopping Cart application), 612, 614–615
book_sc.sql files (Shopping Cart application), 612
book_sc_fns.php files (Shopping Cart application), 612
bookdisplayfunctions.php files (Tahuayo application), 819
bookmark_fns.php files (PHPBookmark application), 572
bookmarks, 571
bookmark.gif files (PHPBookmark application), 572
deleting, 600–602
displaying, 599
recommending, 571
storing, 571
bookmarks.sql files (PHPBookmark application), 572
books, Amazon categories, 826, 828
Boolean data type (variables), 29
bottom-up approach to security, 363
bottom.php files (Tahuayo application), 819
array contents, 497
coordinates, 496
Boutell Web site, 508
branching (regular expressions), 127
break statement, 56
breaking up code, 541–542
brochureware sites, 328
common pitfalls, 330
limitations, 328
answering feedback, 329
lack of information, 328
poor presentation, 329
tracking success, 330–331
updated information, 329
browse nodes (Amazon), 816
browsedir.php file, 439
browseNode variable, 824
browseNodeSearch() function, 845
browseNodeSearch() method, 829, 835
browsers
authentication, 351
directories, 439
secure transactions, 410–411
Web database architecture, 216
bugs, 376–377
PHP 5.3 fixes, 7
regression, 377
BUGTRAQ archives, 437
building MLM, 687
buttons
colors, 495
make_button.php scripts, 492
scripts, calling, 493
text
colors/fonts, 492
fitting onto, 495–498
positioning, 498–499
writing, 499
cache() function, 847–848
cached() function, 847–848
cachefunctions.php files (Tahuayo application), 820
caching Amazon, 814–815, 846–849
calculate_items() function, 630–631
calculate_price() function, 630–631
calculating dates
in MySQL, 478–480
in PHP, 477–478
calendar functions, 480–481
calling
button scripts, 493
class operations, 167
case sensitivity, 146
errors, 66
parameters, 143–144
prototypes, 144
undefined functions, 145–146
canvas
base, 495
images, creating, 487
caret symbol (^), regular expressions, 126–127
cartfunctions.php files (Tahuayo application), 820
CAs (Certifying Authorities), 355
cascading style sheets (CSS), 546
case sensitivity
calling functions, 146
MySQL statements, 221
strings, changing, 113–114
casts (variable types), 30
catalog scripts (Shopping Cart application), 615–617
index.php, 615–620
show_book.php, 616, 622–623, 646
catch blocks (exception handling), 194
categories, Amazon books, 826, 828
category page (Shopping Cart application), 615, 620–622
categoryfunctions.php files (Tahuayo application), 820
categoryList array, 827
Certificate Signing Request (CSR), 356–357
certification projects, personalized documents, 779
files, 779
index.html file, 780–781
PDF, 788–796
RTF, 784–787
score.php file, 782–784
Certifying Authorities (CAs), 355
CGI Interpreter, 890
CGI specification Web site, 450
change_passwd.php files (PHPBookmark application), 572
change_passwd_form.php files (PHPBookmark application), 572
change_password() function, 590, 720
change_password.php files (Shopping Cart application), 611
change_password_form.php files (Shopping Cart application), 611
characters
classes, 125
escaping, 114
padding, 112
reading, 75
sets, 124–125
check_admin_user() function, 700
check_auth_user() function, 665
check_logged_in() function, 700
check_normal_user() function, 700
check_valid_user() function, 585
checkdate() function, 370, 474
Checkout links, 818
checkout.php files (Shopping Cart application), 611
checkout.php script (Shopping Cart application), 633–638
chgrp() function, 446
child nodes (Web forum tree structure), 743
chmod() function, 446
chown() function, 446
ciphertext (encryption), 351
classes, 160–161
abstract, 186
AmazonResultSet, 828–829
attributes, 164–166
calling, 167
character (regular expressions), 125
converting to strings, 190
creating, 162–164
CSS, 859
designing, 174–175
Exception, 195–196
extending, 196–197
methods, 195
exceptions, creating, 196
inheritance, 162
instantiating, 164
polymorphism, 161
Product, 839
tree_node class, 743
treenode class (Web forum application), 753–760
type hinting, 184
writing code for, 175–183
clauses
GROUP BY, 256–257
HAVING, 257
LIMIT, 258
ORDER BY, 255
SELECT, 255–257
throw, 196
WHERE, 248
comparison operators, 248–249
join condition, 250
client-side programming, 859
cloning objects, 186
closedir($dir) function, 440
closing tags (XML), 810
code
blocks, 47
content, 546
execution directives, 57
indenting, 47
logic, 546
naming conventions, 539
organizing, 374
optimizations, 546–547
prototypes, 545–546
reusing. See reusing code
rewriting, 537–538
Shopping Cart application, 610
testing, 548
version control, 542–543
CVS (Concurrent Versions System), 543
multiple programmers, 543
repository, 542–543
writing, 538–541
Codewalkers Web site, 909
collapsing threads (Web forum application), 748, 752
buttons, 495
RGB (red, green, and blue), 488
text, 492
columns, 232–236
date and time types, 238–239
DESCRIBE statement, 299
keys, 209
creating, 215
foreign keys, 210
primary keys, 210
numeric types, 236–238
floating point data types, 237–238
integral data types, 237
string, 239–241
values, 209
atomic column values, 214–215
EXPLAIN statement, 303
columns_priv table, 288, 292–293
combination assignment operators, 35
comma (,) operator, 39
command line, 531
DESCRIBE, 233–234
GRANT, 223–228
LOCK TABLES, 305
mysql, 221
mysql_dump, 305
phpinfo(), 31
REVOKE, 227–228
SHOW, 233–234
SQL, 229–231
traceroute (UNIX), 344
Web server functions, 447–450
commercial Web sites, 327, 336
adding value to goods or services, 335
authentication, 343
cutting costs, 335–336
firewalls, 357–358
importance of stored information, 342
online brochures, 328
common pitfalls, 330
limitations, 328–331
orders for goods or services, 331–334
privacy policies, 333
providing services and digital goods, 334–335
return policies, 333
risks, 336
competition, 338
crackers, 337
failure to attract business, 337–338
hardware failure, 337
legislation and taxes, 339
service provider failures, 338
software errors, 338
system capacity limits, 339
security, 342
auditing, 357
authentication, 350–351
backing up data, 358
Certificate Signing Request (CSR), 356–357
Certifying Authorities (CAs), 355
compromises, 349
digital certificates, 355
digital signatures, 354–355
encryption, 351–354
hash function, 354
log files, 357
passwords, 350–351
physical security, 359
Secure Web servers, 356–357
security policies, creating, 349–350
threats, 342–348
SSL (Secure Sockets Layer), 333
strategies, selecting, 339
types, 327–328
committed transactions, 314
comparing strings, 119
length, testing, 120
strcasecmp() function, 119
strcmp() function, 119
strnatcmp() function, 119
comparison operators, 36–37
equals operator, 37
WHERE clauses, 248–249
compatibility of commercial Web sites, 334
components, user personalization, 570
compression, SSL (Secure Sockets Layer), 416
compromised servers, 365
Concurrent Versions System (CVS), 543
conditionals, 46
code blocks, 47
comparing, 51
else statements, 47
elseif statements, 48–49
if statements, 46–47
indenting code, 47
switch statements, 49–51
conditions, join, 250
DMZs, 386–387
PHP, 894
sessions, 516–517
web servers
Apache HTTP server, 380–381
Microsoft IIS, 381
connections
Amazon, 807–808
Database servers, 384–385
FTP servers, closing, 466
MySQL database, 293
networks, runtime errors, 557–558
remote FTP servers, 463
Web databases, 273
constants, 31
error reporting, 562
constants.php files
Amazon, 823
Tahuayo application, 819
constructors, 163–164
content (code), 546
continuation symbol (MySQL), 220
continue handlers, 320
continue statements, 56
control
characters
(newline), 68
(tab), 68
alternate syntax, 56
breaking out of, 56
conditionals, 46–51
declare, 57
loops, 51–56
stored procedures, 319–323
version (code), 542–543
CVS (Concurrent Versions System), 543
multiple programmers, 543
repository, 542–543
conversion
arrays to scalar variables, 105–106
calendars, 481
classes to strings, 190
format strings, 112–113
printf() function, 112–113
type codes, 112–113
cookies, 510–511
session IDs, 511–512
setting, 510–511
coordinates, bounding boxes, 496
copy() function, 447
correlated subqueries, 260
cos() function, 804
count() function, 104
COUNT(items) function, 256
counting array elements, 104
CREATE privilege, 226
CREATE TABLE command (SQL), 229–231
CREATE TEMPORARY TABLES privilege, 226
create_database.php files (Warm Mail application), 655
create_database.sql files, 745
MLM application, 691
Web forum application, 744
credit card numbers, storing, 419
criteria, retrieving from databases, 248–249
cross join, 254
crypt() function, 397–398
PHP 5.3, functionality in, 7
cryptography, 352
CSR (Certificate Signing Request), 356–357
CSS (cascading style sheets), 546, 858
classes, 859
curly braces ({}), regular expressions, 126
current() function, 102
cursors (stored procedures), 319–323
custom authentication, creating, 408
cutting costs (commercial Web sites), 335–336
CVS (Concurrent Versions System), 543
data
aggregating, 256–257
encrypting, 418
graphing, 499–507
grouping, 256–257
input
checking, 558
user authentication validation, 580
inserting into databases, 244–245
joins, 254–255
loading from files, 311
redundant data, avoiding (Web databases), 212–213
retrieving
from databases, 246–247
from multiple tables, 249–250
in a particular order, 255–256
with specific criteria, 248–249
rows, returning, 258
sensitive data
credit card numbers, storing, 419
storing, 417–418
storing, 59
tables
aliases, 253–254
joining, 251–252
rows unmatched, 252–253
two-table joins, 250–251
transfer, 306–308
types
BLOB types (binary large objects), 239
date and time data types, 238–239
floating point data types (numeric column types), 237–238
integral data types (numeric column types), 237
TEXT types, 239
variables, 29
Data Definition Languages (DDL), 244
Data Encryption Standard (DES), 353
Data Manipulation Languages (DML), 244
data_valid_fns.php files
MLM application, 691
PHPBookmark application, 572
Shopping Cart application, 612
Warm Mail application, 655
Web forum application, 744
databases, 208
backing up, 305–306
Book-O-Rama
setting up, 243
tables, SQL code, 245
book_sc database (Shopping Cart application), 612–615
creating with MySQL, 222
data
aggregating, 256–257
grouping, 256–257
inserting, 244–245
joins, 254–255
loading from files, 311
retrieving, 246–256
rows unmatched, 252–253
tables, 251–254
two-table joins, 250–251
DDL (Data Definition Languages), 244
DML (Data Manipulation Language), 244
dropping, 264
front page, 574–577
information gathering, 296
EXPLAIN statement, 299–303
SHOW statement, 296–297
keys, 209
foreign keys, 210
primary keys, 210
lists, 688
MySQL, 287
aggregate functions, 256
backing up, 358
columns_priv table, 292
connection verification, 293
db table, 290–291
host table, 291
join types, 254–255
request verification, 293
results.php script, 269
tables_priv table, 292
user table, 289
Web database architecture, 268–271
optimizing, 304–305
default values, 305
designs, 304
indexes, 305
permissions, 304
tables, 304
passwords
encrypting, 295
storing, 295
PEAR, 284–285
privilege system, 287–288
columns_priv table, 293
db table, 290–291
grant table, 293
host table, 290–291
privileges, updating, 293–294
tables_priv table, 293
user table, 289–290
queries, indexes, 304
records
deleting, 264
updating, 261
relational databases, 210
relationships, 211
many-to-many relationships, 211
one-to-many relationships, 211
one-to-one relationships, 211, 216
replication, 306–307
data transfer, 306–308
master servers, 306–307
slaves, 306–308
restoring, 306
rows, returning, 258
runtime errors, 555–557
security, 294
operating system, 294
passwords, 295
user privileges, 295–296
Web issues, 296
selecting in MySQL, 229
servers
connecting to, 384–385
security, 383–385
setting up (online newsletters), 692–694
Shopping Cart application, 615
SQL (Structured Query Language), 243–244
subqueries, 258–259
correlated, 260
operators, 259
row, 260
temporary tables, 260
subscribers, 688
tables, 208
altering, 261–263
Cartesian product, 250
creating in MySQL, 229–231
dropping, 264
equi-joins, 251
indexes, creating, 234–235
joins, 250
keywords, 231
left joins, 252–253
rows, 209
values, 209
viewing, 233–234
Warm Mail application (email client), 655–656
Web forum application, 744–745, 747
date and time
calendars, 481
column types, 238–239
converting between PHP and MySQL formats, 476–477
data types, 238–239
in MySQL
calculations, 478–480
DATE_FORMAT() function, 476–477
MySQL Web site, 481
UNIX_TIMESTAMP() function, 476–477
calculations, 477–478
calendar functions, 480–481
checkdate() function, 474
date() function, 469–472
floor() function, 478
getdate() function, 473
microseconds, 480
mktime() function, 471–472
PHP Web site, 481
date() function, 21–22, 445, 469–471
format codes, 469–471
Unix timestamps, 471–472
date_add() function, 478
DATE_FORMAT() function, 476–477
date_sub() function, 478
db_connect() function, 583
db_fns.php files
MLM application, 691
PHPBookmark application, 572
Shopping Cart application, 612
Warm Mail application, 655
Web forum application, 744
db_result_to_array() function, 619
DDL (Data Definition Languages), 244
DDoS (Distributed Denial of Service), 346, 364
preparing for, 387
debugging variables, 559–561
declare control structure, 57
declare handlers, 320
declaring
functions, 146–147
stored functions, 318–319
stored procedures, 316–317
decoct() function, 446
decrement operators, 35–36
decryption, 352
default values, database optimization, 305
DELETE privilege, 225
DELETE statement, 264
delete_account() function, 670
delete_bm() function, 601
delete_bms.php files
PHPBookmark application, 572
Shopping Cart application, 612
delete_category.php files (Shopping Cart application), 612
delete_message() function, 681–682
deletion anomalies, avoiding (Web databases), 213
Denial of Service (DoS), 346–347, 364
deploying new software versions, 379
deregistering variables, 513
DES (Data Encryption Standard), 353
DESC keyword, 255
descenders (letters), 497
DESCRIBE command, 233–234
DESCRIBE statement, 299
describe user; statement, 289
design. See also configuration
classes, 174–175
database optimization, 304
Web databases, 211
anomalies, avoiding, 213
atomic column values, 214–215
keys, creating, 215
null values, avoiding, 216
questions, formulating, 215
real-world objects, modeling, 211–212
redundant data, avoiding, 212–213
table types, 216
design_button.html file, 492–493
destroying sessions, 513
destructors, 163–164
Details link, 817
developer token (Amazon), 813
development environments, 544
DHTML (Dynamic HTML), 857
diagrams
entity relationship, 210
online newsletters, 689–691
die() language construct, 526
digest authentication (HTTP), 400
digital certificates, 355
digital goods (commercial Web sites), providing, 334–335
digital signatures, 354–355
directives
execution, 57
magic_quotes_gpc, 417
magic_quotes_runtime, 417
php.ini file, editing, 529–530
browsing, 439
extensions, copying libpdf_file, 899
files, write permissions, 418
functions, 439
creating directories, 443
deleting directories, 443
file paths, 442–443
reading from directories, 439–441
structures, 542
disabling unnecessary OS applications, 388
disaster recovery, 364
planning, 388–389
disconnecting Web databases, 276
discussion board application, 741–742, 763–764
article list, 747–749
collapsing threads, 748–752
displaying articles, 752–753
expanding threads, 748–751
individual articles, viewing, 760–762
new articles, adding, 762–769
plus symbols, 748
database design, 744–747
extensions, 769
files, 744
posters, 744
solutions, 742–744
tree structure, 742–743
tree_node class, 743
discussion boards, 741
discussion_fns.php files (Web forum application), 744
disgruntled employees, 366
disk_free_space($path) function, 443
display() function, 758
display_account_form() function, 667, 703, 719
display_account_select() function, 672–673
display_account_setup() function, 667, 669
display_book_form() function, 647
display_button() function, 733
display_cart() function, 627–630
display_categories() function, 618–619
display_information() function, 713–714
display_items() function, 709
display_list() function, 674
display_list_form() function, 722
display_mail_form() function, 726
display_message() function, 678
display_password_form() function, 719
display_post() function, 762
display_preview_button() function, 733
display_registration_form() function, 577
display_tree() function, 752–753
display_user_menu() function, 585
display_user_urls() function, 599
displaying articles (Web forum application), 752–753
Distributed Denial of Service (DDoS), 346
division operator, 33
DML (Data Manipulation Languages), 244
DMZs (demilitarized zones), 366
configuring, 386–387
dns_get_mx() function, 459
do..while loops, 55–56
do_html_header() function, 632, 672, 700
Document Type Definition. See DTD
documentation
gd, Web site, 508
Web application projects, 544–545
documents
personalized, 771
RTF, 784–787
certification project, 779–781, 788–796, 802–804
creating, 771–772
extensions, 805
formats, 772
requirements, 776–777
DOM (Document Object Model), 857
web resources, 884
DoS (Denial of Service), 346–347, 364
preparing for, 387
double data type (variables), 29
doubleval() function, 296
downloading
files from FTP servers, 465–466
FreeType library, 484
jpeg-6b, 484
PostScript Type 1 fonts, 484
t1lib, 484
draw_star() function, 804
drawing
figures, 499–507
functions, 488
images, scripts, 486
text, 487–489
DROP DATABASE statement, 264
DROP privilege, 226
DROP TABLE statement, 264
dropping
databases, 264
tables, 264
DTD (Document Type Definition), 810
dump variables.php file, 559
dynamic content, 21
date() function, 21–22
functions, 22
e-commerce Web sites, 327, 336
adding value to goods or services, 335
authentication, 343
cutting costs, 335–336
online brochures, 328
common pitfalls, 330
limitations, 328–331
orders for goods or services, 331–334
privacy policies, 333
providing services and digital goods, 334–335
return policies, 333
risks, 336
competition, 338
crackers, 337
failure to attract business, 337–338
hardware failure, 337
legislation and taxes, 339
service provider failures, 338
software errors, 338
system capacity limits, 339
security, 342
auditing, 357
authentication, 350–351
backing up data, 358
Certificate Signing Request (CSR), 356–357
Certifying Authorities (CAs), 355
compromises, 349
digital certificates, 355
digital signatures, 354–355
encryption, 351–354
firewalls, 357–358
hash function, 354
importance of stored information, 342
log files, 357
passwords, 350–351
physical security, 359
Secure Web servers, 356–357
security policies, creating, 349–350
threats, 342–348
SSL (Secure Sockets Layer), 333
strategies, selecting, 339
types, 327–328
echo statements, 26–27
edit_book.php files (Shopping Cart application), 612
edit_book_form.php files (Shopping Cart application), 612, 646
edit_category.php files (Shopping Cart application), 611
edit_category_form.php files (Shopping Cart application), 611
elements, 82
applying functions, 103–104
counting, 104
root elements (XML), 811
else statements, 47
elseif statements, 48–49
accounts
creating, 668–669
deleting, 670
modifying, 670
setting up, 666–668
attachments, 689
encryption, 419–420
GPG (Gnu Privacy Guard), 419–427
PGP (Pretty Good Privacy), 419
reading, 452
sending, 452
Warm Mail application
database, 655–656
deleting email, 681–682
email, 681–682
extensions, 686
files, 654–655
forwarding/replying, 684–685
IMAP function library, 652–653
interface, 654
logging in, 663–666
logging out, 666
reading mail, 671–681
script architecture, 657, 662–663
sending, 682–685
solutions, 652–654
embedding PHP in HTML, 17–18
comments, 20–21
PHP
statements, 19–20
tags, 18–19
whitespace, 20
empty() function, 45
algorithm, 351
ciphertext, 351
cryptography, 352
data, 418
Data Encryption Standard (DES), 353
decryption, 352
digital certificates, 355
digital signatures, 354–355
GPG (Gnu Privacy Guard), 419
installing, 420–422
key pairs, 420–421
testing, 422–427
hash functions, 354
PGP (Pretty Good Privacy), 419
plain text, 351
private keys, 353
public keys, 353–354
RSA, 353
end() function, 102
engineering software, 536
entities (HTML), 372
entity relationship diagrams, 210
ENUM type, 241
envelopes, SOAP, 812
environments
development, 544
PHP functions, 450
EPA Web site, 359
equal sign (=) assignment operator, 25
equality operator, 87
equals operator, 37
Equifax Secure, 355
ereg() function, 129–130
eregi() function, 129
ereg_replace() function, 130
eregi_replace() function, 130
401 errors (HTTP), 404
exception handling, 565–567
exit statement, 56
function calling, 66
handling, 202
logic, 558–559
messages, 145–146
PHP 5.3, 7
programming, 551–554
logic errors, 558–559
runtime errors, 553–555
syntax errors, 552–553
reporting levels, 562–563
runtime, 553–554
database interaction, 555–557
functions that don’t exist, 554–555
input data, checking, 558
network connections, 557–558
reading/writing files, 555
settings, 563–564
developer assumptions, 347
poor specifications, 347
poor testing, 348
suppression operator, 39
syntax, 552–553
triggering, 564
escapeshellcmd() function, 378, 417, 449
escaping characters, 114
escaping output, 371
eval() function, 525–526
evaluating strings, 525–526
Evil Walrus Web site, 909
examining php.ini file, 380
Exception class, 195–196
extending, 196–197
methods, 195
Bob’s Auto Parts application, 199–202
catch blocks, 194
classes, 196
Exception class, 195–197
I/O (input/output) files, 199
throwing, 193
try blocks, 193
tutorials, 203
user-defined exceptions, 196–199
exec() function, 447
executable content (stored data), 417
execution
command line, 531
directives, 57
operator, 39–40
quotes, 377–378
exit
handlers, 321
language constructs, 526
statements, 56
expand_all() function, 751
expanding threads (Web forum application), 748–751
EXPLAIN statement, 299–303
column values, 303
join types, 301–302
explode() function, 100–101, 116–117, 459
expressions
regular, 123–124
* symbol, 126
+ symbol, 126
branching, 127
caret symbol (^), 126–127
character sets, 124–125
curly braces ({}), 126
Perl, 123
slash (), 127
Smart Form Mail application, 128–129
special characters, 127–128
splitting strings, 130
string anchoring, 126–127
subexpressions, 126
substrings
finding, 129–131
extending
Exception class, 196–197
syntax, 257
Extensible Markup Language. See XML
extensions
copying libpdf_file, 899
loading, 528
online newsletters, 740
personalized documents, 805
PHPBookmark application, 606
require() statement, 136
Shopping Cart application, 650
Warm Mail application, 686
Web forum application, 769
extract() function, 105–106
extract_type parameter, 105
extract_type parameter, 105
Extreme Programming Web site, 549
f file mode, 63
FastTemplate Web site, 546
FDF Web site, 789
fdf_create() function, 789
fdf_set_file() function, 789
fdf_set_value() function, 789
Fedex Web site, 335
feof() function, 73
fetchRow() method, 284
fgetc() function, 75
fgetcsv() function, 73–74
fgets() function, 73
fgetss() function, 73
fields
scope, 290
tables, 209
figures, drawing, 499–507
File Details view, 445
File Transfer Protocol. See FTP
file() function, 74
file_exists() function, 76
fileatime() function, 445
filedetails.php file, 444–445
filegroup() function, 444, 446
fileinfo extension, 7
filemtime() function, 445
filename extensions, require() statement, 136
fileowner() function, 444, 446
fileperms() function, 446
backing up, 459–466
browsedir.php, 439
checking, 76
closing, 69
constants.php (Amazon), 823
create_database.sql, 745
creating, 447
data, loading from, 311
design_button.html, 492–493
dump variables.php, 559
filedetails.php, 444–445
formats, 68–69
handle.php, 566
htaccess files (Apache Web server), 402–406
httpd.conf, 896–897
I/O (input/output), 199
index.html (certification application), 780–781
index.php
MLM online newsletters, 694
Tahuayo application, 820–826
Warm Mail application, 657
libpdf_php, copying, 899
limitations, 79
loading arrays from, 98–101
locking, 78–79
log files, 357
lookup.php, 453
make_button.php, 493
mirroring FTP functions, 459–466
MLM, 690
modes, 61–62
moving, 447
multiple, uploading (online newsletters), 727, 731
navigating, 76–77
new_post.php, 763
newbooks.txt, 311
opening, 61
file modes, 61–62
fopen() function, 62–64
FTP (File Transfer Protocol), 64–65
HTTP (Hypertext Transfer Protocol), 64–65
potential problems, 65–66
paths, directories, 442–443
pdflib.php, 796
personalized documents, 779
php.ini file
auto_append_file, 142–143
auto_prepend_file, 142–143
directives, editing, 529–530
PHPBookmark application, 572
pollsetup.sql, 500
progex.php, 448–449
properties, changing, 446
feof() function, 73
fgetc() function, 75
fgetcsv() function, 73–74
fgets() function, 73
fgetss() function, 73
file() function, 74
fopen() function, 72
fpassthru() function, 74
fread() function, 75
readfile() function, 74
reading/writing, 555
rtf.php, 786
score.php (certification project), 782–784
Shopping Cart application, 611–612
showpoll.php, 502–506
simplegraph.php, 486
status function results, 448–449
Tahuayo application, 819–820
topbar.php, 825
uploading, 431–432
displaying, 437
FTP (File Transfer Protocol), 466
HTML, 431–433
online newsletters, 688–689
PHP, writing, 434–438
troubleshooting, 438–439
utilityfunctions.php, 825
vote.html, 500
Warm Mail application (email client), 654–655
Web forum application, 744
write permissions, 418
writing, 61
file formats, 68–69
fputs() function, 67
fwrite() function, 67
fwrite() function, parameters, 68
filetype() function, 446
filled_out() function, 580–581
filtering
input data (Web databases), 272
user input, 367–371
final keyword, 172
find and replace substrings, 122–123
finding substrings, 120–121
numerical position, 121
regular expressions, 129–130
strchr() function, 121
stristr() function, 121
strpos() function, 121
strrchr() function, 121
strrpos() function, 122
strstr() function, 121
findstr.exe, 377
FishCartSQL, 650
fitting text onto buttons, 495–498
flat files, 59–61
checking, 76
closing, 69
deleting, 76
formats, 68–69
limitations, 79
locking, 78–79
navigating, 76–77
opening, 61
file modes, 61–62
fopen() function, 62–64
FTP (File Transfer Protocol), 64–65
HTTP (Hypertext Transfer Protocol), 64–65
potential problems, 65–66
feof() function, 73
fgetc() function, 75
fgetcsv() function, 73–74
fgets() function, 73
fgetss() function, 73
file() function, 74
fopen() function, 72
fpassthru() function, 74
fread() function, 75
readfile() function, 74
writing, 61
file formats, 68–69
fputs() function, 67
fwrite() function, 67
fwrite() function, parameters, 68
Float data type (variables), 29
floating point data types (numeric column types), 237–238
flock() function, 78
floor() function, 478
focus groups, 330–331
fonts
button text, 492
descenders, 497
FreeType library, downloading, 484
images, creating, 491–499
PDF readers, 794–795
PostScript Type 1 fonts, downloading, 484
TrueType, 492
footers, script architecture, 694
fopen() function, 61–64, 72, 440, 454
for loops, 54–55
foreach loops, 54–55
iteration, 191
databases, 210
InnoDB tables, 315–316
forgot_form.php files (PHPBookmark application), 572
forgot_passwd.php files (PHPBookmark application), 572
formats
codes, date() function, 469–471
images, 484
GIF (Graphics Interchange Format), 485
JPEG (Joint Photographic Experts Group), 485
PNG (Portable Network Graphics), 485
WBMP (Wireless Bitmap), 485
personalized documents, 772
ASCII, 772
HTML, 773
paper, 772
PDF, 775
PostScript, 774–775
RTF, 774
word processors, 773
strings, 110
case, changing, 113–114
conversion specifications, 112–113
HTML formatting, 110–111
ltrim() function, 110
nl2br() function, 110–111
rtrim() function, 110
storage, 114–116
trim() function, 110
trimming whitespace, 110
forms
Bob’s Auto Parts application, 14, 17
creating, 14–16
processing, 16
totaling with operators, 41–42
variables, accessing, 23–27
forum application. See Web forum application
forwarding to email, Warm Mail application, 684–685
fpassthru() function, 74
FPDF function library, 778
fputs() function, 67
fread() function, 75
FreeType library, downloading, 484
fseek() function, 77
ftell() function, 76
FTP (File Transfer Protocol), 459
anonymous login, 462
backing up files, 459–463
checking update times, 464–465
closing connections, 466
downloads, 465–466
logins, 463
remote connections, 463
FTP transfer modes, 466
ftp_get() function, 466
ftp_mdtm() function, 464
ftp_nlist() function, 467
ftp_size() function, 467
mirroring files, 459–463
checking update times, 464–465
closing connections, 466
downloads, 465–466
logins, 463
remote connections, 463
opening files, 64–65
set_time_limit() function, 467
timeouts, avoiding, 467
uploading files, 466
ftp_connect() function, 463
ftp_get() function, 466
ftp_mdtm() function, 464
ftp_nlist() function, 467
ftp_size() function, 467
functions, 143–144, 151, 158. See also commands
$result->fetch_assoc(), 275
add_bm(), 597–598
add_quoting(), 766
addslashes(), 114, 272, 296, 417
addToCart(), 852
aggregate, MySQL, 256
applying to array elements, 103–104
arguments, 22
array_count_values(), 104
array_push(), 713
array_reverse(), 97–98
array_walk(), 103–104
arsort(), 93
asort(), 93
autoload(), 187
AVG(column), 256
backtrace, 196
browseNodeSearch(), 845
cache(), 847–848
cached(), 847–848
calculate_items(), 630–631
calculate_price(), 630–631
calendars, 480–481
case sensitivity, 146
errors, 66
parameters, 143–144
prototypes, 144
undefined functions, 145–146
check_admin_user(), 700
check_auth_user(), 665
check_logged_in(), 700
check_normal_user(), 700
check_valid_user(), 585
chgrp(), 446
chmod(), 446
chown(), 446
closedir($dir), 440
copy(), 447
cos(), 804
count(), 104
COUNT(items), 256
creating, 146
crypt(), 397–398
current(), 102
format codes, 469–471
Unix timestamps, 471–472
DATE_FORMAT(), 476–477
db_connect(), 583
db_result_to_array(), 619
declaring, 146–147
decoct(), 446
delete bm(), 601
delete_account(), 670
delete_message(), 681–682
directories, 439
creating, 443
deleting, 443
file paths, 442–443
reading from, 439–441
disk_free_space($path), 443
display() function, 758
display_account_form(), 667, 703, 719
display_account_select(), 672–673
display_account_setup(), 667, 669
display_book_form(), 647
display_button(), 733
display_cart(), 627–630
display_categories(), 618–619
display_information(), 713–714
display_items(), 709
display_list(), 674
display_list_form(), 722
display_mail_form(), 726
display_message(), 678
display_password_form(), 719
display_post(), 762
display_preview_button(), 733
display_registration_form(), 577
display_tree(), 752–753
display_user_menu(), 585
display_user_urls(), 599
do_html_header(), 632, 672, 700
doubleval(), 296
drawing parameters, 488
draw_star(), 804
empty(), 45
end(), 102
ereg(), 129–130
eregi(), 129
ereg_replace(), 130
eregi_replace(), 130
escapeshellcmd(), 378, 417, 449
eval(), 525–526
exec(), 447
expand_all(), 751
extract(), 105–106
fdf_create(), 789
fdf_set_file(), 789
fdf_set_value(), 789
feof(), 73
fgetc(), 75
fgetcsv(), 73–74
fgets(), 73
fgetss(), 73
file(), 74
file_exists(), 76
fileatime(), 445
filemtime(), 445
fileperms(), 446
files
creating, 447
deleting, 447
moving, 447
properties, changing, 446
reading, 444–446
status results, 448–449
filetype(), 446
filled_out(), 580–581
flock(), 78
floor(), 478
fpassthru(), 74
fputs(), 67
fread(), 75
fseek(), 77
ftell(), 76
FTP functions, 459–466
backing up files, 459–466
ftp_get(), 466
ftp_mdtm(), 464
ftp_nlist(), 467
ftp_size(), 467
mirroring files, 459–466
set_time_limit(), 467
timeouts, avoiding, 467
uploading files, 466
ftp_connect(), 463
fwrite(), 67–68
get_accounts(), 668
get_account_list(), 671
get_archive(), 716
get_categories(), 618
get_category_name(), 621
get_current_user(), 529
get_email(), 707
get_extension_funcs(), 528
get_loaded_extensions(), 528
get_magic_quotes_gpc() function, 272
get_post(), 761–762
get_post_title(), 765
get_random_word(), 593
get_unsubscribed_lists(), 712
getCategoryName(), 826–827
getdate(), 473
getenv(), 450
getlastmod(), 529
gettype(), 44
highlight_file(), 530–531
htmlentities, 372–374
htmlspecialchars(), 272, 372–374, 417
ImageColorAllocate(), 488
ImageCreate(), 487
ImageCreateFromGIF(), 487, 495
ImageCreateFromJPEG(), 487, 495
ImageCreateFromPNG(), 487, 495
ImageDestroy(), 490
ImageFill(), 488
ImageFilledRectangle(), 505–507
ImageGetTTFBBox(), 496
ImageJPEG(), 490
ImageLine(), 505
ImageRectangle(), 507
images, 507
ImageString(), 488
ImageTTFBBox(), 497
IMAP function library, 652–653
imap_body(), 679–680
imap_delete(), 682
imap_expunge(), 682
imap_fetchheader(), 679
imap_header(), 679
imap_open(), 675–676
implode(), 117
ini_get(), 529–530
ini_set(), 529–530
insert_order(), 636
intval(), 101
is_uploaded_file(), 438
join(), 117
krsort(), 93
ksort(), 93
libraries, 542
FPDF, 778
mail_fns.php, 668
output_fns.php, 664
PHPBookmark application, 572
list(), 85–87
load_list_info(), 714
lstat(), 446
ltrim(), 110
max() function, 155–156
MAX(column), 256
microtime(), 480
MIN(column), 256
mkdir(), 443
mktime(), 471–472
my_error_handler (), 565
mysql_affected_rows(), 280
mysql_query(), 274–275
mysql_select_db(), 274
mysqli_errno(), 556
mysqli_error(), 556
mysqli_fetch_assoc(), 275
mysqli_query(), 556
network lookup, 455–459
dns_get_mx(), 459
explode(), 459
gethostbyaddr(), 458
gethostbyname(), 456–458
getmxrr(), 456
parse_url(), 458
next(), 102
nl2br(), 110–111
notify_password(), 592–594
number_of_accounts(), 671
ODBC (Open Database connectivity), 282
open_mailbox(), 675
opendir(), 440
overloading, 147
pass by reference, 153–154
pass by value, 153–154
passing functions by reference, 104
passthru(), 448
pdf_add_outline(), 794
pdf_begin_page(), 793
pdf_close(), 796
pdf_fill(), 804
pdf_rect(), 802
pdf_replace(), 789
pdf_setlinewidth(), 802
pdf_set_info(), 793
pdf_show(), 795
pdf_show_xy(), 803
pdf_stringwidth(), 803
pdf_stroke(), 802
PHP environment variables, 450
posix_getgrgid(), 446
posix_getpwuid(), 444–446
pretty(), 714
prev(), 102
print(), 110
printf(), 111–112
prototypes, 144
putenv(), 450
range(), 83
readdir($dir), 440
readfile(), 74
recommend_urls(), 603–605
recursive functions, 156–158
register(), 582
rename(), 447
reset_password(), 592
reset(), 102
retrieve_message(), 678
returning from, 154–155
rewind(), 76
rewinddir($dir), 441
rmdir(), 443
rsort(), 93
rtrim(), 110
runtime errors, 554–555
safeString(), 825
scope, 151
send(), 734
send_message(), 683–684
session_get_cookie_params(), 511
session_register(), 513
session_start(), 512–515
session_unregister(), 513
set_error_handler(), 565
setcookie(), 510–511
settype(), 44
shal1(), 398
shopping carts (Amazon), 849
show_source(), 530–531
showBrowseNode(), 826–827
showCart(), 852
showCategories(), 826
ShowSmallCart(), 825
shuffle(), 96
sin(), 804
sizeof(), 104
sort(), 92
split(), 130
sprintf(), 111
stat(), 446
STD(column), 256
STDDEV(column), 256
store_account(), 704
store_account_settings(), 668–669
store_list(), 723
store_new_post(), 767
stored, declaring, 318–319
strcasecmp(), 119
strchr(), 121
strcmp(), 119
strings
case, 113–114
versus regular expressions, 131
strip_tags(), 417
stristr(), 121
strlen(), 120
strnatcmp(), 119
strpos(), 121
strrchr(), 121
strrpos(), 122
strtok() function, 117
strtolower(), 113
strtoupper(), 113
subscribe(), 717
substr(), 118–119
substr_replace(), 123
SUM(column), 256
system(), 448
touch(), 447
uasort(), 95
ucfirst(), 113
ucwords(), 114
uksort(), 95
umask(), 443
undefined, calling, 145–146
UNIX_TIMESTAMP(), 476–477
unset(), 45
unsubscribe(), 717
usort(), 94
valid_email(), 581
values, returning, 155–156
reinterpreting, 46
scope, 151–153
status, testing, 45
type, setting/testing, 44–45
fwrite() function, 67–68
gd documentation Web site, 508
generating images automatically, 490–491
get_account_list() function, 671
get_accounts() function, 668
get_archive() function, 716
get_categories() function, 618
get_category_name() function, 621
get_current_user() function, 529
get_email() function, 707
get_extension_funcs() function, 528
get_loaded_extensions() function, 528
get_magic_quotes_gpc() function, 272
get_post() function, 761–762
get_post_title() function, 765
get_random_word() function, 593
get_unsubscribed_lists() function, 712
get_user_urls() function, 585, 599
getARS() function, 828, 844, 846
getCategoryName() function, 826–827
getdate() function, 473
getenv() function, 450
gethostbyaddr() function, 458
gethostbyname() function, 456–458
getlastmod() function, 529
getmxrr() function, 456
getServerTime() function, 862–868
gettype() function, 44
Ghostscript Web site, 775
GIF (Graphics Interchange Format), 485
global privileges, 224
global scope, 151
global variables, 151
GMT (Unix Epoch), 471
Gnu Privacy Guard (GPG), 419
installing, 420–422
key pairs, 420–421
testing, 422–427
Web site, 419
goods (commercial Web sites)
adding value to, 335
digital goods, providing, 334–335
taking orders for, 331–334
Google Web site, 811
GPG (Gnu Privacy Guard), 419
installing, 420–422
key pairs, 420–421
testing, 422–427
Web site, 419
GRANT command, 223–228
GRANT privilege, 295
Graphics Interchange Format (GIF), 485
graphs
data, 499–507
tutorials, 508
Gregorian calendar, 480–481
GROUP BY clause, 256–257
grouping data, 256–257
-h switch (mysql command), 221
hackers, 366
handle.php file, 566
handlers
continue, 320
declare, 320
exit, 321
handling
errors, 202
Bob’s Auto Parts application, 199–202
catch blocks, 194
classes, creating, 196
Exception class, 195–197
I/O (input/output) files, 199
throwing exceptions, 193
try blocks, 193
tutorials, 203
user-defined exceptions, 196–199
handshaking, 414–415
failure (commercial Web sites), 337
thieves, 366
hash() function, 354
PHP 5.3, functionality in, 7
HAVING clause, 257
header bar summaries, printing (Shopping Cart application), 632
Header() function, 489–490, 787
headers
generating certificates, 804
message headers (Warm Mail application), 680–681
script architecture, 694
HEAP tables, 312
Hello World scripts, PDFlib, 792–796
heredoc syntax, 27
highlight_file() function, 530–531
highlighting syntax, 530–531
hosting services, 382–383
HotScripts.com Web site, 908
htaccess files (Apache Web server), 402–406
HTML (Hypertext Markup Language), 773
embedding PHP, 17–18
comments, 20–21
statements, 19–20
tags, 18–19
whitespace, 20
entities, 372
file upload, 433
formatting (strings), 110–111
forms
file upload, 431
order, creating, 14–16
htmlentities() function, 372–374
htmlspecialchars() function, 272, 372–374, 417
htpasswd program (Apache Web server), 405
HTTP (Hypertext Transfer Protocol), 414, 856
authentication Web sites, 408
basic authentication, 399–400
401 errors, 404
with Apache .htaccess files, 402–406
in PHP, 400–402
digest authentication, 400
handshaking, 414–415
opening files, 64–65
requests, 856–857
Secure Sockets Layer (SSL), 414
XML Amazon connections, 808
httpd.conf, 896–897
HTTPResponse() function, 866
Hypertext Markup Language. See HTML
Hypertext Transfer Protocol. See HTTP
I/O (input/output) files, exception handling, 199
IDE (Integrated Development Environment), 544
identifiers, 28
images, destroying, 490
MySQL identifiers, 235–236
results identifiers, 275–276
identity operator, 87
if statements, 46–47
ImageColorAllocate() function, 488
ImageCreate() function, 487
ImageCreateFromGIF() function, 487, 495
ImageCreateFromJPEG() function, 487, 495
ImageCreateFromPNG() function, 487, 495
ImageDestroy() function, 490
ImageFill() function, 488
ImageFilledRectangle() function, 505, 507
ImageGetTTFBBox() function, 496
ImageJPEG() function, 490
ImageLine() function, 505
ImageMagick library, 483
ImageRectangle() function, 507
images
canvas, creating, 487
colors, RGB (red, green, and blue), 488
creating, 486–487
fonts, 491–495
data, graphing, 499–507
drawing scripts, 486
figures, drawing, 499–507
formats, 484
GIF (Graphics Interchange Format), 485
JPEG (Joint Photographic Experts Group), 485
PNG (Portable Network Graphics), 485
WBMP (Wireless Bitmap), 485
functions, 507
generating automatically, 490–491
identifiers, destroying, 490
inline, dynamically produced, 491
outputting, 489–490
supporting PHP, 484
text
drawing/printing, 487–489
fitting onto buttons, 495–498
positioning, 498–499
writing onto buttons, 499
ImageString() function, 488
ImageTTFBBox() function, 497
ImageTTFText() function, 496, 507
IMAP (Internet Message Access Protocol), 452, 651–652
client Web site, 891
function library, 652–653
imap_body() function, 679–680
imap_delete() function, 682
imap_expunge() function, 682
imap_fetchheader() function, 679
imap_header() function, 679
imap_headers() function, 676, 679
imap_open() function, 675–676
implementing
inheritance, 167–168
login (online newsletters), 702
PHPBookmark database, 573–577
recommendations, 602–605
implode() function, 117
importing public keys (Gnu Privacy Guard), 422
include() statement, 134
auto_append_file (php.ini file), 142–143
auto_prepend_file (php.ini file), 142–143
include_fns.php files
MLM application, 691
Warm Mail application, 655
Web forum application, 744
increment operators, 35–36
INDEX privilege, 225
index.html files (certification application), 779–781
index.php file
MLM application, 691
MLM online newsletters, 694
Shopping Cart application, 611
Tahuayo application, 819–826
Warm Mail application, 655–657
Web forum application, 744
index.php script (Shopping Cart application), 615–620
indexes
arrays, 304
creating (MySQL), 234–235
database optimization, 305
queries, 304
inequality operator, 87
inheritance, 162
implementing, 167–168
multiple inheritance, 172–174
preventing, 172
ini_get() function, 529–530
ini_set() function, 529–530
initializing
associative arrays, 85
numerically indexed arrays, 82–83
inline images, dynamically produced, 491
inner join, 254
InnoDB tables
foreign keys, 315–316
transactions, 314–315
input data
filtering, 272
validating, 580
input/output (I/O) files, exception handling, 199
insert book.php script, prepared statements, 280
INSERT privilege, 225
INSERT queries, 276–280
INSERT statement, 244
insert_book.php files (Shopping Cart application), 611
insert_book.php script, 278–279
insert_book.php script (Shopping Cart application), 644–645
insert_book_form.php files (Shopping Cart application), 611
insert_book_form.php script (Shopping Cart application), 644
insert_category.php files (Shopping Cart application), 611
insert_category_form.php files (Shopping Cart application), 611
insert_order() function, 636
insertion anomalies, avoiding (Web databases), 213
install program (Apache), 902
installation
Apache, Windows, 902
binary installations, 890–893
GPG (Gnu Privacy Guard), 420–422
MIME mail package, 905
mod_auth_mysql module, 406–407
MySQL, 900–901
PEAR (PHP Extension and Application Repository), 905–906
project codes, Amazon, 853–854
source installations, 891–896
instanceof type operator, 40
instances, SOAP (Simple Object Access Protocol), 845
instantiating classes, 164
integer data types
numeric column types, 237
variables, 29
Integrated Development Environment (IDE), 544
interfaces
administration interface (Shopping Cart application), 643–650
administrator, Shopping Cart application, 609
PHP database interfaces, 282
Warm Mail application (email client), 654
Web Services (Amazon), 813–814
internationalization (applications), 7
Internet Message Access Protocol (IMAP), 452, 651–652
Internet Protocol (IP), 414
Internet, secure transactions, 411–412
intl extension, 7
intval() function, 101
IP (Internet Protocol), 414
is_uploaded_file() function, 438
iteration. See loops
JavaScript
add_BM() function, 881
addBMResponse() function, 874
addNewBookmark() function, 873
libraries for Ajax applications, 884
JD (Julian Day) Count calendar, 480–481
join() function, 117
joins, 254–255
Cartesian product, 254
conditions, WHERE clause, 250
cross, 254
EXPLAIN statement, 301–302
inner, 254
left, 252–255
strings
implode() function, 117
join() function, 117
tables, 251–252
two-table, 250–251
types, MySQL, 254–255
JPEG (Joint Photographic Experts Group), 485, 778, 891
jpeg-6b, downloading, 484
Julian calendar, 480–481
keys
databases
creating, 215
foreign keys, 210
primary keys, 210
pairs, installing, 420–421
private keys, 420
public keys, 420–422
keywords
AUTO_INCREMENT, 231
DESC, 255
LIKE, 249
NOT NULL, 231
PRIMARY KEY, 231
REGEXP, 249
return, 154–155
UNSIGNED, 231
krsort() function, 93
ksort() function, 93
languages
constructs
array(), 82
die(), 526
exit, 526
DDL (Data Definition Languages), 244
DML (Data Manipulation Language), 244
late static bindings, 185–186
leaf nodes (Web forum tree structure), 743
left joins, 252–255
length of strings, testing, 120
letters, descenders, 497
libpdf_php file, copying, 899
libraries. See also functions, libraries
FreeType, downloading, 484
ImageMagick, 483
mysqli prepared statements, 280–281
PDFlib
PDF documents, 792–796
PECL (PHP Extension Class Library), 483
PHP, 891
database interfaces, 282
SOAP libraries (Amazon), 814
SOAP, 812
LIKE keyword, 249
LIMIT clause, SELECT statement, 258
links
Add to Cart, 817
Checkout, 818
Details, 817
Web forum tree structure, 742
lists
creating (online newsletters), 722–724
databases, 688
viewing (online newsletters), 708–716
literals, 27
special characters (regular expressions), 127
LOAD_DATA_INFILE statement, 311
load_list_info() function, 714
loading
arrays from files, 98–101
data from files, 311
extensions, 528
local variables, 151
stored procedures, 319
locking files, 78–79
logging in
log files, 357
MySQL, 221–222
online newsletters, 705–707
user authentication, 584–587
Warm Mail application (email client), 663–666
logging out
MySQL, 229
online newsletters, 721
user authentication, 587–588
Warm Mail application (email client), 666
logic, 546
errors, 558–559
separating from content, 546
logical operators, 38
login
anonymous login (FTP), 462
FTP servers, 463
implementing (online newsletters), 702
PHPBookmark application, 572–577
Shopping Cart application, 611
logout.php files
PHPBookmark application, 572
Shopping Cart application, 611
logout.php script (authentication), 523–524
long style form variable, 24–26
lookup functions
dns_get_mx(), 459
explode(), 459
networks, 455–459
gethostbyaddr(), 458
gethostbyname(), 456–458
getmxrr(), 456
parse_url(), 458
lookup.php file, 453
loops, 51–53
accessing numerically indexed arrays, 84
associative arrays, 85–87
break statement, 56
do..while loops, 55–56
for loops, 54–55
foreach loops, 54–55
iteration, 188–191
while loops, 53–54
lstat() function, 446
ltrim() function, 110
magic quotes, 115
magic_quotes_gpc directive, 417
magic_quotes_runtime directive, 417
Mail Exchange (MX) records, 459
mail() function, 109, 452, 595, 689
mail_fns.php files (Warm Mail application), 655
mail_fns.php function library, get_accounts() function, 668
mailbox (Warm Mail application), viewing contents of, 674–676
mailing list manager. See MLM
main page (Shopping Cart application), 615–620
maintainability of code, 538
breaking up, 541–542
code standards, 538
commenting, 540
directory structures, 542
function libraries, 542
indenting, 540–541
naming conventions, 538–540
make_button.php file, 492–493
malicious code injection, 365
many-to-many relationships (databases), 211
master servers, database replication, 306–307
matching
regular expressions, 123–124
* symbol, 126
+ symbol, 126
branching, 127
caret symbol (^), 126–127
character classes, 125
character sets, 124–125
curly braces ({}), 126
finding substrings, 129–130
literal special characters, 127
replacing substrings, 130
slash (), 127
special characters, 127–128
splitting strings, 130
string anchoring, 126–127
subexpressions, 126
Web references, 131
substrings, 120–121
find and replace, 122–123
numerical position, 121
regular expressions, 129–130
strchr() function, 121
stristr() function, 121
strpos() function, 121
strrchr() function, 121
strrpos() function, 122
strstr() function, 121
max() function, 155–156
MAX(column) function, 256
max_connections parameter, 273
MaxClients parameter (Apache), 273
md5(), PHP 5.3, functionality in, 7
medium style form variable, 24
member.php files (PHPBookmark application), 572
members_only.php script (authentication), 522–523
MEMORY tables, 312
MERGE tables, 312
messages. See also errors, messages
viewing, 680–681
methods. See also functions
ASINSearch(), 829
bind_param(), 281
_call(), 186–187
Exception class, 195
fetchRow(), 284
overloading, 186–187
parseXML(), 838
static, 184
microseconds, measuring, 480
Microsoft
IIS, configuring, 381
Web site, 773
Word, RTF, 774
microtime() function, 480
MIME mail package, installing, 905
MIN(column) function, 256
mirroring
FTP functions, 459–463
checking update times, 464–465
closing connections, 466
downloads, 465–466
logins, 463
remote connections, 463
RAID (Redundant Array of Inexpensive Disks), 358
mktime() function, 471–472
MLM (mailing list manager), 687
actions, 701
building, 687
files, 690
online newsletters, 687
account settings, 702–705, 719
administrative functions, 721
diagrams, 689–691
email attachments, 689
extensions, 740
file upload, 688–689
logging in, 705–707
logging out, 721
login, implementing, 702
passwords, 719–721
previewing, 732–733
requirements, 688
script architecture, 694, 700–701
sending messages, 733, 737–739
solution overview, 689–691
subscribing, 717–718
unsubscribing, 717–718
uploading, 724–731
mlm_fns.php files (MLM application), 691
mod_auth module (Apache Web server), 402
mod_auth_mysql module, 406–408
documentation Web sites, 408
installing, 406–407
testing, 407
mode variable, 824
modeling real-world objects (Web databases), 211–212
modes
autocommit, 314
file modes, 61–62
modification
anomalies, avoiding (Web databases), 213
dates (scripts), 529
modules
mod_auth (Apache Web server), 402
mod_auth_mysql, 406–408
installing, 406–407
testing, 407
operator, 33
PHP, running, 890
monitors
MySQL, 220–221
security, 363
moving files, 447
multidimensional arrays, 81–92
sorting, 93
reverse sorts, 95
user-defined sorts, 93–95
three-dimensional arrays, 90–92
two-dimensional arrays, 88–90
multiline comments, 21
multiple inheritance, 172–174
multiple programmers, 543
multiplication operator, 33
MX (Mail Exchange) records, 459
my_error_handler() function, 565
MyISAM table, 312
MySQL
access, 219–220
aggregate functions, 256
continuation symbol, 220
backing up, 358
connection verification, 293
creating, 222
db table, 290–291
host table, 291
request verification, 293
results.php script, 269
selecting, 229
tables, creating, 229–231
tables_priv table, 292
user table, 289
viewing, 233–234
Web database architecture, 268–271
date and time
converting between PHP and MySQL formats, 476–477
DATE_FORMAT() function, 476–477
MySQL Web site, 481
UNIX_TIMESTAMP() function, 476–477
GRANT command, 223–228
identifiers, 235–236
installation
binary installations, 890–893
source installations, 891
Windows, 900
Windows, setting PATH, 900–901
join types, 254–255
logging in, 221–222
logging out, 229
max_connections parameter, 273
mod_auth_mysql module, 406–408
documentation Web sites, 408
installing, 406–407
testing, 407
mysql command, 221
online manual, 241
passwords, 418
privileges, 223
global privileges, 224
GRANT command, 223–228
principle of least privilege, 223
REVOKE command, 227–228
types, 225–227
resources, 909
REVOKE command, 227–228
runtime errors, 555–557
semicolon (;), 220
statements, 221
syntax, 257
users
GRANT command, 224–228
REVOKE command, 227–228
Web site, 220
mysql command, 221
mysql_affected_rows() function, 280
mysql_dump command, 305
mysql_query() function, 274–275
mysql_select_db() function, 274
mysqladmin facility, 235
mysqlhotcopy script, 306
mysqli_connect() function, 274, 555
mysqli_errno() function, 556
mysqli_error() function, 556
mysqli_fetch_assoc() function, 275
mysqli_query() function, 556
namespaces, 158
PHP 5.3, 7
XML, 811
naming
conventions, 538–540
functions, 147–148
Natural Order String Comparison Web site, 119
navigating
within arrays, 102
files, 76–77
Netcraft, 382
Netscape Web site
cookie specification, 511
SSL 3.0 Specification, 427
Network News Transfer Protocol (NNTP), 452
networks
connecting, 557–558
lookup functions, 455–459
dns_get_mx(), 459
explode(), 459
gethostbyaddr(), 458
gethostbyname(), 456–458
getmxrr(), 456
parse_url(), 458
TCP/IP security, 343
new operator, 39
New York Times Web site, 392
new_post.php files, 763
Web forum application, 744
newbooks.txt file, 311
newline control sequence ( ), 68
newsletters, 687
accounts
configuring, 719
creating, 702–705
administrative functions, 721
databases
configuring, 692–694
lists/subscribers, 688
diagrams, 689–691
email attachments, 689
extensions, 740
file upload, 688–689
lists
archives, viewing, 716–717
creating, 722–724
viewing, 708–716
logging in, 705–707
logging out, 721
login, implementing, 702
passwords, 719–721
previewing, 732–733
requirements, 688
script architecture, 694, 700–701
sending messages, 733, 737–739
solution overview, 689–691
subscribing, 717–718
unsubscribing, 717–718
uploading, 724–731
next() function, 102
nl2br() function, 110–111
NNTP (Network News Transfer Protocol), 452
nodes
browse nodes (Amazon), 816
Web forum tree structure, 742
child nodes, 743
leaf nodes, 743
parent nodes, 743
root nodes, 743
non-identity operator, 87
NOT NULL keyword, 231
notify_password() function, 592–594
NULL data type (variables), 29
null values, avoiding (Web databases), 216
number_of_accounts() function, 671
numeric column types, 236–238
date and time, 238–239
floating point data types, 237–238
integral data types, 237
string, 239–241
numerical position of substrings, finding, 121
numerically indexed arrays
accessing with loops, 84
contents, accessing, 83–84
initializing, 82–83
Object data type (variables), 29
objects, 160–161
cloning, 186
real-world modeling (Web databases), 211–212
throwing, 196
ODBC (Open Database Connectivity) functions, 282
one-to-many relationships (databases), 211
one-to-one relationships (databases), 211, 216
online brochures (commercial Web sites), 328
common pitfalls, 330
limitations, 328
answering feedback, 329
lack of information, 328
poor presentation, 329
tracking success, 330–331
updated information, 329
online catalogs (Shopping Cart application), 608
online newsletters, 687
accounts
configuring, 719
creating, 702–705
administrative functions, 721
databases
configuring, 692–694
lists/subscribers, 688
diagrams, 689–691
email attachments, 689
extensions, 740
file upload, 688–689
lists
archives, viewing, 716–717
creating, 722–724
viewing, 708–716
logging out, 721
passwords, 719–721
previewing, 732–733
requirements, 688
script architecture, 694, 700–701
sending messages, 733, 737–739
solution overview, 689–691
subscribing, 717–718
unsubscribing, 717–718
OOP (object-oriented programming)
classes, 160–161
objects, 160–161
polymorphism, 161
Open Database Connectivity (ODBC) functions, 282
open_mailbox() function, 675
opendir() function, 440
opening files, 61
file modes, 61–62
fopen() function, 62–64
FTP (File Transfer Protocol), 64–65
HTTP (Hypertext Transfer Protocol), 64–65
potential problems, 65–66
tags (XML), 810
OpenSSL
configuring, 894
Web site, 891
operating systems
database security, 294
unnecessary applications, disabling, 388
updating, 387–388
operations
creating, 162–164
overriding, 173
operators, 32
arithmetic operators, 33–34
combination assignment operators, 35
decrement operators, 35–36
increment operators, 35–36
reference operator, 36
returning values, 34–35
associativity, 42–44
bitwise operators, 38
comma operator, 39
comparison operators, 36–37
equals operator, 37
WHERE clauses, 248–249
error suppression operator, 39
execution operator, 39–40
logical operators, 38
new operator, 39
precedence, 42–44
strings
concatenation operator, 26–27
operators, 34
subqueries, 259
ternary operator, 39
totaling forms, 41–42
type operator, 40
unary operators, 33
optimizing
code, 546–547
databases, 304–305
default values, 305
designs, 304
indexes, 305
permissions, 304
tables, 304
Zend Optimizer, 547
or operator, 38
ORDER BY clause, 255
order forms
creating, 14–16
processing, 16
order.fns.php files (Shopping Cart application), 612
ordered data, retrieving, 255–256
ordering strings
strcasecmp() function, 119
strcmp() function, 119
strnatcmp() function, 119
orders for goods or services (commercial Web sites), 331–332
compatibility, 334
trust, 333
unanswered questions, 332
user interfaces, 333–334
organizing code, 374
output_fns.php files
MLM application, 691
PHPBookmark application, 572
Shopping Cart application, 612
Warm Mail application, 655
Web forum application, 744
output_fns.php function library, 664
outputting images, 489–490
overloading
functions, 147
methods, 186–187
overriding, 170–173
owners (scripts), identifying, 529
-p switch (mysql command), 221
padding characters, 112
pages. SeeWeb pages
parameters, 22
$type, 829
Apache, MaxClients, 273
drawing functions, 488
extract() function, 105
function parameters, 148–150
calling functions, 143–144
pass by reference, 153–154
pass by value, 153–154
max_connections parameter, 273
startup, 900
parent nodes (Web forum tree structure), 743
parse_url() function, 458
parseXML() method, 838
parsing XML (Amazon), 814
pass by value (function parameters), 153–154
passing by reference, 104, 153–154
passthru() function, 448
databases
access, 383–384
security, 295
logging in to MySQL, 221–222
MySQL, 418
online newsletters, 719–721
user authentication, 588–595
PATH settings, MySQL installations, 900–901
absolute, 62
file, 442–443
relative, 62
payments
modules, 639–641
systems, 608–609
PCRE extension, 7
PDF (Portable Document Format), 771–775
generating certificates, 788–791
headers, 804
PDFlib, 792–804
personalized documents, 772
readers, 794–795
templates, creating, 776–777
Web site, 775
pdf.php files (certification application), 779
pdf_add_outline() function, 794
pdf_begin_page() function, 793
pdf_close() function, 796
pdf_fill() function, 804
pdf_rect() function, 802
pdf_replace() function, 789
pdf_set_info() function, 793
pdf_setlinewidth() function, 802
pdf_show() function, 795
pdf_show_xy() function, 803
pdf_stringwidth() function, 803
pdf_stroke() function, 802
PDFlib
PDF documents, 792–796
pdflib.php files, 796
certification application, 779
PEAR (PHP Extension and Application Repository)
Databases, 284–285
installing, 905–906
Web site, 907
PECL (PHP Extension Class Library), 483
Web site, 907
per-class constants, 184
Perl regular expressions, 123
permissions
database optimization, 304
write files, 418
personalization, 771
certification project, 779
files, 779
index.html file, 780–781
PDF, 788–791
PDF, PDFlib, 792–796
RTF, 784–787
score.php file, 782–784
creating, 771–772
extensions, 805
formats, 772
ASCII, 772
HTML, 773
paper, 772
PDF, 775
PostScript, 774–775
RTF, 774
word processors, 773
headers, 804
requirements
questions/answers, 776
software, 776–777
users
defined, 569
passwords, 570
recommendations, implementing, 602–603, 605
solutions, 570–572
system requirements, 570
usernames, 570
PGP (Pretty Good Privacy), 419
phar extension, 7
Philip and Alex’s Guide to Web Publishing Web site, 910
Phorum web forums project, 770
PHP
advanced OO features, 184–186, 191
Application Tools Web site, 909
Base Library Web site, 908
basic authentication (HTTP), 400–402
calling functions, 22
Center Web site, 908
Classes Repository Web site, 908
Club Web site, 908
command line, 531
configuring, 894
constants, 31
alternate syntax, 56
breaking out of, 56
conditionals, 46–51
declare, 57
loops, 51–56
database interfaces, 282
calendar functions, 480–481
checkdate() function, 474
converting between PHP and MySQL formats, 476–477
date calculations, 477–478
date() function, 469–472
floor() function, 478
getdate() function, 473
microseconds, 480
mktime() function, 471–472
PHP Web site, 481
date() function, 21–22
Developer Web site, 909
Developer’s Network Unified Forums Web site, 909
development environments, 544
embedding in HTML, 17–18
comments, 20–21
statements, 19–20
tags, 18–19
whitespace, 20
environment variable functions, 450
evaluating strings, 525–526
extensions directory, copying libpdf_files, 899
functions
eval() function, 525–526
get_current_user() function, 529
get_extension_funcs(), 528
get_loaded_extensions() function, 528
getlastmod() function, 529
highlight_file(), 530–531
ini_get() function, 529–530
ini_set() function, 529–530
my_error_handler() function, 565
mysql connect() function, 555
mysqli_errno() function, 556
mysqli_error() function, 556
mysqli_query() function, 556
names in code, 539
serialize() function, 526–527
set_error_handler() function, 565
show_source() functions, 530–531
unserialize() function, 527
variables, 44–46
gd documentation Web site, 508
highlighting syntax, 530–531
Homepage Web site, 908
images
canvas, creating, 487
creating, 486–499
formats, 484
generating automatically, 490–491
GIF (Graphics Interchange Format), 485
identifiers, destroying, 490
JPEG (Joint Photographic Experts Group), 485
outputting, 489–490
PNG (Portable Network Graphics), 485
supporting, 484
text, 487–499
WBMP (Wireless Bitmap), 485
binary installations, 890
source installations, 891, 893–896
Windows, 903–905
jpeg-6b, downloading, 484
Kitchen Web site, 909
language constructs
die(), 526
exit, 526
libraries, 891
Magazine Web site, 907
modular names in code, 539
network lookup functions, 455–459
dns_get_mx(), 459
explode(), 459