100% found this document useful (1 vote)
20 views

PHP For Teens 1st Edition Maneesh Sethi instant download

The document provides information about the book 'PHP For Teens' by Maneesh Sethi, including download links and related titles. It also contains acknowledgments, author information, and a detailed table of contents outlining the chapters and topics covered in the book. The book aims to teach PHP programming to teenagers through practical examples and projects.

Uploaded by

erizabuhayvc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
20 views

PHP For Teens 1st Edition Maneesh Sethi instant download

The document provides information about the book 'PHP For Teens' by Maneesh Sethi, including download links and related titles. It also contains acknowledgments, author information, and a detailed table of contents outlining the chapters and topics covered in the book. The book aims to teach PHP programming to teenagers through practical examples and projects.

Uploaded by

erizabuhayvc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

PHP For Teens 1st Edition Maneesh Sethi download

https://ebookname.com/product/php-for-teens-1st-edition-maneesh-
sethi/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Game Programming for Teens Second Edition Maneesh Sethi

https://ebookname.com/product/game-programming-for-teens-second-
edition-maneesh-sethi/

Torque for Teens 1st Edition Mike Duggan

https://ebookname.com/product/torque-for-teens-1st-edition-mike-
duggan/

RPG Maker for Teens 1st Edition Michael Duggan

https://ebookname.com/product/rpg-maker-for-teens-1st-edition-
michael-duggan/

Educating Pupils with Autistic Spectrum Disorders A


Practical Guide 1st Edition Dr Martin Hanbury

https://ebookname.com/product/educating-pupils-with-autistic-
spectrum-disorders-a-practical-guide-1st-edition-dr-martin-
hanbury/
Analysis of Panel Data 3rd Edition Cheng Hsiao

https://ebookname.com/product/analysis-of-panel-data-3rd-edition-
cheng-hsiao/

Cooking with Coconut Flour Bruce Fife

https://ebookname.com/product/cooking-with-coconut-flour-bruce-
fife/

IPv6 essentials 1st Edition Silvia Hagen

https://ebookname.com/product/ipv6-essentials-1st-edition-silvia-
hagen/

Decentring the Avant Garde 1st Edition Per Bäckström

https://ebookname.com/product/decentring-the-avant-garde-1st-
edition-per-backstrom/

Light Scattering by Particles in Water Theoretical and


Experimental Foundations 1st Edition Miroslaw Jonasz

https://ebookname.com/product/light-scattering-by-particles-in-
water-theoretical-and-experimental-foundations-1st-edition-
miroslaw-jonasz/
Drilling for Gold How Corporations Can Successfully
Market to Small Businesses 1st Edition John Warrillow

https://ebookname.com/product/drilling-for-gold-how-corporations-
can-successfully-market-to-small-businesses-1st-edition-john-
warrillow/
PHP for
Teens

Maneesh Sethi
ß 2006 Thomson Course Technology, a division of Thomson Learning Publisher and General Manager,
Inc. All rights reserved. No part of this book may be reproduced or Thomson Course Technology PTR:
transmitted in any form or by any means, electronic or mechanical, Stacy L. Hiquet
including photocopying, recording, or by any information storage or
retrieval system without written permission from Thomson Course Associate Director of Marketing:
Technology PTR, except for the inclusion of brief quotations in a Sarah O’Donnell
review.
Manager of Editorial Services:
The Thomson Course Technology PTR logo and related trade dress Heather Talbot
are trademarks of Thomson Course Technology, a division of
Thomson Learning Inc., and may not be used without written per- Marketing Manager:
mission. This product includes PHP software, freely available from Heather Hurley
http://www.php.net/software/.
Senior Acquisitions Editor:
All other trademarks are the property of their respective owners. Emi Smith

