1. Trang chủ
  2. » Công Nghệ Thông Tin

Sams teach yourself PHP MySQL and apache in 24 hours dec 2002 ISBN 067232489x

763 88 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 763
Dung lượng 7,33 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

public key cryptography rtrim function 2nd 3rd RTRIM function 2nd 3rd 4th [ Team LiB ]... store items field, storefront database table example 2nd 3rd 4th 5th 6th storefront database t

Trang 1

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [P] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 2

diplaying in topics 2nd 3rd 4th 5th 6th 7th 8th 9th pound sign (#)

Trang 3

authentication 2nd 3rd 4th

confidentiality 2nd 3rd

confidentiality (public key cryptography) confidentiality (symmetric cryptography) 2nd encryption

SSL (secure servers 2nd 3rd 4th 5th 6th 7th

ps command

public key cryptography

confidentiality

Trang 4

SSL protocols

[ Team LiB ]

Trang 5

Brought to You by

Trang 6

[SYMBOL] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 8

(period)

.htaccess

per-directory configuration files .html extension

/tmp directory

/usr/local/apache2 directory

/usr/local/php/lib directory

/usr/local/src/ directory

Trang 10

[ SYMBOL ] [A] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 11

records, deleting 2nd 3rd 4th 5th

records, selecting and viewing 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th

Trang 14

mod auth dbm module 2nd 3rd digest 2nd

file-based

mod auth module 2nd 3rd

modules

access (restricting) 2nd 3rd 4th 5th directives

Trang 15

[ SYMBOL ] [ A ] [B] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 17

[ SYMBOL ] [ A ] [ B ] [C] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 18

WHERE 2nd 3rd 4th 5th 6th 7th 8th where

Trang 21

compress utility

compression

reduced transmitted data (performance) uncompressing

source code (Apache installations)

CONCAT WS() function 2nd

CONCAT() function 2nd

concatenation function 2nd 3rd 4th 5th concatenation operator (.) 2nd 3rd

Trang 25

[ SYMBOL ] [ A ] [ B ] [ C ] [D] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 26

database file-based access control authentication debug

Trang 28

database file-based access control authentication authentication modules

Trang 31

dynamic function calls 2nd 3rd

[ Team LiB ]

Trang 32

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [E] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 33

breaking strings into arrays 2nd expressions

Trang 34

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [F] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 38

breaking strings into arrays 2nd fclose()

Trang 39

getdate() 2nd 3rd 4th 5th 6th 7th gettype() 2nd

include()

example listing 2nd

executing PHP in another file

executing PHP/assign return values files

Trang 41

substrings, replacing 2nd 3rd string modification 2nd 3rd

WEEKDAY() 2nd 3rd 4th

with arguments, declaring 2nd wordwrap() 2nd

year select() 2nd

YEAR()

Trang 42

functions [See also method]

functios

create function() 2nd 3rd 4th 5th fwrite() function

[ Team LiB ]

Trang 43

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [G] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 44

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [H] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 46

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [I] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 48

is_executable() function is_file() function 2nd

Trang 49

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [J] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 50

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [K] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 51

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [L] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 53

inserting 2nd 3rd 4th

selecting and viewing 2nd 3rd 4th 5th 6th 7th 8th

Trang 57

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [M] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 58

file-based authentication 2nd 3rd

sample configuration

mod bwshare module

preventing abuse (performance)

Trang 60

inserting with PHP 2nd 3rd 4th 5th 6th 7th retrieving with PHP 2nd 3rd 4th 5th

Trang 61

SHOW VARIABLES command 2nd

tips for 2nd

privilege systems

authentication process 2nd 3rd 4th 5th columns priv table

db table

func table

granting 2nd 3rd 4th 5th 6th 7th 8th 9th host table

Trang 62

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [N] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 63

[ Team LiB ]

Trang 64

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [O] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 66

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [Q] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 67

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [R] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

records, deleting 2nd 3rd 4th 5th

records, selecting and viewing 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th

Trang 69

public key cryptography

rtrim() function 2nd 3rd

RTRIM() function 2nd 3rd 4th

[ Team LiB ]

Trang 70

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [S] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 75

example

if, compared

UPDATE

Trang 76

store items field, storefront database table example 2nd 3rd 4th 5th 6th storefront database table example

Trang 78

file system access (scalability) symlink (system links)

file system access (scalability) SymLinksIfOwnerMatch parameter Options directive

symmetric cryptography

confidentiality (SSL protocols) 2nd limitations

syntax

<IfDefine> conditional container <IfModule> conditional container container directives 2nd

error log

per-directory configuration files disabling

request headers

name-based virtual hosting 2nd schemas

Trang 79

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [T] [ U ] [ V ] [ W ] [ X ] [ Y ] [ Z ]

records, deleting 2nd 3rd 4th 5th

records, selecting and viewing 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th

Trang 82

topic list, displaying 2nd 3rd 4th 5th 6th 7th 8th 9th topics

displaying posts in 2nd 3rd 4th 5th 6th 7th 8th 9th touch() function

Trang 83

[ Team LiB ]

Trang 84

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [U] [ V ] [ W ] [ X ] [ Y ] [ Z ]

Trang 85

calendar example 2nd 3rd 4th 5th

HTML forms

accessing from multiple SELECT elements 2nd 3rd 4th 5th receiving 2nd 3rd 4th

Trang 86

logging program

tail command-line

error logs;monitoring (Unix)

[ Team LiB ]

Trang 87

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [V] [ W ] [ X ] [ Y ] [ Z ]

Trang 89

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [W] [ X ] [ Y ] [ Z ]

Trang 90

installing PHP on 2nd 3rd

integrating PHP with Apache on 2nd 3rd logresolve.exe utility

Trang 91

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [X] [ Y ] [ Z ]

Trang 92

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [Y] [ Z ]

Trang 93

[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Y ] [Z]

z format code (date() function)

Z format code (date() function)

zip file

[ Team LiB ]

Trang 94

MySQL's built-in string-related functions can be used severalways You can use functions in SELECT statements without

specifying a table to retrieve a result of the function Or you canuse functions to enhance your SELECT results by concatenatingtwo fields to form a new string

Even if you never use these functions in your applications, it'sgood to know they exist, and, if nothing else, you'll get somegood practice in this hour using the MySQL monitor's command-line interface

Length and Concatenation Functions

The group of length and concatenation functions focuses on thelength of strings and concatenating strings together Length-related functions include LENGTH(), OCTET_LENGTH(),

CHAR_LENGTH(), and CHARACTER_LENGTH(), which do

Trang 95

strings, use two field names to concatenate the firstname and

the lastname fields By concatenating the fields, you reduce

the lines of code necessary to achieve the same result in your

application:

mysql> select concat(firstname, lastname) from table_name; + -+

Trang 99

mysql> select trim(trailing 'X' from 'XXXneedleXXX'); + -+

Just like RTRIM() and LTRIM() remove padding characters,

RPAD() and LPAD() add characters to a string For example,

Trang 101

and length, you can use the SUBSTRING() function This

example gets three characters from the string MySQL, starting

at position 2:

mysql> select substring("MySQL", 2, 3);

+ -+

Trang 102

XXXX-YYYYY-ZZ, you can use substring functions to extract the

individual parts of the whole For example, if ZZ always

represents the state to which the order was shipped, you can

Trang 103

| mysql | + -+

1 row in set (0.00 sec)

mysql> select ucase('mysql');

+ -+

| UCASE(' mysql') | + -+

| MYSQL | + -+

Trang 104

+ -+

| bowWOWbowWOWbowWOWbowWOW |

Trang 106

BIN(), OCT(), and HEX() functions do not require a table

selection but return values without a specified table

The following example gets a string representation of the binaryvalue of the integer 56895:

Trang 107

1 row in set (0.00 sec)

You can also use the CONV() function to convert numbers

between bases This function has three parts: the number, thebase you're converting from, and the base you're converting to

Trang 109

Until now, we have simply printed any strings that we want todisplay directly to the browser PHP provides two functions thatallow you first to apply formatting, whether to round doubles to

a given number of decimal places, define alignment within afield, or display data according to different number systems Inthis section, you will look at a few of the formatting optionsprovided by printf() and sprintf()

snippet, for example, uses printf() to output an integer as adecimal:

printf() You can include as many conversion specifications

Trang 110

send an equivalent number of arguments to printf()

The following snippet outputs two numbers using printf():

printf("First number: %d<br>\nSecond number: %d<br>\n", 55, 66); // Output:

Trang 113

be padded to two characters, which would become a problem if

we changed our $red, $green, and $blue variables in thepreceding snippet to contain 1, for example We would end upwith the output "#111" You can force the output of leadingzeros by using a padding specifier

Padding Output with the Padding Specifier

You can require that output be padded by leading characters.The padding specifier should directly follow the percent signthat begins a conversion specification To pad output with

leading zeros, the padding specifier should consist of a zerofollowed by the number of characters you want the output totake up If the output occupies fewer characters than this total,the difference will be filled with zeros:

printf( "%04d", 36 );

// prints "0036"

To pad output with leading spaces, the padding specifier shouldconsist of a space character followed by the number of

Trang 114

// prints "xx36"

We now have the tools we need to complete our HTML codeexample Until now, we could convert three numbers, but wecould not pad them with leading zeros:

$red = 1;

$green = 1;

$blue = 1;

printf( "#%02X%02X%02X", $red, $green, $blue ); // prints "#010101"

Each variable is output as a hexadecimal number If the outputoccupies fewer than two spaces, leading zeros will be added

Specifying a Field Width

You can specify the number of spaces within which your outputshould sit The field width specifier is an integer that should beplaced after the percent sign that begins a conversion

Trang 115

printf("%-20s\n", "Left aligned");

Note that alignment applies to the decimal portion of any

Trang 116

Specifying Precision

If you want to output data in floating-point format, you can

specify the precision to which you want to round your data Thiscapability is particularly useful when you are dealing with

currency The precision identifier should be placed directly

before the type specifier It consists of a dot (.) followed by thenumber of decimal places to which you want to round This

it is difficult to use both a padding specifier and a field widthspecifier You should choose to use one or the other, but notboth

Trang 117

6: <body>

7: <?php

8: $products = array("Green armchair"=>222.4, 9: "Candlestick"=>"4",

10: "Coffee table"=>80.6

11: );

12: print "<pre>";

13: printf("%-20s%23s\n", "Name", "Price");

Trang 118

15: foreach ($products as $key=>$val) {

16: printf( "%-20s%20.2f\n", $key, $val ); 17: }

printf() call on line 13 defines the following format controlstring:

"%-20s%23s\n"

The first conversion specification ("%-20s") uses a field widthspecifier of 20 characters, with the output left-justified We use

function call on line 14 draws a line of -string

The final printf() call on line 16 is part of a foreach

statement that loops through our product array We use twoconversion specifications The first ("%-20s") prints the

product name as a string left-justified within a 20-characterfield The second conversion specification ("%20.2f") uses afield width specifier to ensure that output will be right-alignedwithin a 20-character field, and a precision specifier to ensurethat the double we output is rounded to two decimal places

Ngày đăng: 26/03/2019, 16:29