Tous nos rayons

Déjà client ? Identifiez-vous

Mot de passe oublié ?

Nouveau client ?

CRÉER VOTRE COMPTE
Creating Dynamic Webpages Using PHP and MySQL
Ajouter à une liste

Librairie Eyrolles - Paris 5e
Indisponible

Creating Dynamic Webpages Using PHP and MySQL

Creating Dynamic Webpages Using PHP and MySQL

David Tansley

486 pages, parution le 15/11/2001

Résumé

The aim of this book is to get you up and running using PHP in a quick and easy manner. The full language of PHP is huge but we will not cover all the different tasks you can do with PHP, just the basics. We shall take it one step at a time, gradually building up to put you in a position to understand the concepts of the language and how it handles web processing. Along the way I will explain what we are doing using examples. Here is a list of some of the areas I will cover:
  • form processing
  • passing information between forms
  • file uploads to the web server
  • cookies
  • session management
  • mailing clients
  • database applications
  • web authentication

This book will not preach to you the complete language syntax theory, or the internals of the language. I will leave that for you to explore in other books. What this book will teach is how to use the language in simple terms to create really dynamic web pages. We will create simple web pages first and then gradually build up to using forms. We will then move on to how you can interact with databases, notably mySQL, the preferred database of Linux (that's my view only).

What You Need To Know

The book is aimed mostly at the Linux market, purely because this is where the bulk of the PHP base is. If you want to run PHP on Windows, you can, and the examples I use in this book are relevant to Windows and Linux users. To get the most out of this book you need to know:

  • absolutely nothing about PHP
  • absolutely nothing about the database server mySQL
  • maybe a touch of HTML
  • how to use a text editor like vi or vim

Why make the above statement? Well, I will teach you all you need to know as we go along with examples, example and more examples. In fact this book contains mainly working examples with no long boring paragraphs -- after all, you wanted to buy a book tha/ teaches you PHP in a practical and easy way.

When creating scripts in PHP, you will benefit from a little knowledge of HTML, but I will explain the HTML tags as we go along. This book is intended for the absolute beginner who wants to write PHP scripts, but others who have used PHP in a casual manner will also find this book helpful.

For PHP to work you will require a web server to enable PHP to run as a web server side script, a database to store your information, and, of course, a browser to view your executed PHP scripts. All the above are supplied on the CD accompanying this book. They are:

  • PHP
  • Apache web server
  • mySQL database server
  • Netscape browser

The book covers PHP Version 4.

The Structure of the Book

In Part 1 we will go through what I consider to be the basics of PHP. This includes the following, amongst others:

  • variables
  • flow control
  • loops
  • arrays
  • functions and include files

In Part 2 we will start dealing with forms, this is what dynamic web pages are all about. Topics covered are:

  • creating forms
  • general form processing
  • validating user input
  • feedback forms
  • sending mail
  • uploading files
  • web environment variables
  • cookies
  • session management

In Part 3 I introduce you to mySQL, the database server. After some examples of how to insert and get information out of the server, we turn to PHP to see how we can connect to mySQL and produce some really dynamic pages with a database as the back-end. The topics covered are:

  • inserting and presenting data
  • mini-database application
  • guest book application
  • mini-shop cart application

In Part 4 we look at how you secure Apache using authentication, and at securing individual files as well as directories. We also look at how to integrate PHP with Apache authentication, making your authentication process seamless. The topics covered are:

  • web authentication
  • using htaccess files
  • using PHP to control access
  • using a database to store users and passwords
Contents

Introduction
About This Book.
What You Need to Know.
The Structure of the Book.
Conventions Used.

1. Getting Started.
Nuts and Bolts of the World Wide Web.
PHP, the Web Programming Language.
What are Forms?
Installation.
Installing Netscape Navigator.
Installing mySQL.
Installing Apache.
Installing PHP.
PHP's Configuration File php.ini.
Testing the Configuration.
2. Just the Basics Please.
First Script.
Assigning Information.
Different Data Types.
Joining Information Together.
Information That doesn't Change.
Now That's an Operator I Like.
Incrementing and Decrementing Operators.
Comparison Operators.
Looks Logical to Me.
Operator Precedence.
3. Taking a Statement of Condition.
Flow Control with a Simple if.
Flow Control with an if then else.
Using Flow Control to Validate Users' Input.
Else if.
Multiple Tests with Switch.
4. Loops and Arrays.
The while Loop.
Incrementing a Value inside a Loop.
Breaking out of a Loop.
While do.
The for Loop.
Arrays and all That.
Creating and Adding to an Array.
Counting and Looping through the Elements in an Array.
New Types of Loop to Traverse an Array Easily.
Making Sure a Certain Array Element Exists.
Creating a Key Value Pair Array.
Merging Two Arrays into One.
Checking if the Array is Present.
Creating Tables with a Loop.
5. Functions and Include Files.
How a Function is Defined.
Creating a Function.
Functions with No Calling Parameters.
Doing Calculations inside Functions.
Using Functions for Validation Issues.
Learning How to Return a Value from a Function.
Using True and False Values from Functions.
Using include Files to Store Your Functions and Constants.
6. Strings and Pattern Matching.
Just Getting a Piece of a String.
Getting the Length of a String.
Stripping out White Spaces.
Translating the First Character of a String into Upper Case.
Finding out if an Exact Pattern Exists Inside another String.
Search and Replace on a String.
Getting an ASCII Character from an Integer.
Comparing Two Strings.
Splitting a String into a Array.
Converting New Lines to HTML Tags.
Encoding a URL String.
Decoding a URL Query String.
Handling Quotes.
Handling Characters Special to HTML.
General Pattern Matching.
Pattern Matching at the Beginning of a String.
Pattern Matching at the End of a String.
Insertions Using ereg_replace.
Using Split.
7. File and System Operations.
Now let's be Relative about This.
Opening a File.
Making Sure a File is Open.
Disabling PHP Error Messages.
Closing a File.
Writing to a File.
Reading from a File.
Appending to a File.
Locking Files.
Creating a Web Page Counter.
Using Loops to Read and Display the Contents of a File.
Reading a File for a Pattern Match.
Checking if a File Exists.
Copying a File.
Deleting a File.
Getting the File Type.
Getting the Size of a File.
Checking if a File is a Directory.
Checking if a File is a Regular File.
Checking if a File is Executable.
Checking if a File is Readable.
Checking if a File can be Written to.
Directory Functions.
8. HTML Forms Introduced.
Forms Overview.
The Basic Form Construction Tag.
Was That a GET or a PUT?
Text Input.
Textarea.
Creating a Basic Form.
Checkboxes.
Radio Buttons.
Selection Boxes.
Our First Form Processing.
How a Form Query String gets Encoded.
9. General Form Processing.
Handling Multiple Selections from a Select Box.
Validating a Form.
Other Validation Issues.
Testing for Field Length.
Testing for Numbers.
Handling Integers from a Form.
What are HTTP Headers?
Writing Information from a Form to a File.
Populating Menus from a Text File.
Page Redirection.
Creating Navigational Menu Buttons.
Creating more Than One Form in a Document.
Date Formats.
10. Sending Information by Mail and File Uploads/Downloads.
Using Mail.
Creating a Feedback Form.
Uploading Files.
Log those Uploads with syslog.
Downloading Files.
11. Web Server Variables.
Web Server Environment Variables.
PHP Predefined Variables.
Was That a GET or a PUT Sir?.
Getting Information About the Calling Browser.
Calling Yourself.
Keeping Form Key Value Pairs Intact on a Page That Calls Itself.
12 Saving State.
What Saving State is all About.
Passing Query Strings.
Hidden Fields.
Cookies.
Expiration.
Setting a Cookie.
Deleting a Cookie.
More Cookies Please.
Using Cookies to Limit Access to Pages.
Session Handling.
Destroying a Session.
Destroying a Variable from a Session.
Carrying Values through Forms Using a Session.
Those Headers have Already Gone.
No Cookies Enabled.
13. Introducing mySQL.
What Is a Database and Why Use One?.
What Is an RBDMS?.
Database Design: Things to Think about.
Communicating with mySQL.
Creating Tables.
Putting Information into a Table.
Using NULLS.
Where am I?
Looking at Your Data.
Amending and Deleting Data from a Table.
Order, Order.
Pattern Matching.
Limiting Records Returned.
Returning Non-duplicates.
Counting Records Returned.
Working with More Than One Table.
Amending a Table Structure.
Deleting Tables and Databases.
Working with Numbers.
The SUM Function.
Backing-up and Restoring Your Data.
14 Connecting to mySQL with PHP.
mySQL Connections.
Making that First Connection.
Putting the Returned Records into a Table.
Populating Menus.
Protecting Your Data inside mySQL.
Inserting a Record.
Updating a Record.
Deleting a Record.
Checking for a Duplicate Entry.
Getting the Last Insert ID.
Working with more Than one Table.
Creating and Deleting a Database.
Listing all Records from a Table.
Handling Multiple Queries Sent from a Form.
15. Guest Book Application.
Application Design Considerations.
The Scripts.
Message Board at Work.
The Scripts in Detail.
16 Gotcha Application.
Application Design Considerations.
Gotcha at Work.
The Scripts in Detail.
Internal Shopping Cart Application.
Application Design Considerations.
Shopping Cart at Work.
The Scripts in Detail. @CHAPTER 18. Apache Authentication using htaccess.
Creating User Authentication with Passwords.
Creating Group Authentication with Passwords.
Using Authentication by IP or Domain.
But I'm Paranoid about All My .htaccess Files.
19 Authentication and PHP.
Testing for Entered Usernames and Passwords.
Testing for Authentication in Your Scripts.
Using mySQL to Authenticate Users.
Index.

L'auteur - David Tansley

David Tansley is a Senior Systems Administrator at Ace Global Markets, a Lloyd's of London Underwriting agency. Among his many duties are looking after Sybase servers and multiple Linux and UNIX boxes and all their applications. He baby-sits firewalls. He is also very keen on web enabling front ends, using PHP, of course. He has had numerous articles published on the web and in magazines notably in Enterprise Linux. David firmly believes in the use of Linux in solving todays business needs, he tries to convert anybody he has a technical conversation with. He is also the author of LINUX and UNIX Shell Programming. David enjoys Competition Karate, F1 racing and air displays.

Caractéristiques techniques

  PAPIER
Éditeur(s) Addison Wesley
Auteur(s) David Tansley
Parution 15/11/2001
Nb. de pages 486
Format 18,6 x 23,4
Couverture Broché
Poids 900g
Intérieur Noir et Blanc
EAN13 9780201734027

Avantages Eyrolles.com

Livraison à partir de 0,01 en France métropolitaine
Paiement en ligne SÉCURISÉ
Livraison dans le monde
Retour sous 15 jours
+ d'un million et demi de livres disponibles
satisfait ou remboursé
Satisfait ou remboursé
Paiement sécurisé
modes de paiement
Paiement à l'expédition
partout dans le monde
Livraison partout dans le monde
Service clients sav@commande.eyrolles.com
librairie française
Librairie française depuis 1925
Recevez nos newsletters
Vous serez régulièrement informé(e) de toutes nos actualités.
Inscription