Important: Thomson Course Technology PTR cannot provide software Project Editor:
support. Please contact the appropriate software manufacturer’s Tonya Cupp
technical support line or Web site for assistance.
Technical Reviewers:
Thomson Course Technology PTR and the author have attempted Andy Harris, Christopher McCulloh
throughout this book to distinguish proprietary trademarks from
descriptive terms by following the capitalization style used by the Teen Reviewer:
manufacturer. Justin Windler
Information contained in this book has been obtained by Thomson
PTR Editorial Services Coordinator:
Course Technology PTR from sources believed to be reliable. However,
Elizabeth Furbish
because of the possibility of human or mechanical error by our sources,
Thomson Course Technology PTR, or others, the Publisher does not Interior Layout Tech:
guarantee the accuracy, adequacy, or completeness of any information Interactive Composition Corp.
and is not responsible for any errors or omissions or the results
obtained from use of such information. Readers should be particularly Cover Designer:
aware of the fact that the Internet is an ever-changing entity. Some facts Mike Tanamachi
may have changed since this book went to press.
CD-ROM Producer:
Educational facilities, companies, and organizations interested in Brandon Penticuff
multiple copies or licensing of this book should contact the Publisher
for quantity discount information. Training manuals, CD-ROMs, and Indexer:
portions of this book are also available individually or can be tailored Sharon Shock
for specific needs.
Proofreader:
ISBN-10: 1-59863-139-X
Megan Wade
ISBN-13: 978-1-59863-139-5
eISBN-10:1-59863-140-3
Library of Congress Catalog Card Number: 2006920364
Printed in the United States of America
06 07 08 09 10 PH 10 9 8 7 6 5 4 3 2

Thomson Course Technology PTR,


a division of Thomson Course Technology
25 Thomson Place
Boston, MA 02210
http://www.courseptr.com
To the Quad—Loro 107

Acknowledgments
There are a lot of people to thank for this work. Really, to everyone who played a
part during the writing of this book, thank you so much.
First of all, I want to thank my parents, Neelam and Prab Sethi. My brother was a
big help to me with surviving this year; thanks Ramit. My sisters Nagina and
Rachi are awesome, and I love you both so much.
Thanks to Emi Smith, my acquisitions editor, Tonya Cupp, my copy editor, and
Andy Harris and Christopher McCullough, my tech editors. Everyone else at
Course PTR—you guys are great.
Lastly, my friends: Thanks a lot, you guys. I want to give special thanks to my
college roommates during the writing of this book, Nate Foorman and Arthur
Kaneko (Theo Polan too, sort of). Also, many thanks to David Weekly for his
help programming and all sorts of computer stuff.
To everyone else, and Lauren Choi: Thanks so much for your help! Keep in
touch!

About the Author


Maneesh Sethi is a student at Stanford University in Palo Alto, California. As a
high-school student, he founded Standard Design, a website design company,
and Cold Vector Games, a game development team. Maneesh has authored the
international best-seller Game Programming for Teens and Web Design for Teens,
and his new book How to Succeed as a Lazy Student is in the works.
Additionally, Maneesh lectures on game programming and design at various
conferences around the country. You can learn more at www.maneeshsethi.com or
visit his blog at www.lazymotivation.com.

iii
Contents

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

Chapter 1 Welcome to PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


Installing PHP on Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Installing the Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Testing Apache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Installing PHP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Testing PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Installing PHP on Macs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Chapter 2 A Quick HTML Primer . . . . . . . . . . . . . . . . . . . . . . . . . . . 23


.htm or .html Extension. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
ASCII Format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Common Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
<html> Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
<head> Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Text-Formatting Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Miscellaneous Useful Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Chapter 3 Building Your First PHP Program: Setting Up the HTML. . 39


HTML Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
HTML Form. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

iv
Contents v

Form Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Submit Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Adding PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

Chapter 4 Writing the PHP in Your First Program . . . . . . . . . . . . . . 53


Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Inserting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Functions and Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Predefined Variables and Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . 70
GET Versus POST. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Predefined Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

Chapter 5 Constants, Expressions, and Operators . . . . . . . . . . . . . . 77


Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Unary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Binary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Ternary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Comparison Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Other Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

Chapter 6 The Style Factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95


Why Style? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
How to Style. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Capitalization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Underscores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

Chapter 7 Program Flow: Control Structures . . . . . . . . . . . . . . . . . . 103


Branching Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
if . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
else . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
elseif . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
vi Contents

Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
while . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
do . . . while . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
break and continue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

Chapter 8 Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121


Making Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Single-Quoted Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Double-Quoted Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
String Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

Chapter 9 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135


Designing Your Own Functions . . . ........ . . . . . . . . . . . . . . . 135
Dissecting a Function . . . . . . . . . . ........ . . . . . . . . . . . . . . . 138
Function Code . . . . . . . . . . . . . ........ . . . . . . . . . . . . . . . 138
Parameter List . . . . . . . . . . . . . ........ . . . . . . . . . . . . . . . 138
Return Value . . . . . . . . . . . . . . ........ . . . . . . . . . . . . . . . 139
Calling a Function Depending on a Condition . . . . . . . . . . . . . . . 146

Chapter 10 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151


Creating an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
array() Language Construct . . . . . . . . . . . . . . . . . . . . . . . . . 152
Reference Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Creating Array Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Defining Arrays with PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Skip the Array Key Definition . . . . . . . . . . . . . . . . . . . . . . . . . 154
Use a Loop. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Working with Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
unset() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
foreach Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

Chapter 11 Advanced Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167


Advanced Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Radio Buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Password Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Hidden Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Using PHP and Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Basic Email Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Contents vii

Chapter 12 Cookies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181


Creating Cookies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
$name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
$value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
$expire . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
$path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
$domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
$secure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Common Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Putting a Cookie in Your Site . . . . . . . . . . . . . . . . . . . . . . . . . . . 186

Chapter 13 Sessions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195


Using Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Starting a Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Desiging a Form Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Developing a Basic PHP Page . . . . . . . . . . . . . . . . . . . . . . . . . 198
PHP Functions for Session Data . . . . . . . . . . . . . . . . . . . . . . . . . . 202
The Errored Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
The Fix. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Creating a Web Page Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Developing a Log-In Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Cookie Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

Chapter 14 Working with Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223


Allowing File Uploads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
HTML Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
enctype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
PHP Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Loading Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Opening a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Closing a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Writing to Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Reading in Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
fread() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
file() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Renaming, Copying, and Deleting Files . . . . . . . . . . . . . . . . . . . . 241
copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
rename . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
unlink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
viii Contents

Appendix A Function List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243

Appendix B Online Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

Appendix C What’s on the CD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Introduction

If you are holding this in your hand, you probably have some knowledge about
the web—either that or someone asked you to buy this book for them. Whatever
the case, you have found a gold mine! From this book you learn the secrets to
dynamic web sites with PHP.
What is dynamic content? Making a site change based on given information
(hence the word dynamic). Perhaps you want to make a site where you can have
several members who all store their own favorite links. Well, with PHP, you can
make your site offer dynamically different links to each user, maybe based on
recommendations or previous links. PHP gives you total control.

Who This Book Is For


You probably know better than I do who this book is for, but let me tell you what
I think anyway: You are a beginning programmer, with little or no background in
PHP. You may or may not have HTML experience. You are willing to take the
time to learn PHP by following this book closely and trying to make programs of
your own.
Your experience obviously doesn’t have to fit this exactly for you to benefit
from this book. You may or may not be a teenager; many of my books’s readers
are over 50 or under 13. The main thing is that you have a willingness to
learn.

ix
x Introduction

What is the minimum knowledge you need to succeed here? You should be able
operate a computer well. If you can use your PC or Apple without any major
difficulties, you will probably do fine in this book. This book is paced for a
beginner, and topics work on a PC, Mac, or Linux computer. I have included
information on how to install the software for PCs and Macs, but you can find
Linux instructions on www.php.net.
If you ever have any problems with any of this, feel free to email me at
maneesh@maneeshsethi.com.

How This Book Is Organized


The first few chapters introduce design and give a brief overview of the PHP
language. You get a fast review of HTML and some PHP form design discussion.
You learn about variables, constants, expressions, and operators. Then I begin
talking about more-advanced PHP items. You learn about controlling program
flow through loops and control statements, organizing with functions, and
enhancing web scripts with strings and arrays. Starting with the chapter on
cookies, you get into some more-advanced topics. You are introduced to sessions
and file handling. Finally, you get to the appendices, which lists all the functions
throughout the book, as well as external resources and what is on the CD.
All the source in this book is available on the CD. You just need to install your
server (which I show you how to do in Chapter 1) before using any of it.
Additionally, some of the figures were taken using different themes on a web
browser. Don’t worry about the different themes—all of the source files should
work as shown.
chapter 1

Welcome to PHP

Hey, welcome to PHP For Teens. I’m really glad you picked up this book, and I
want to let you know that you are in for a great ride. PHP, while easy to learn, is
also an incredibly powerful and useful language, and this book will teach you
everything you need to know to make some seriously dynamic web sites.
So what does PHP actually mean? PHP itself stands for PHP: Hypertext
processor—seriously. Seems kind of crazy, because the name itself is part of the
acronym, like it keeps going on and on forever! PHP is also a current pro-
gramming language that is often used on modern web sites and development
applications. PHP is extendible, strong, and works with many external utilities.
PHP is also pretty simple to learn. It is called a high-level language, which means
that it is between human language (English) and machine code (0s and 1s).
Because of this, you can easily understand it and write it almost like normal
writing, but it is also strong enough to do some seriously complex things.
So what can you actually do with PHP? You can make the Internet an interactive
experience by creating forms that people can fill out and submit and then deal
with the data however you like. For example, a visitor can email comments to a
webmaster, or post comments on site, or join a forum. PHP really makes the
Internet more usable.
To use this book, you only need a rudimentary knowledge of how to design a
web site. You need no programming background, but if you have done any
programming before, you will understand the language much more quickly. In

1
2 Chapter 1 n Welcome to PHP

fact, even if you have never developed a web site of any kind before, you will pick
up everything you need to know as we go along.
In this chapter, we are going to go ahead and install PHP. Installing PHP takes
two steps. First, you need to install a web server and second, you need to install
PHP as a part of the web server. Fortunately, both of these parts are free and on
the CD included in the back of this book. The specific installation steps are
different depending on whether you are installing on a Mac or a PC. Because
most readers will be using a PC, I will explain in depth how to install it on
Windows machines. Then I’ll give a few hints on how to install it for Macs.

Installing PHP on Windows


Installing PHP by itself will allow you to execute PHP files. At this point you can
view them in a command-line prompt. This is rather annoying and ugly, so we
are going to take an extra step to install a web server, which lets us view PHP files
in a web browser. We need to install the web server first. Let’s go over that before
we work with PHP.
Installing the web server is a pretty easy process on Windows, because the web
server comes in one package and you just need to open and install the files. The
web server we are going to use is called Apache; it is free, common, and secure.

What’s a web server?


The web server is an important part of using PHP. A web server (also called an HTTP server) is a
process that runs on your computer and sends out web pages when a browser tries to access it.
Whenever you go to a web site (such as www.maneeshsethi.com), a web server is running on
the domain and it returns the actual page that your browser sees. In effect, you are turning your
machine into a web site by installing a web server.

Installing the Web Server


Follow these steps to install the web server:
1. Find the installation file.
The CD contains one of the files, but you can also go to www.apache.org to
find the most current version of the file. Figure 1.1 shows you what the site
looks like. As you can see, it’s a pretty big site. Apache does a lot of things for
the computer.
Installing PHP on Windows 3

Figure 1.1
The www.apache.org web site.

2. Click the HTTP server link at the top-left column.


The new page is shown in Figure 1.2. Here is the place you can download the
actual server. You want to look for the newest stable version. As of the time
of this writing, the newest version is 2.0.54.
3. Click the Download link.
The new page gives you several options for downloading Apache. They look
something like the following:
n UNIX Source: httpd-2.0.54.tar.gz [PGP] [MD5]

n UNIX Source: httpd-2.0.54.tar.bz2 [PGP] [MD5]

n Win32 Source: httpd-2.0.54-win32-src.zip [PGP] [MD5]

n Win32 Binary (MSI Installer): apache_2.0.54-win32-x86-no_ssl.msi

[PGP] [MD5]
n Other files
4 Chapter 1 n Welcome to PHP

Figure 1.2
The HTTP server web section.

4. Download Win32 Binary (MSI Installer).


The other options are used if you are not using a Windows computer. You can
also install the program from the CD, located in the Programs directory. This
will not be the most updated version. Also, you can download the program
from www.maneeshsethi.com; just look for the link to PHP For Teens.
Note
It’s important to note that if you upgrade to a new version of Apache, older modules (such as the
PHP module you install later) might not work. I recommend that you use the Apache install file
included on the CD with the book, because it is guaranteed to work.

5. Click the Binary option to bring up a download window.


6. Download the file and open it to bring up a window that looks like Figure 1.3.
7. Press Next until you get to the Server Information screen, which looks like
Figure 1.4.
Often this window will be completely filled in for you. If so, you can skip the
step. If not, go to Step 8.
Installing PHP on Windows 5

Figure 1.3
Installing the Apache server.

Figure 1.4
The Apache configuration window.
6 Chapter 1 n Welcome to PHP

8. Fill in some sample values (for example, somenet.com and www.somenet.com)


and enter an email address you like (doesn’t matter which one).
Note that you can’t create a domain just by typing it in. For the domain to
work, you must have it already registered and set up to point to your
computer.
9. Press Next and choose to run Apache as a service for all users or only for the
current user.
If you install it as a service, Apache will start as soon as the computer boots
up. You might get a warning about a firewall conflict with the web server if
you have a firewall set up. In this case, I recommend you only use your server
as localhost and firewall the server completely.
10. Choose Typical Installation, then install it to your computer.
11. Let it finish.
You have installed your web server! You will notice a new program running
in your system tray (the area next to your clock on the bottom-right corner
of your screen). It should look like a green arrow in a white circle with a
feather attached. Double-click it, and a window like Figure 1.5 will pop up.

Figure 1.5
The Apache services monitor.
Installing PHP on Windows 7

This is the window you use to restart your web server. You need to do this
when working with PHP.

Testing Apache
Let’s test Apache and see if it works:
1. Open up your web browser.
Most Windows computers will have Internet Explorer installed, but I
recommend you download Mozilla Firefox. You can get this browser from
the CD, from www.maneeshsethi.com or, for the most updated version,
www.mozilla.com. Firefox is more compatible with web sites than Internet
Explorer.
2. Type localhost into the address bar.
Note that I did not include any .com or .net extension. If your web browser
looks like Figure 1.6, congratulations! You successfully installed your web

Figure 1.6
The successful installation page.
8 Chapter 1 n Welcome to PHP

page. If not, enter 127.0.0.1 instead of localhost. If it still does not work, try
installing again.
If your screen does look like this, you are ready to move on to the next
step—installing PHP.

Installing PHP
Follow these steps to install PHP:
1. Download the newest version of PHP you can find.
Check the CD, which has PHP 5.0.4; www.maneeshsethi.com; or (even
better) www.php.net.
2. Click the Downloads section.
You see a page that looks like Figure 1.7. Make sure your version of PHP is at
least 5.1.1; older versions are a little more difficult to set up.
3. Choose the Windows PHP zip package to go to the download page.

Figure 1.7
The PHP download page.
Installing PHP on Windows 9

4. Click the link and download the file.


The file is zipped. If you have Windows XP, you can open this file by default.
If not, you may need to download WinZip.
5. Extract all the files to your computer.
For the rest of this chapter, I will assume that you extracted the files to
C:\php. Navigate to this directory after extraction, and it will look something
like the one in Figure 1.8. The next section is a little bit difficult, because you
need to edit some text files to make Apache (the web server) work nicely
with PHP.
6. Navigate to your Apache installation directory, open the /conf/ directory,
and find httpd.conf.
C:\Program Files\Apache Group\Apache2 is the default location. Go here and
open up the conf directory.

Figure 1.8
The C:\php directory.
10 Chapter 1 n Welcome to PHP

Figure 1.9
The httpd.conf file.

7. Open httpd.conf.
You need to add a few lines to the document. Figure 1.9 shows what the
document looks like.
Caution
Be careful! Two files in the conf directory are similar: httpd.conf and httpd.default.conf.
Make sure you pick httpd.conf.

8. Scroll to the bottom of the httpd.conf file and add these lines:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini


PHPIniDir "C:/php"

If you installed PHP to a different directory than C:\php, make sure you
substitute the name of the proper directory. All right! The installation
should be complete.
Installing PHP on Windows 11

Figure 1.10
A successful restart of Apache.

9. Right-click the Apache icon in the system tray and select Open Apache
Monitor; you should see the Apache services window.
10. Click the restart panel on the rightmost bar.
Hopefully, the web server restarts successfully. If it does not, go through the
previous steps, making sure that you did not make any errors. If the restart
was successful, your Apache services monitor should look like the one in
Figure 1.10.

Note that the window says The Apache2 service has restarted (meaning that
your httpd.conf file was properly formatted) and that the information bar at the
bottom of the monitor says PHP/5.0.4 (which may differ depending on your
version of PHP). If you don’t see this, try shutting down Apache and restarting
the service.

Testing PHP
We are going to see if PHP is actually fully working on your machine. Remember
when you typed in localhost and that web page came up? Well, that file was
located on your computer, in the Apache installation directory.
1. Go to the Apache directory, which is at C:\Program Files\Apache Group\
Apache2 by default.
12 Chapter 1 n Welcome to PHP

Figure 1.11
The Apache htdocs directory.

2. Open htdocs, whose contents should look a lot like Figure 1.11.
In this directory, you see a bunch of HTML files with different extensions.
Each of these files is identical to all the others, except they are translated
into different languages. Don’t worry about them though; you are creating
a new file.
3. Open your favorite text editor, such as Notepad or Wordpad—not
Microsoft Word.
4. Inside the file, type this:

<?php
phpinfo();
?>

Make sure you type it exactly correct, with the semicolon after the par-
enthesis. Using Notepad, the file should look like Figure 1.12.
Installing PHP on Windows 13

Figure 1.12
The phpinfo.php file.

5. Save the file to the C:\Program Files\Apache Group\Apache2\htdocs


directory with the filename phpinfo.php.
Make sure the extension is .php, not .txt.
6. Open up your web browser, choose File > Open, and find your PHP file in
the Apache directory.
This loads the PHP file directly. Depending on your browser, either the page
will be blank or the browser will ask you to download a file. Neither of these
is good, because you want the PHP code to actually affect the browser. This
is where using your web server comes in. Remember how you typed in
localhost to open up the default page? Well, this time you need to open up a
non-default page.
7. Go to your browser and type in localhost/phpinfo.php.
One of two pages will open: either one that looks like Figure 1.13 or one that
looks like Figure 1.14.
Does your web browser look like Figure 1.14? If it does, then congratulations:
You have successfully installed PHP. If not, go through this checklist and double-
check all your steps:
n Is the extension of the PHP file .php?
n Did you edit the httpd.conf file to add these lines?
14 Chapter 1 n Welcome to PHP

Figure 1.13
The incorrectly loaded phpinfo.php file.

LoadModule php5_module "c:/php/php5apache2.dll"


AddType application/x-httpd-php .php

# configure the path to php.ini


PHPIniDir "C:/php"

n Did you type localhost/phpinfo.php in your address bar?


n Does the file exist?
n Is the file in your htdocs directory?
n Did you install the Apache directory correctly?
n Does your Apache service monitor give a version of PHP in the status
window?
n Can you access non-PHP files through your web server?
Discovering Diverse Content Through
Random Scribd Documents
NUT BREAD
(New England)

Mix 3 cups of flour with 4 teaspoonsful of baking powder and 1


teaspoonful of salt.
In another bowl beat together ½ cup of sugar, 1 egg, 1 cup of milk,
and 1 cup of English walnuts broken in pieces. Add the dry ingredients
to this mixture and let rise 20 minutes, then bake in a loaf 30 to 40
minutes.

BRAN MUFFINS
(New England)

Mix 2 cups of bran, 1 cup of flour, 1 cup of milk, ½ cup molasses, 1


teaspoon of soda, and a pinch of salt.
Bake 20 minutes.
To this may be added some chopped nuts and raisins.

SCOTCH SCONES
Mix 3 teaspoons of baking powder with 3 cups of flour. Rub in 1
tablespoon of butter, add 1 cup of currants or raisins, 1 beaten
egg, and enough milk to make a paste to roll out. Cut into squares or
rounds and bake in a quick oven.

BLINNI
(Russian)

Mix together 2½ cups of tepid milk, 4 cups of flour with ½ a yeast


cake and put in a warm place to rise 6 or 8 hours. One hour
before cooking add 2 cups of warm milk and 1 tablespoon of salt. Fry
like ordinary pan cakes. Serve very hot one on top of the other, well
buttered.
Blinni are spread with soured cream, and smoked salmon or caviare
is usually served with them.

BAKED HOMINY
(New England)

A good way to prepare any cereal for children. Put a pint of milk with
2 teaspoons of sugar and one of salt in a saucepan on the fire—when
at the boiling point add 6 oz. of hominy; let it cook about ten minutes.
Remove the saucepan from the fire, add a tablespoonful of butter
and three eggs. Pour this into a baking pan and bake about 20
minutes.
Baked hominy may be served with meats or fish.

MARRONS GLACÉS
Put the chestnuts on the fire in cold water, boil 5 minutes, take them
out, and while hot strip them of their outer and inner skins. Put
them in a big saucepan containing a syrup of the proportion of ½ lb. of
sugar to 1 quart water and 1 teaspoonful of butter, when they come to
the boiling point remove to the back of the stove. Use a large quantity
of the syrup to the quantity of chestnuts. This syrup should diminish
very slowly. When it has become very thick take out the chestnuts and
drain them, add a little vanilla to the syrup. Now pour boiling water
over the chestnuts to remove the syrup which covers them. Dry them
well. Beat the thick syrup until it is opaque, then roll the dry chestnuts
in it; remove with a skimmer and let them dry on a sieve.
Prunes may be treated in the same way.

SMALL CUCUMBER PICKLES


Put 1 pint of salt on ½ of a bushel of small green cucumbers, cover
them with boiling water, and let them stand over night. Drain off
the water and put them on the stove, a gallon at a time, in cold
vinegar, to which add a lump of alum the size of a small hickory nut.
Let them come to a boil, then take out and place in a stone jar. Have
on the stove a gallon of the best cider vinegar, to which add about 2
lbs. of brown sugar, let come to a good boil. Take out the seeds of 4
red peppers and 2 green peppers, cut them in rings, cut in pieces 1
horse-radish root, pour boiling water over them, and let stand 15
minutes; drain off, add ½ cup of white mustard seed, a few whole
cloves, and some cinnamon sticks. Then put all of this mixture on the
pickles, cover them with boiling vinegar, and put away. Two or three
cloves of garlic put in the jar are an addition.

PRESERVED STRAWBERRIES
(French)

These berries will remain whole. Prepare a basin of lime water. When
the lime water is cool put in the strawberries and let them stand ¼
of an hour, then rinse them an instant in fresh water, drain them,
taking care not to bruise the fruit. Take an equal amount of sugar to
the amount of berries. To each pound of sugar, add 1 cup of water, boil
until a very thick syrup, then add the berries. Cook 5 minutes, pour
into sterilized jars and seal.

RHUBARB JELLY
(English)

Rhubarb, sugar, and 1 teaspoonful powdered alum.


Wash and cut the rhubarb in small pieces; wash again, and boil it
over a slow fire with a breakfastcupful of water till well cooked and all
the juice extracted; let it drip all night through a jelly bag; to each
good ½ pint of juice add 1 lb. of sugar, and add the alum to the whole;
stir till it comes to the boil, and let it boil for 10 minutes; pour into
pots.

TOMATO SOUP FOR CANNING


(New England)

Put in a preserving kettle ½ bushel of ripe tomatoes, 2 bunches of


celery (leaves and all), 30 sprays of parsley, 4 or 5 sweet green
peppers, 20 onions, 1 clove of garlic, 12 whole cloves, ½ stick of
cinnamon, 30 bay leaves, 1 teaspoonful of whole black pepper; boil
this 4 hours, strain through a sieve, and add 1½ cups of flour, one cup
of sugar, 1 lb. of butter, and 5 tablespoonsful of salt. Cook ½ hour
longer and seal in sterilized jars.
This is a good soup and will keep all winter.

BUDO CUP
To 1 pint bottle of dry ginger ale, add 1 pint bottle of grape juice, juice
of 1 orange, 1 lemon, 2 tablespoonsful of Jamaica rum, and 1 bottle
of effervescent water.

Transcriber's Note:
Varied hyphenation was retained.
This text uses the spelling of Curaçoa in place of the more usual
Curaçao.
Page 16, "excelent" changed to "excellent" (make an excellent)
Page 71, "Bechamel" changed to "Béchamel" (layer of Béchamel)
*** END OF THE PROJECT GUTENBERG EBOOK ALLIED COOKERY:
BRITISH, FRENCH, ITALIAN, BELGIAN, RUSSIAN ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for


the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like