Вы находитесь на странице: 1из 786

Head First & MySQL

Lynn Beighley
ichael

Morrison

Q'REILLY
Beijing Cambridge ln Sebastopo/ Taipei Tokyo

MySQL

JI
.

, u
u:(;(; KHU(a fP
u MySQt., n:?(;u

u rr nu.uU
un(;u

u cep(;erHO(O nrpuo(;u
, (; ~o npoucxouum
. (;, (;( u

2010

...

004.45
32.973.26-018.2
35

35

MySQL
.]. - . : , 2010.
).

/ , ; [.
- 800 . : . - (

ISBN 978-5-699-44494-6
, ,
?

MySQL.

,
. ,

, (
).

MySQL:

, ,

, .
004.45
32.973.26-018.2

JWh'{&:t'.~~<<!.-"-

cpp~.z:~(<tI(<<.. ""

~ .

'.

. ~"'-,,"mI~~~ "

,
, ,

OOD .;80 .

158 978-5-699-44494-6

Authorized RussiBn trBn51ation of Head Fir5t & MySQL ISBN 9780596006303 @ 2008,
Lynn Beighley, MichBel Morrison. Thi5 tran5'ation 15 pubIi5hed and so'd m;i 01
O'Rei y Med.a, './ tbe Wl1 013// rights fo pubfish and 5" the .
@ " , 2010
ate Il, . 000 . .., 201

Oreu ()

25

1
2
3
4
5
6
7

37
95
139
195
259

71/2

8
9
10
11
12
1
11
III

: 'I.I. ', 'I.I.

: MySQL

:
-: ncu nu

: ', ''
, : npu

331
381

? nep1lluupl -nuo

453
463
537
597
641
693
749
767
785

:
:

: ... !
: -
( ):

, :

Oretle (nogpos)
.n"ll
occnaer YSQI...

-! , ,
. : ,

, ,
. ,

MySQL?

KOro ?

, cero, ?
,
,

, ,

Read ( )

ro

26
26
27
27
29
30
31
32
34
35

Ag'oXlfU,'t1uG ~u,lf ~ ~a\U.u, 1h.a1h,u,lf c1h,falfu,~bl


_1I8

aren -~ L.

CSS. , ,

, . ,
, .

-.
, . ,
,

HTML,

HTML
6->

ra
yrc L
L-
L-

-

-
-

HTML

-
-

$ _POST - ,
$_POST

...
,




38
39
40
41
42
44
46
47
48
52
54
55
58
60
61
62
67
69
70
80
82
83
84
85
86
89
90

nu

8,lfGlf,G tr&JtlL
corllacyeTc eJAY 60

, ,

en .
-, .

. ,
, . ,

MySQL

. - ,
, .

- . ...

96

97
98

100
103
106
109
110

112

MySQL -

MySQL
MySQL
INSERT
SELECT,
SQL

113

'

114
116
121
122
123
127
132
134

sqli_connectO

INSERT
MySQL
mysqli_closeO
$_ POST
.~ ero


&.. Lil"uii I"Momaem x0I"0uJo,

),1

ma !1m UIll

MHOfO

3fmI" .. nuce. 1)' l"um

m K"'f'euHa. m"""l"~l"m
m &.

iI,l,

Qnu

co~aJfu,e u, rl110J\Jflfu, 8rl 8rllflfblX


6 ".

cerAo yr .
, .
, .

, , ,

. 3? ! ,
.
- MySQL- .
~

MySQL'c~pBepoM

MySQL

USE
DESCRIBE

addemail.php

(sendemail.php)
-
mysqlUetch_arrayO

while
while
... !

DELETE
WHERE

no~ ..... ~-6~ 8'f'OPO


6ec:nJJ11 l Oc&JI~ Onblto '!tI JOUIIl

150
153
155
156
159
161
162
169
170
171
172
175
176
181
182
183

184

185
190
191

MakeMeElvis.com - -
MySQL
:)6w..:n~.

140
141
142
145
146
147
148
149

Dsnu

rt~f' , 11r~'th,,t~,t 11r,J\~tlf14.


be6-nIIJ

.
.

- , , ,
. , , ,

, .
' ,
,

SQL.

196
199
200

201

...

~EL.vj$.C()toI

=--=::,:':.~::...

=-.5:,
:~~~.,
("""'"""-9

if

if


. .
-

AND OR

L-

,
action
:

_._---

foeach

202
203
204
207
208
215
219
229
230
231
235
236
238
242
244
246
251
252

~~Lvj$.C:O

::::=II=:'~IWY8"""'"
..IiIIIfa ......, ........
---~
O ,.~1 1.
l'
.c ~ .......... 1
..
.) QD . . . . ".

!~)

"111"'-

frl~ grllflf" coXfrllftlflfbJMu, ~ rli1,J\

KorAa 6 ... "

xane ... . ,
, ,

? ,

JPEG , ,
, , ,

? .
, , .
, ,

, -,
.

267

268

272
274
275
280

284

290

require_ ~~
,

HTML CSS

~ ~
~~

291
292
294
297
298
303
304
308

311
312
314
316
319


LIMI

320


GS

GET, POST

10

260
261
262

~\'u,'t11,~ ~~\{LCgO lIru,i\o~clfl4.ff

"i, .. ...
n,.. CII60CR
: r par
. , , . , ,

, ,
, . ,

, . ,
-, ,
-. , ,
! ,
, ,

,
, .
,

C'IPIIWe . ~iroi)(
' - : .--~peiN.IUVII ~ ..r88ptWC:~.

~~-~~~.~.~.~.~~.~~:
-..... :..,.,. 2008-OS-OJ ZO:~6;4S 38740

Y.uun,

--.. ~
-. ~

2OOW5-01 20:16:0'1. 28270 .Y~


:IO-OS-Ol 26:.)8:23 243260 ~

... ~
~........,..

1003-05-01 20;37:40 186'110


2OO8-Os..o1 20:37;2' 127650

---

--

. ~
~

- -
':

-
-
.
~.

11:

.

SQL- ALTER


?


. .
SQL-.
. SQL-.

INSERT

332
333
335
336
338
340
341
342
350
354
355
356
357
358
363
366
367
369
370
371
372

( )

373

d OCTo~epHOCT

375

377

11

CO~~lfu,c '\1rlf~u,u,r~~lflfg ~-'\1ru,~lf14fI

....

nOMHlIl'e?

-.

,
.

,
. ,
, . -

. ,
( ,

My5QL?), -

-, .
[,

, ,

~ ~

SHAO



, ,

~,
"nt:; '

Ib'8ll"J'8+ :

11:

'" . u..:

11.,,,




...

... !

12

382
383
384
385
387
389
390
391
391
394
397
401
406
410
411
412
415
416
418
421
425
426
427
428
429
434
440
442
443
445

j'C'th,fr1Jfertu,e 8tJ\u,f~r1.rtL4JI ~ogrl

7t1 2
/

ecr nOll8 .. r 6cna

- cre ,
. - ,

.
:
, ,

, ,
,
.

. ,

- , ,
, .
.~

457

06 ~

458

460

~ ...
.

462

.'---- 3d~()I( 11011\9..


""
..ct nm,u. Kq;JV':90U
11\'.u.v,bt I1u..IJ.9..

~:~~~~~~~

'!\11\11\ ",
J,11\ <\3(S'du
I1u.il, .90I"\.

J l(ofU(pe11\J-I.OU
11\ pqilU,bL

c:mpd.u.u,e I"\u..~u..

11\11\11\u..

,,-.9Wo\ 1(03
j$xoq g- nu...u.,

'lm,$"bI. 011\eJt.d11\
11\..u. t\OJG\11\>l

G\',Qu,"-l-l.O. .)()

t)..11\ cpdJj Jq Jd.~I(

I1 11\q.'!l1 ce.M

11\J.,<J. t)U...u

Ji11\m, -mu. u..o~<:IJ()


Mefl)() t)epex0.9<.\ u..

3'J11\G\11\ u.I"\,3o"'il 11\(\', ~~


u.11\q ~q!. ClA,e.a.pue 4Q
il"\<{eX,re 1l\d11\ m(o '!l10-m.
4 coe e.9u.,,-c.11\e~,,-ou , 11\d 3 d I()()'-Id'I9..
bI.0.ge l"\f'. rbu< ,,- coodUJ.,eCYf)d.

13

J11f~l\}Iii,11t,G c~ou,Mu, 8C1JftfblMU"


J11f~l\}Iii,11t,G tkf~ruo\'u,. ~~c MU,f0t

60 .
, .
, , , ,
,
-. ? . ,

, MySQL
.
- , , , '
. , ... ,

... , .q.
? MySQL- !

MOryT ~OHa


--


MOry

...

,
,


, ,


,
?
...

ON USING



lasLname

birft1dote

, ,

14

for

464
465
466
467
472
473
474
475
476
481
482
486
491
492
496
498
499
500
501
505
506
508
509
510
511
512
513
514
520
521
522
523
524
527

Dsnu

1h,t}:;c11t.o~blt c11t.f0}:;U, U, '\10J\~.1h,tJ\}:;u,t j't(}:;~u,u,


_IIII 06l1er..alOT _II"

I< nepeo poe.ote COePWet> ypoet ...


-
.

.
, ,

, . , ,
, , ,
,
.


l'

,.

SQL-
LIKE

. ._ _ _

",oe~. .

implodeO

\?

:
SWICH
, IF

build_ queyO


, ,

=.. . =............

LIMI

..

-1234

-_;~

'-

Our-.

541
546
549
555
556
560
561
564
565
568
572
573
574
578
581
584
585

LIMI

586

587

588

~-W:l!I\liiril iiiiiIliIjk, ,

- - - , . . . . . . . ., ......... Pny.if..11I.ara

538
540


, ...

589
590
593
594

15

rezJftfble ~bjr~~etfL4JI

10

ll .
J(

, nn ,

rp .

, ,

.
.
. ,

,
, - .

~ ~

preg_matchO

l:
:
Js@sim-u-duck.com
: 636 4652
ll pl6oTI:

l:
:
JS@sim-u-duk.m

(555) 636 4652

ll pl6oTI:

16

598
602
605
606
608
615
620
627
628
632
634
635
636

...... 3AQ. .306_


8-, ! 03OOCJ

31, peocan 111.

.
, .
: ,
, , ...
. ,
,

, .
!"""'~..r'- ~'.:: !XZo.OnUi_
~''''''.''' "'~..r-: ~..f:h: ~\.k1r

..-k:;80

.........~ _
....
___.:r':

~'---;3b: ~:.mL,.._

, ,
- (-)

?
~:
-

GD.

GD

...



CmratlHO. Me~ HUKaKOU
.3Qmu MoueruroBamb . 3mu

rwmu bl.JJu U3 ,
upucj>uuru~. " ),

~~=?:-'::5r:::~:~,,,:::;m . <<'XMyt'blU uu))!

642
643
644
647
649
650
652
654
656
659
661
663
666
667
668
671
672
674
675
676

677

680

683

686

, ~

689

17

12

3 ..
rpo , -
r . , , ,
,
-.

.
.

-
.

l
ltl

RSS
RSS - , XML (tsibl Markup Lagug,
J(ftC~.lI1lt w..:t .. qw III.:18

Mrl

~~:::~;':..~:,~~-''~ '''''~-'''-'~-__ <'tw.''_(>lk'')<''' , ''''''''''''''"~'~~''~?


... , .. :. .............. " .... '

.._ . _ _._.........,"-...

RSS
RSS:

~f!(>-*"Of. :ll;~.. II(:>I ..(' . ..

=~_~~~i:~::!~:=:~'~~~~;~.'~f'~i<<

~_!:

RSS-

f~;~~~f.::::.:~~~_. ~~"-~, ~.~ ~= ~

RSS-

_<

~~.:::~~~!t;::~~a;,.~~~~'.,~_.~"_~~A . . ~'- ...,._ ,:-~:

:.=,~~ ~~~~:c::.~~j;:~:'~I~_ ~:~'~'II._~~"'~:t.!!'~>$. .: :--~



RS-

He.oopwe lIUIfW ~ICI'pOMoA

........

noep*M80801' pocnpocpotteMII8 .",

., "03.0" 8 ony~ "OlUle8

XML

XML-

XML
XML l
XML -
XML

0nt8 06w",
6 ... ,

....

"p8ocro8ll8n
8OJO.0Ch
npoccnpecrn
pocnponpa.
,

::::::::'":

p83Y"lt1'01'e ...ro

88
.

ycrpoAcno

M06nbltolii

80t01'

paatpocpoN8HM8 "_"""
_

...

"0II.,,88.

28

1', 1'

..ClOt .. .~
ycrpoAC1'8CI no

lO

"_

. ocn"

(88""

694
695
696
697
702
705
707
708
712
714
716
717
718
722
726
730
731
732
733
734
735
737
738
739

tnQ8u

g01)Ol\Jf IiU$

( QII)

9 , ,

, . , ,
. ,
, , ,

MySQL. ,

, ,

... ...

, , ... .

1.

2.
3.
4.
4.
5.
5.
6.
6.
7.
7.

N2
N2
N2
N2
N2
N2

N2

N2 8.
N2 9.
N210.

MySQL
MySQL
MySQL
(Exceptions)
(Exceptions) ()
-

- ()
-
- ()

ro

()

5

-,

750
752
754
755
756
757
758
759
760
761
762
763
764
766

19

rr~C1h,roii,X~ cregbl rrlr~1h,u,

rAe

.. IO. 6..

, r

MySQL

.
-,

. 11 ,
-,

MySQL-

.

,

? ?

MySQL?

Apache ...



...

MySQL
MySQL Windows
OS
MySQL OS

.l?

, II

( )

20

768
768
769
769
770
771
772
772
773
773
774
775
778
778
780
781
781
782
783

r~c\Uu,rb't1bt ffi~lf'th,u, cffioe,zo


6 60llwr
,

MySQL

, -,

. ,
,

mysqli

GD.

, , ,

. .

...

786
789

rn>1!i~f'''''

~JI;~~

'1o~b

!74~~~
"llII8/op;1Gt-~

'l1Q"~I':c-
~~~b_

l2'i>1!i~~.
fiJlI3 .......jor.~

bl>l~~_

125a:~--

,,I0~"""""""
~\IZ~'~
n>2l~~

~3Ja ~.e.-.
UHIjj~~'
:U1<I!i~f"~
'!IIr.;~.,;or.~

21

-, - .

, ,
,

,
.

() <

",l


. ,

,
.

MySQL

NRL LANL.

.
.

Yahoo!
. ,

BBS

~Kooope 64\> ,
,
. ,

, ,
.

BBS,


. ~\>

\"

~, - ,

-.

Head First

, ,

Head Fist

Head First
SQL ~

~1ySQL\>. !

.l ,

XML
Head FistJavaScipt

Stailfish

Labs (www.stalefishlabs.com) -


. ,

( !).

, ...
.
.

23

ryn

25

n30Q

?
<!;!> :
-

HTML
XHTML ?

L-,
, ,

MySQL

-?

?

, , ?
<!;!> :
COBepweHHO
r, n?

( , ,

.)

-,
?
-
, ? ( ,

26

MySQL ?

, ?

, Baw 3
. - , ,
- . , .
, , ,
, ? ,

,
, - , .
,
.

nm, ? ,

. , ?

. .
.
...

_l Alt l
, . ,
, . .

, ,
u

, , , .

. ,

~. ," '-\m0
c'4v.-mo.e-m'
.....

c-mU:
110 \-\.'-\mo'&~
ez'o
~2,,
:mb .

y1nO~

. ,
.

, ,
,
.

:
, , , , ,

, .

]3v..9eo3d l1u.cb
I1u...3 ..u..
'10/,, .eCOfi\.e.o
uKYf\epec.M .9 '

d. .d, ~
1dd J<t))OYl1
.u.d .

8lh

27

n0R

paccapuaeM umam.s KU

Head First

~09

, -?

, .
r. ,
, , .

, 30 .
, Head First.
.
(

89 %). ,

, , ,
.

r .
,

40 %,

, ,
. .

. .
: ?

rr

. , ,

. , , .

. , ,
,

.
, .
, . ,

.
. , .
r . , -
. , . ,

. .
, , , ,
? ., ,
, . ,

, : , .

l'

q. r::~ jYJ10..u.. (\ (\

' - - - - f5.J'i\Ou. ..

eC"YI'\b 'u.t"j(\"YI'\.\

U. "'l1l u.

t1C\poe u. . { . . ."'I1I. \iOMoZC\"YI'\b .J1'rIJ;',


tjc\prtro \JOu.cKe . tjU."YI'\OMUf.\, tju...
"
ltu.u. \Ju.f.:\}.-\u.!

28

J: CJI
-
, ,
-. , . , .
,
. , , .

, , ,

MySQL , . ,

, .
, , , .

lI .
, , .
.

, , ,
, .
. ,

.
,

, _ r

My5QL

n_.ua .

_.

ronop..Horo

r.

AOPory"t

: ,
. . , ,
, ,
.
: ,
. , !>.

, .,
.

. , , ,
-
(, , ), ,

, , - .
,
.

, . ,
", !
, , ,
, , .
.

...

29


, .
, .
, ,
, , , ,
- .
, ,
,,

,
.

n, , ,
. , ,
- , .
,

, , ,

. , .

80 n1CUX ,

, - , ,

. \1, ,
.
, , ,

,
, -

. , ,
.

--./fio;f08cff!,
11
f;U
I1 311\:01

,
, ,
; .
, ,

, , ,
,
.

n, ,
, ,

-. .
, , .

, , ,,
,

, , , ,
.

, , . . , ...

, , .

30

, ,

06 MOJr w
, .

; ,

/3bt Yf\ Yf\ tA flYf\

. .

___ ._I__I_I_I_I_I_'_~__~~~~_~_~~~:~~_~~~~~~~~~ ________________________________________ _


w. 60nItwe ...

MeHItwe

-,

. ,

, .

-.

, .

, -

. , ,

-, ,

,
.

",n. n

...
,

, , -
.
. .
,

n
.

n ... ...

w ry.
, .
, <1>.>

,
, ,

.
, .

, .

rnyn ...x

. ,

! .

, ... r ...n

w n,

... n . n, ,

n, lO YMCBeHHoro

- rpapo, .

MHoro

. rpapo

, ' (

, .

: .

, .

- ,

6.

m.

. MHoro ... ,

JIIO.lI l!.

,
. (
)

pocm crp r 3'1 !,


! m
'IT()- .

,
.

yS L d.wYr\ gj..."\ coa9aa"Y\b ~-t)UJ10...tA


"".
tAe)OW,tAe t)~"\l... jJ.:I.t. bt"\ 3d.Z)'d.Yf\
'~
~
, tA

w<

J.:I d.dtAu ee-cepep

tA

Ii"\, "\bt.d. g ~d.J.

31

n0

Read

( )

, .
, .

: , , ,
, .

r w ...
. CJ10

MySQL,

w CJ10 .

,
, , ,

!1 MySQL.

MySQL, .
MySQL,

, - ,

.
.
, .
, , n

MySQL.

, ,

MySQL,

, ,

, , . ,

95 % .

, ,

, .

f'/\bt

~_---- u.\J 3 0 :"t\


??4 \JPu. u.~.k:"

MySQL 5.0.

4
,
4, 5 6 , .
6 MySQL 5 6 .

.71\. U.l.i

.. .dUlu.~
u. ..u..

liu. btil
.

-, .

oap(\1Y\t).1Y\ecb

-.

l(\.3~

Apache

#<

- - ,
.

MySQL .
11 111 -
MySQL.

"

MySQL.

SQL (Structured

Quey

Language -

),

32

MySQL.

t)u. .u.9.

Oracle,

MS SQL Server, PostgreSQL, DB2 RDBMS (Relational Database Management System ).


,

.
, .
>

MySQL.

.
- .

. , , -
, , .
ff: ff, ,

,
.

Head First tl , ,

. ,
.

- ,

, .

n, r, cr , ~
,

200

tJ 011') pbt.e

' , .

lA. Ilpu.efo

, , ,

, . ,
.
,
.

}O'rj. tl.
Jd.....bt.

5'-tl.,.u.lA,
tlbt..

bt.t)..r\

. ,.bt.

Jd.d.'-!..

, MySQL-.

rp - . :

http://www.headfirstlabs.com/books/hfphp
.
,

, ,
.
.

33

KOMDHaD

-

-
.

MySQL,
, ,

. , .

,

,
,

.
,
,

4 .

11

PASS (Professional
Association for SQL Server -
SQL-),

Job -
Onion Flavored Rings ( <!
) - , ,
, ,

. -

,
-, MySQL.

- .

, .


- -,

, .

,
,

.

34

CSS,

-
OmniTI,

shiftlett. org,

Security Consortium. Essential


Security (') Developer's Handbook.

iiiiiiiiiiiiiiiiiiii;;;;;;;;;;;;;;;=~

_____

&
:
ry
,
,

, ,
.

,
( ?), ,
( !). ,
,
, , .

':

,
.




.
,

~F
:

uu

12. !
,
,

8 ~

35

J MoX}fU,1h,~

~U,]-f

~ ~~\U,u, 1h,~1h,u,]-f~ 1h,f~]-fU,Llbl -t-

'*

-+

-,

CSS, ,

HTML,

.
, . ,

, .
-. ,

. ,
,

HTML,

37

HTML

L
,

HTML

-. , -,
, -? ,
... ?
HTML ,
, , ,
.

HTML u)u:m.
:i9 06 .. U b!. XO"'il\U"I\e~
"- - - ~ce~o Uw. 1l 0 KdJd"l\b

"'il\2.dq:J coe~o

llu"Y!)OM~, . . uw.
IIU"!), U

b!. xo"Y!)u"Y!)e 1l0 0dd"!).

t\O"!)U"I\.u w.~
cdi1"'i1\d.

HTML-K0.9 ..7'Yr)x
'Yr)fd.u, br.

.Ud., KOZ.9<:1
d-llz~u'Yr)
.3.9d fJ'\ .

13e.-ceper

OZp<l"" f\~

!\ "!) d~d"!)1d"l\

HTML-"l\d.tAu,bt "I\
" _
\')d"l\., i-t zu..
-
L- ,

, .
, ,

-, -
, ,
.

38

es g u
tlfML, npocm
06 u

tlfML-cmuu

u,

06.

os cogu.

------

~ .d

-11
..

t]~}

ct.

es-cepep

- ,
.

Cn guuu

: -

L-.

~gaatnb

L- ,
,

fL-cmUlJbl

HTML

? ~eH.epu.pje'W\
L-K03 .flrjLI.X c'W\pct.u.u,

u. 'W\ u.jMeKu.'W\b .
jctu.cu.oc'W\u. 0'W\ ..

d-t1..u..

. 'f~
? ~ -cu,e.ctpu.u. JI('W\
4 tL-, 'Yr\Q.K _

u. ?. 1l0 .u.u.

.ct. u.

L-'W\ct.u.u.,bt

\1..'Yr\, 4.

.,3.5l}O'W\5t

'W\'W\'W\.u.
. I1p0ZPct.oU .u.U

PHP-cedpe~ 'YI)
t)j5t.'W\ d .'W\5t
.}.'W\.U

~u.dl{oc'W\u.,

6
.

MySQL

cl.u.\1.u,u.. .u.
I1ou."l'l\U. L-.

? "lY1 4"lY1
34..bte dQj'y . (.Jct'W\
, 4 'f\ct g'W\ctg5t'W\

34 KKbte, .J ..bt.
u.j dQjbt, g HTML- K03,

KO'f\0pbtu . ..u.'l\.
~

39


Al iensAbductede. (. )

,
. , L-,

,
. ,
.
.

I\oeet me. IIJI - _ l


!l m:
:

I') 5l d.

"\kU l')Ytibt.

a.>otnJI:

Kora 1DJl?
OJIl'O ?
II>ro ?

t'! .,,\u.,,\.5l.

~,.;;;=,.;;;=,--,.;;;=~~---&::-I---- . ..

ot'ju.co..u.e. ....

nmre:

r?

a. I(u.W<

1'1 u.u,g.
. ...,,\5l, "Ir\

K,,\0-.u.d.'i9 b o,,\e.,,\,,\

. .ct gQl1?OC.

. u.. u. . ...
.ct u.I( d.
t'\u.u,.

L .. _ . . _ ..._" . __...J) - - - - . - )dbt.. 30t).u.'!1bt


t)d.'!1 .
,3<::tll uc o.'Y!1b )3\
-rn \\U1\ \')0 "\..U
r,m, }"J1.u, 'VY\
l')'VY\u.'VY\ Ca'f\c!. O"\l')pa.u.,,\

3d.\!...! . cepep.

HTML- ?
, -
,
, ? ,

41

L-

tLt a ..u...
ct)oMtW:Yf\b, .3d)O'Yf\.
HTM\..-bL,dl\LtYl\

w L

1.4 w.l.Lt Hea~

HTML 11\.. with CSS & \...

firs-t:

rn , , ' ,

, . . 11 0 Lt"iY1.9 -u-tb!.,
' . fJ..9 .l:, q:,

t:

()

YI\i-t: -" Yl\ ilYl\, il.3~.)OW.,Ltu.

Yl\l').YI\ 1')0 YI\..u. t10'Yf\ ..bt.,


e.ge..bt.e g })

CI "n) "iY1 ~pec .YrI..u.

I10~b!.. J.u."iY1 .
d. cO, ..9 dY.9e."iY1 e
"iY1eC"iY1Ltpoa"iY1b

<> ~ :m
</>3~ 'Yr\. t)arae~ ~
< orm method="post ~tiOn="mailtO"owen@aliensubductedme. "> ,LtYl\ , / /

<label
<input
<label
<input

fr="firstn">:</ll>
type="text" id="firstnae" name="firstnae" /><br />
for=" lastname" >: </label>
type="text" id=" lastnae" nae=" lastnae" /><br />

<label

fr="mil"> :</ll>

<input type="text" id=" email"


<label

nae="

email" /><br />

Yl\t).YI\6 ..bt..

...,Yl\ I')'i.tLdYl\

JJ-.. ~st

IALt i:. 1.0d.~


D.-I7.~lJ\J ~Lt
,'V-7,)

....rtol. l')o.3. .

.Lt (i l1 put>

fr="whnithnd"> ?</ll>

<inp~tYPe="text"

id=" whenithappend"

<label for="howlong">KaK

fr="hwmn">

<input

ty~"text"

<label for="

whenithappend" /><br />

?</ll>

<input type="text" id=" howlong"


<label

nae="

nae="

howlong" /><br />

?</ll>

id=" howmany"

nae="

)!) ,

'Yf\ J.g ecb .9"11


O.9 Lt"iY1bc 51. .9abte .

A-tnLtd"11 type "iY1


, 'Yf\ J dY.g e "iY1

.. 'Yf\e.KC'Yf\ (t1PLt ,
31.u.Lt text'),
lindsritin"siz="2" /><br />

howmany" /><br />

lindsritin"> :</ll>

<input type="text" id=" aliendescription"


<label fr="whtthdid">

nae="

?</ll>

<input type="text" id="whattheydid" nae="whattheydid" siz="2" /><br />


<label fr="fngsttd"> ?</ll>

<input id=" fangspotted"

nae="

<input id=" fangspotted"

nae="

fangspotted" type="radio" value="yes"/>


fangspotted" type="radio" value="no"/><br />

<img src="fang.jpg" width="100" height="175"


lt="

<label

.">

fr="thr"> :</ll>

<textarea id=" other"

nae="

other" /></textarea><br />

</f:~:~; type="sabmit" vlu="~ " na\submit" />

.. ,.u.cl
'Yf\e.aLt
42

<for'Yf\>.

.t)d d.Lt t)Xl.t.LtLt

O'Yf\Kpbt.a)OW.,u... Lt .3d.KpbLajOi..JJ..u... Ltl ..lA.9 ..'Yf\.


'Yf\ .100%-0. .9

HTMU

~"iY1 , ~o

. ~ 06pa60"iY1a"iY1b
u. O"iY1t)Pd~u."iY1b .9a.bLe d. cepep.

CmDu.,HbIe CPDHuqbI

eCT-.lI.----cnr8 .
. ~

;,-.,-w. headfirstlabs . com/books/hfphp.


chapterOl.
::eport . html - ,
(style. css) (fang. jpg).

report . html

. .

, -
Q
4

..

---

....

..

"

;.:

~..

""........."""

:<"

... .,.,

};{<:,;':'

-::;,

~8WCQ_D. .~.~~~ ~~~~

-.-:

........ -:

...,
.... ..-1

'-_"~?
~-=
_ _ c.-t

l8E8 _ .. _Ca6IaY 31n?

H~$

ct'VY\uu OlY\t'\PdKct .
.. 'VY\u1\

'VY\ex

IIO. I10

t'\'VY\u1\Jb CdU'VY\ct .to

. 01\t'\dU1\ 't\u g.
'VY\pct.. btzu d.bt.
, ,
?

L- (i
$> ,
.

, ...
- ? ,
.

110 mofo
, l> n"

n'1' Outl.ook. " HeU f


mOfO, "" " 9'JO "
neU)( 15 .

n. ~ce
", ""

", nn".110)(,

......-~--- ~~.-

..

..........-:

~ """,~-.~-- --

-...

- n)(u f .

s-,... -'jICOCIOCIiI _:

1(fc;o. Y.~"""'_?

aIt}') "';nCJ:'~

<,_ .. 6,.a::I'!

uf n;u,

.......:

Moefo n"f

...

01>1 0.

? -
, ?

44

. L- ,

mailto

M .
,
.

mailto

.
;
, .

...
, ! ,
,

. - .

,
-. , ,
.

mailto

(HTML,

. .) ().

'\

Fd.oo!1\d.e!1\

;:m ....... ...

............ _-.,.-.,

Iipekpd.Cl-lO, tl0Kd.
. Yf\ KttOt)KY

ebt,

.u. t)u..u.u..

~~~;~~~~~ :~~~. ~ ~~ ........ , --. _ _ _


: ...

...

...

.... .... "

bl ~

45

L-

HTML act ion,

mai 1 to,

. - report . html
d d.ei'l)
-, 3 !. Oi'l)
.
I\~dJ-lO
df)u

11

. 111'

eea-cepee~c!.
\J.d.,
,
.)
d. u. eCi'I).o e

Ul.lJum
.

, ,

~eE-cpaHy

//;. <'

-i'l)
, .

,..

,,\...UooU.\etiueo noxuU.\eHuu),.

" 3

8
11...,.
vbI u.

,""'

I\~ .d......,,e.O{)<..\T,"",,,"
U"CD ~
VL.I.

nPO~PQ.d.
~~.,

PddOi'l)d. },d. !. \.
KOMllbfOYt\e.pe., u.,3ee.c"Yr\f{d.
"Yr\\ t"jo.9 .I~gd..u..j
I1


L-
.



m .


"-

Ce.pep

. IIpu...u...cIe"Yr\

UKd.KO~O Y'-Id."Yr\u..

"- .

Odpd.dO"Yr\Ke

- .

, (!)
, ,
, .

46

d..bu< e-cpopMb!.
d.i'I)pU.dj"Yr\OM d.ctiOIl:
u.},u. .3.d. u

i'l)d.i~tO.

v
? ,
= ,

=. ,

'2. ~ . - ! -
:'L1..] , -

:.1 .

>-

-
, JIIO .

l1PUUJum, t10um, ~8"-mru


CoooU.\e.t1ue t1oxuU.\e.t1uu)).

00

L-
.

<form action =
"report.php" . ..

m
L-

0 . ..,.1'8 nolO, cr cr
"iopcwwy a.nJ -:

[]

D ,

..~ .~~.l\u.~.
I)..u.

l\Ql\u.~J-\.O.
m... l)u.cbct.

47

3K

-
- . -,

. ,

HTML-

ss-.

HTML-

ss-. -

HTML css.

, -
- .

L-,

~ .

------~------~
reporthlml

HtML-.

ct4)'!]u. ..I1u. .u.

_~~'! '!)t)ct.'!) .9ct.t.e ,N'.l:


. t)u..u.u. 11 0.9'!).9ct'!)

PHP-u,.ctu.1 .ct ...

~ .,

- .

48

~ nporpaupooaU9.

uu. anucaHHble . umepnpemum


55-.
L-,
-.


- .

h .... - - ....,.-t08.~f)II\:~'~II_

Qw~I:

.......

........... _COIIII8I)I.~.-.
-..........-:~-

1l0Yl\U,YI\ cctu.YI\ct

-, m

u,u,YI\ -YI\ Pd.Ku'u,~


I)0Yl\ ..u..

3.1

L- .

. t)ct1')

1') ~
t)tAcbMo.

49

6 o<tion

...

action .. ...
.,. .. ll, ",
, KorAa .

-,

HTML-Tera <form>,

<form> action. ,
action,

. -

report . php, act i- < form>,

, :

method = "post">

<form action =


~,

report. php

<>
n~~~<~(~>~==~~~___________
<formmethod=*post .. action- "report. PhPO;;:>
<.

for-firstam"></ll>

r----

<~nput type="text" id="firstname* narne="firstname"

50

I><br />

action

., CptlHUqbI

lf~ 8i~'t1l,

gV't1blX ~0't1l'0CO~
1}: ?
: - , 0 Personal Home
Pages ( ).
Hypertext Preprocessor (:

).
,

. ? ? !

1}: , , JI

~ - .php,
HTML-. ?

: ,
- , 06

HTML-KOA ,

. 0,
- L- , m

. 0, .PHP-
-, ; HTML-KOA,
- .

1}: 38 - 3I1OC ,
L HTML-ll?

: HTML-, (55-,
- . . lOC

. L- (55-, ,
,
,

. - , ,
pn . -,
,

HTML (55.

8 ~

51

D uU


, -,

:7mO 6'r:.

Il ,

li)'ljlAJ\l\ 5/.

1>HP-u,.lA5t -

1 to.

. , -

6'}d)'lj bt.bt.

. .

HTML-)'Ijezu.
u. C\mpu.dYl1lbt.

~<html>
-I(.9 .1\

u.1\5/.
1\..

)'IjC\K

<head>

<tit l > -

</tit l >

~e,

</head>

L~pctuup.

Cl.l,e.Mpu.9_ -

<body>

J)'IjO

< h 2>

</h2>

J)'IjO)'lj

?JP -

. 1\(1

btbt

..-

IOML.

J)'IjOM

Bo)'lj .9

.z.)'Ij.

u.}O't!J5/.

Pt1P- \

u.K)'Ijepe.c.bte

u.)'Ijbt;'d /Oi'I1 51

6'u.: Ji'r)O

.9dHHbte. bt.,
'hr\ !, .u.
zu. dbt)'ljb
6'bt6'e:g e Hbt
k.C\ \.

PHP-.\

Qi'r) )'lj\k.;,to_

t)'YrI 6'....u.51.
3 !.
u.t).31..

, 'hr\Odbt

zu.o6'"f\
HTML-K0.9
u.,3 .9C\...bt.x
bt..
</body>
</html >

~_ \. u. dbt,d5(

ct-md.u.up,J)'Ij)'lj
?H?-u,u.u.

jd\,u.6'\1\5( .3\bt1\u...'\
Oi!'!Kpl'?1..)'Ijbt,x /.-)'Ij..

52

---
nlt

report . php

. ,
- .
- ,

::-eport . html act ion


:nai 1 to report . php.
<form action

method

"post">

report . html ,

-
. !>.

~ ,3d.u..\"Yr)u. o"'tj d...


~d.,'j'd. b!. "'tj.
yts"u.."'tj d-"'tjd.l-lliu,
d.I{.\-"'tj C"'tjpd...bt.

I8cJl D.lIeJIbl~IoII10111D11J111--~ 0 " " " p~ croplOl1OXIIICIII~ ~

"'tje.Kc"'tjOM u..u., g.,

d... "poc"'tjO report.f*'p


u,.du...

",,:
.'IIII:

c:pooIi D';

m> npowooo?
oro ocyrcnoan?
clloJlll I blJlO'!
0maIc"";

ro CDaJUI IIIDOI?
JeJI JI ... JIOIO ooaJ<y '/

, m -?
, , , -, .

53

~ u. ct

report . php ,
>.> . : -
, ,
. -
. - ,
, -, ,

<UJb. KOllb)01\')epe

''Yl1ct.. e-cepep
u. 011. 1'l0.9.9..ct'Yl1
, 'YI10 ~bt 'Yl1
11 PO'Yl1eC'Yl1u.poct1'f1b
PHP-u, 4 J..

-.
-
.

~ 'Yl1 u.u.. 01\ HTML-1\ctru,.

1\bLe .'j"fI bt1\


01\bt1\bt ctt-W

.
dpctYJe.pe., PHP-c~e.apu._u

.,9Q 90.. 1\btQ1\(51))

& r

<.J VRL c.epepe..

-.

dct' ct
_____ .7'Y110'Y1J
PHP-u, 4 u. c.eo u.Lt.(!;
4
dL"'L..
K0.9Q

~e-c.e.pep
t)ol-lU,ct1\

.7'1101\ -,9 ~

u. .1\
btI"\rtU.'YI1
~.l.

6-...
MOry .lt
-

" .....lt
L-w, . ...

n. 6.

PP~puu g1
Um.epnpemup058.tnbCS

- sygym

~ u ou

-~-----5bOA1t1b

6 :uu.

54

{( -
,

- .
-, .
- L~,

. -
,

FTP.

w.1l
-cu,el-ld.pue

I(4,3t'll'\.

cIJbt..

I-ld.

e-cepepe

Mec1le .9Py.u.u.

ct.

. -
.
,

8~h,

Z'if11blX ~011YOCO~
'f?: lO, ycaHoneH ?
: - -

t~~

-,

-.

t es t . php

<?php
phpinfo();

11.

q."Yl\ Y.9cV1U"Yl\b cu,eo.puu


r+-.il1f 110 .t .

?>

test. php - URL ~~"Yl\u.Q.., "YI\bt. t"YI\


.
.' . . I1 0,30"Yl\51

, ,

. !

"..;:-

' - - ~"YI\Ou u.l-lrhdu,u.u .

.,. ,

55

- -

--
r n ...
- .. .. ...

report. html, report. php, style. css

-, .

fang. jpg

URL

report. html ,

<i !>.

upllJllUWlbl JIl1 - 6n _n.


ta)Jl;ro crop!J fllllCllllJl CJQI nPeJJ:
".:
_:

nll OThl:

ora:rro npoon'!

. QJ\lo ocyrctIOa1lll'l
lOJ IU. ?
Qn:

eJI8.'! '!

_ "" r?

K_.'IeCIClle .DJ~1I IIJI -

__ _IIJI

II<IIOIeJI IIpe I1p01WI orn:808 '11 .


0n1lDfe :

lIn . Io ra? [fet

118,. IIJtpeC :mcrrpo ""',.,': "1ti:t@1hC}'llOlllygreen.com

56

l<pymo!f"el1erb (1,, m (1,


, - m m U(1,
HeHOrO fP-KOUa,
110~51 " u
110 mru 110m.

report.php

,
(
),

. , ,

, ,
.

1l0cmoume! , m eu.le
,51, ' l1(1,u
(1,arl,aHm 51 rep0rtrhr, ~erae ~erw,
(1, m l1(1, mrr I1.
UUJ u mOrOl1UMC5l1?

. J
6

rr

ero

".

, lJ

report . php

,
,
.

57

- n6R

HTML

6 JML
, -,
, , .

- -, L- .

HTML ,
HTML) .

report . php - HTML-


<body> . L-
.

Cepe?, u.o'"I'I\epllpe'"l'l\u.pye'"l'l\
.7'"1'1\0'"1'1\ -

')(.:f:~

u. ...;n L.-,
..w,u.u d~,

KO'"l'l\0pbte btu. .bt.


}
.

$when_it_happened = $_POST['whenithappened'];
$how_l ong = $_POST['howlong'];
$alien_description = $_POST['description'];
$fang_spotted = $_ POST['fangspotted'];
$email = $_POST['email'];
echo
echo
echo
echo
echo

' . <r /> ';


' ' . $when_it_happened;
' ' . $how_long . ' <br /> ';

' : ' . $alien_description . ' <br /> ';


' ? ' . $fang_spotted . '<br /> ';

echo ' :

58

'

. $email;

u..ctu. btCi

1(0.9 -

'Yr\d'Yr\u.btCi 1(0.9 01-\. u.,3...'Yr\..

< }'.:.2 :'-:.1I"\,.:.'{.:\:?

n~~!:::'Ji.i:~:

.i:':.!.;:;.:;:. n

u.,3.."!).

I(d:9bt.Ci

Pc:IJ, I(..9

1("Y!)0-.u.S.'j9 l-\.ece"Y!)
.9a.bte f<

!'':':"?li9.

..- \:;(:~(;'';:;.(.? ;.;

<.ih2;,

.<r

/>

11

. . < />

. <

/>

. <

a1fn@theyreallygreen.com

/>

<.:.t..y.1y:>
-.: /r1!:. n:}:~

uI!wJDr _

llIOIII!fIC JIOIII'I'<O rou Cm:YtC11IOOI>I ........... 11 .....,..

Qmrune:

................ oouy In? cr

upcc """"'1'OJI """"" ~Y8l='c:om

..

59

u -u

PaJ60p

report .

<l i>, ( ) -
- . , .

HTML. ,

, HTML-,
-.

:\, !'ri"Yr\ L-.


..f).: g u.:\

<html>
<head>
<titl>

.3. .bt

11 pu.cyrt\ c"YI)eogc:\"YI)b
"YI)e.z.u. D
(1\.1:\ > u."YI). t).,

</titl>

</head>
<body>
<h2> m

. .. .. t) u.u.
u.x t",1\"Yl)bL.

</h2>

. L-

. <? ,

:\u..ct 1\,

-: , , PHP-.

N,.1\:\ .

<?

-<


.
u

, , - .

$when_i t_happened = $_POST [ 'wheni thappened ' ];


$how_long = $_POST [ 'howlong' ] ;
$alien_description = $_POST [ , description' ] ;
$fang_spotted = $_POST['fangspotted'];
$email = $_POST['email'];

u.}I,e.eM

-...

\')0

.. , \').

,,1_ I

JY\\01"

r ..

'!~"Yr\u.,..,\

,3ct

ct)z

'1
"Yr\ez.c:\ . >.

Kct:k- ct "!):\

~ -:\ "pu.cgc:\u.gc:\e"y!)
.oei:1t. t)epeMe..bt ctbt.
g.~

g t) D.L."'l.

mI'r, ?-
g"Yr\d.."Yr\

, , .

.3.ct.u..

L-.

lle.peMe~

L-, .

'

'

'

-. L-.

?>

, L-, .

</body>
</html>

60

g L-,

~ KO"Yr\0pbLu
.<r />';
. $when_it_happened;
t).ct"Yr\.
' '
. $how_long . '<br / > ' ;
Jct .
' : ' . $alien_description . '<br />';
' ? ' . $fang_spotted . '<br />';
' :
' . $email;
39 ':\l{ct.t;.g:\"!).
?>, <?, ,

'

,3dJ!.?LctU"Yr\e, Yr\ M.bL o.3d.,,>,\

?t1P -I{'<1 "!)Z .."Yr\d


bt. g.3~dd.
1{ d!.. L.

HTML-1\d.u.u,: .du. .3dK pbL"Yr\b


ct. O"Yr\Kpbt."YI)bt.e HTML-"Yr\e.zt.t.

v8Jf

- KeAllpe8i

report . php

-. .

[j( fP"'KO() &r()a ~ t() ma8MU <~php U~).

'

.<r

/>';

ct ,3cti1 :Vf\U

ct)'\'\ i1o5l)'\'\b ?f,


Yr\ :)'\'\0

KorLeu,

?? -i1. .u.

[j( ~U &J"'''''pauut Un(. &t Utan& fP"'Ko()a, aut

U(.nOAb,o&amb & UMeu &J"'p&tpt pac:.auupeut fP, Ht '1k


Xopowct5l bt - d.ct)'\'\

?tI'? -\.,Wu.. ~"'e.a

r(wu.F~. ?1?
.7)'\'\0 . \ipoc)'\'\o
~ ~ !(o)'\'\ pd.Cwu.peHu.e,

[j( ntpteHbI)( ff() um(, (. } () <".


~

$emai1

3.{ 44
.3rL4~l

l.."Ir\u.tu\~"lr\

pfj -t)...ro,

= $_.POST [ , emai1 ' ] ;


,

report.php,

, ? !

I(Ir\{ :>IGtJ."Ir\

u.cpopctu,u.ro 'gftJ! .
IJ,4u.. .

8l ~

61

nun60un

AII

.eas

,omettep.

5 'om 51

$, (

) . .
, .

. .OCUtnb

gaHHMe. u

rn. ,

nepeeas g

-.

uetnb YU.aAb~

, , ,

U9.

gas

, rn.

l.):J..l1'.", c.uM.OA }

Yf\~. COM

"o't\ .! $, I{OYf\opbt.u .

I"''''b , }8l' <;). ~___. . . :bt. . . :Yf\;.:.:; . 1(~:90


~ n'ttQ }tt ........ "llll", u~ }ttOf\) c.uM.OAa.
t)....

(t( CuM.OA, ~U ttalOc.I'e}c.....etto ~ c.uM.OAOM }8l',

} I"''''b Aulo ~.oO a~uOc.otu ~a.u ...a, Aulo c.uM.OAOM


n<'u.u (_', nl'u , ... . n}toU~ C.UM.OA'" Mcny... I"''''b
Iy.au, uutl'au UAU C.UM.OAaU n}'u.u.

(t(111'0leA'" u .nUbtI"'~ c.uM.OA"', KI'OM~ _ Ut,


~ t'\~'t\v...

I1Yf\.

-.?

I1Yf\!

..

I$fang-spotted I
').

. dJd'\. ,

t).30g~'t\

liepeMe..btx .

H~ }ony.ato .... lQ .... u UMeU n'tt.

t)~'\v..!
li

'
.'

when-it happened
$what they_did

I$how_long I t)30~Yf\
. dJ~Yf\.
.

t'\... .

.J

I1'\.

.-I ia;l;-:L::;n;~d~~s~=r=i==t=i=~n~J-:-,:
~

' - t)Yf\!

. t)...

. ~..'t\'.

. ,

3~I{~ lk:l.~ '( $).


.
.

(jf .n~Q...~ ....l'tt"'~ Iy.", } UMe n'tt"'''.


(t( ...}Q...~ . C.UM.OAOM n<'u.U
MttOtuCAO.tt"'X UMeaX n'tt"'.

.

, ,

. ,
.

62

-n'
g.

.
1

.u.tnbC9
goapa:

u orym
5m

npose06.

I:!'
t:l

tfG ~itG1h.

'9: ,

: .
,

. ,

echo,

EchO, -
.
,
w

.


.

echo

6-,

por, w

-,

: , .


,

. ,
,

L-, URL
-, ,

L-.

webpage.php?

: ,

,
L- ,

6-

, ,

, ,
,
,

w
na . ,

be6-,
,

.
.
,

$eMai 1.


,

.
.

'9:

-, L-

TO~ ?

: .


-.

URL -

,
,

. -

L-

URL,

,
,

. ,

URL -
-.

'9: -, n

L-n, OlbCll

canIl

-.

HTML-KOA,

ero L-, ,

cnp6ya L-?

: -

< ?php ? >


-
,

coepweHHO

'9: -,

< ? php.

: . ,
, . ,

?),
?php) ,

'9:

30 ,
.

URL,


- HTML-,
.

; .

<?

.PHP-,

HTML-Tera.

capooro era

. ,

'9:

HTML-, , ,

L-,

L-.

$ernai 1,

'9: 6- cera mn

'9: 3, Cnb

$EAIL

Z'if1tbJ- ~01tfOCO~
: ,

(true/
false) .

,
( ).
,
,

, -

12.

NULL,


- . ,
,
. ,

NULL.

, ~

63

liIcI'leCDe lLlloW 1IIIIIIIJI8

..... - _ _ 1IOI1IQeII11

acarate IIIIDY lICt'OPIUO IIOXIIICIIIllIOC:IOf'ICCJaOO 1IJIIIDICIILua:


:

[~

uota:

:~
.P~
.. .::::.. ""
....."",
. -::"",,=... ""

ncpotUIO O'J:

Dr.u mJ DpOIOIJI01

: 1,nOjl~_pM;o1m.!

1. oI!pef1llOOUlOfO ~ )

QJO ... ~

1~--'' -'--'-'

_ blJlO?

! ~ ....

Omamm::
or JICIIJI

. .9.o,
'-I'Yr) tu.

_1

1{0u.

eJIJI JIIf 8IiI couy ra'/

t) [>u.weJJbu,e

e.g e .o , .
... .0

'!)

Ot)U.CQH.u.e

O'Y!)CY"'Ic'Y!)ye'Y!)
f-t.Q C11}p<tKu.u,e

110.9'!)~:9.u...

II n.., i8pe l!J"'IJ!!"' Ia .~.-'II....,..

urre",,:

8 _ J1JI I<0IO c:oaJcy :>ra?


'I>eC Cl:lpOloii lIO'I1J,I: alfil(4!IbeyreaUygroca.com

64

~ nopa6omamb

report. php

.
, , ,

, , . ,
?

<htrnl>
<head>
<titl> -

</titl>

</head>
<body>
<h2> -

</h2>

<?php
$when_ it_ happened

= $ _ S[ ' whithd'];

$alien_ description
$fang_spotted

$_POST[ ' description ' ] ;

$_ POST[ ' fangspotted ' ] ;

$ernail = $_POST[ ' ernail ' ];


echo ' . <r /> ';
echo

'

echo ' ' . $how_long


echo ' :

'

$alien_description .

' <br /> ' ;

' <br /> ';

' ? ' . $fang_spotted . ' <br /> ' ;

echo ' :

' . $ernail ;

?>

</body>
</htrnl>

report~

65

u u

report ,php

,
, , , ,
, , , ?

<html>
<head>
<titl>

</titl>

</head>

.9 1f\. C1f\POKU.

<body>

I'). I')u.d.r

u.'Yt\t.d.'Yt\ 3r
,uu.x

I'\u.u, cpop.bL
u. I1pU.Cd.U.d.e'Yt\ .

<h2> -

</h2>

<?php
$when_ it_ happened

= $_ POST['whenithappened ' ] ;

l')epeMe.oo. $d.~iel'\_
de.scriptiol'),

$alien_ description = $_ POST['description ' ];


$fang_ spotted = $_ POST[' f angspotted'];
$email = $_ POST['ema il'];

.9, .9u..strou.u.
ot)u.cd..ue ,u.u.x

I)u.u, .9py.u
1f\ekc-, u. HTfIIL-.9
u. t).9d.)u.u. -d.1f\

d. .

echo ' ,<r /> ' ;


echo ' ' , $when_ it_happened;
echo ' '

. $how_ long .

'<br />';

' :

echo

. '<br />' ;

echo ' ;

, .

?>

</body>
</html>

110 Kd.KUM-1f\ I"Iu.u.

. .

,.. $d.~i:-ll_dsr\tlOl"I

OKd.3d.J1d.cb
m Il.

66

I'),'jC-U,

um mmm

aaHHble 8 I
-

, ,

Q .

$alien_description

3 , , .

$alien_description ,

~~ .
~

!. U d.U,
.ctt] ...))

4J1..u:),

ot]U.Cd..u.eM

I-W."VI\.
I-W.d
dWd. t1yc"VI\d..

I1u.u,.

ux

$allen_descrlptlon

$allen_descrlptlon

};,
~

5.::" ien_descr ipt ion,

$lin_dsritin~

';

~ d.z.lI\bL "VI\eKC"II\d. , "II\d.


3 pd.eoC"VI\d. ~oOPU"VI\ ??
:'jClI\d.ooU"VI\b jl-W...u. 1IJd.Ou. d."VI\U
", ... u ctll\U-

4jbLaebLe C"VI\POKa..u..9 0...!.

bL"II\ cez.9d. ...u.bt


d.bLd.U. - 0.9 U4 pbt.u.

UJ1U. .9obt.u..

,
' $lin_dsritin.

, :

,
, .

- ,

$alien_description

, , .

$alien_description

$_POST['description'];

, ?

67

Bceo$. POST

ll ll _ $_'05,
n_ , ll n_
.
$_POST ... $_POST - !
, $_POST - ,

-.
, report . php,
- !>.
,
- ,

$_POST. ?

$when_it_happened

$_POST['whenithappened'];

$alien_description
$fang_spotted

$_POST[ ' description'];

$_POST['fangspotted'];

ct"!1 <:I.!.
cpop~, ~~<:I
LA"!1."!1

~LA~u,~u.
t)..

$hOV,,-~t)

!> $_POST. $_POST


... ?

68

$_POST - ,
$_POST -

, ,

$_POST

, .
, .

<html>
<head>

1f.I:
n.:

< titl>

JlljXJR1tOiI O'lt:

orna : npoIOOIWI?

</titl>

</head>
<bOdy>

oro arcya:no?
COCO)lbl(l) i'!

<h2> ]~'J,u -

OmOD_:

. ro CJI8JIII ?

8;'" JIlI l<Y ra'!

Hc:r@

< /h2>

<?php
$when_i c~1a;~~~~~~~~~n
$how_long

$alien_des ~~~~~~;;'~~
$ fang_spotted = $_POST[
$email = $_POST['email'],

echo
echo
echo
echo
echo
echo
?>

'
' ' .
'
' : ' . $alien des

' ~?
' '

. '<br />';
'<br />';
"'. ''' __'''J..'JLted . '<br />';
.

</ body>
</html>

$_S

submi t

~~~~~~~~~~~~~1I1I1I1I1I.\111111

, . method
<form> post, !>
$_POST,
.

~iorm~od="p?action="report .PhP" >


,

(!i\.\.

sSiot)

$_POST?

OdpC\.dO"Yr1KY)

ll"Yr1, d..!.

1. aY3Yrll l'1\.bL
-u,u}() odpctdO"Yr1KU.

reporthlml

69

$ POST -

$_POST

BaweMY

$_POST - -,
, .

- , ,

r...-.--.. ___ .......... _

-:

ha:a:D~8IW)'fICq:IIUODOI _ _ ~~

.:

$_POST, -.

...

_ _ ."",,,

III""_1

$_POST ,

aACIIIUe"~?
<&1". .. 6:to1

.
,

0.-...."

$_POST. ,

$_POST [ 'howlong' ] .

L- ,
,
<>

$_POST.

m:</>

<form method="post" action="report.php">


<label f=nfist">:</ll>
<input type;Ntext" id="firstname" name=nfirstname" /><br
<label f="lstn>:</ll>
<input type=ntext" id=" lastname" =" lastname"
<label f="il"> :</
<input type=ntext" id=" email" =" email" /
r />
<label f="whithd">
?</label>
<input type="text" id=n whenithappend n =" whenithappend" /><br />

ITfjjiil~,~jIJ.lt'iltlll"IIifrl.1
<label

f="hwm">

gaHHMMu

/ label>

~o~ ~e:~
<input type="text n id="whattheydid n = ha ttheydid" si, ='32" /><br />
<label f="fgsttdn>
?</l.~l>
<input id=" fangspotted" =" fangspott
n type="radio"
'J.lue=nyes"/>
<input id=" fangspotted n =" fangspott e
type=nradio" v, 1.="" /><br />
<img src="fang.jpg" width="lOO" height="175 n
lt="

5 n.sl
L

.">

<label for="other"> :</ l


<textarea id=" other" =" other" /></textarea><br
<input type="sabmit" vlu=" "
</form>

\') bt
'"'.-m, ...
l')~u.-m9.0"Yf\~\')

J-tbt ~ d.

'Iastname'

'whenlthappened'

eaIIOn':?

'hawmany'

'Yl1I1 1(0 ceM .9.a l-t.b!.


$_POST ~cpop.bt )i~'Yl1
.. .o.ccu.(? $_. 51.

70

report . php

, ,
. , .
: L- .

<html>
<head>

<titl> -
</titl>

</head>
<bOdy>
<h2>

</h2>

<?php
$when_it_happened = $_ POST[ ' whenithappened'];
$how_ long = $_POST['howlong ' ];
$alien_ description = $_POST[ ' description ' ] ;

~I"\l-tu:VI\:

$fang_spotted

pa.ee~

$email

wu..u.

= $_ POST['fangspotted ' ];

$_ POST['email ' ];

t1~

- '!\ux
"", Q

echo ' .<r /> ' ;


echo ' ' . $when_it_happened ;
echo ' '

-----~C;;:o ' :

'

. $how_ long .

$alien_description .

' <br /> ';

' <br />';

::)

echo ' ? ' . $fan(Lspotted . ' <br /> ';


echo ' ' . $email ;
?>

</body>
</html>

71

~ u

report . php

, ,

. , .
: L- .

size= "32 " />


<input type= ' text "

id= "aliendescription"

reporthlml

t). cpop"'bL

g report.ht"'l\~

_.-

d~iet)de$Crif~t.\or(,

<?php

I1i . coo"'l\~e"'l\C"'l\gye"'l\

['whenithappened') ;

utl~, ~t)"'"'

g $_.POS.

'aliendescription'

$alien_description =

ut:::bl.....L...L1J L ..l.. V11 ' ) ;

$fang_spotted = $_POST['fangspotted');

HdM .do.u

$email = $_POST['email');

~.3Me~"yy\b ~_POST

"\ I1idbL ~

~"\d t)PdgtV1b~:

echo ' . < r />';

d.Riet)descripi:iot) .

echo ' '


echo

. $when_it_happened;

echo ' :

'

$how_long .

. $alien_description .

' <br / >';

'<br / > ';

echo ' ? ' . $fan(Lspotted . '<br />';


echo ' :
?>

</body>
< / html >

72

'

. $email;

ecT----- , .

report . php
report. html

-. -

<1 ~, .

Ioco op8IIIf.IIWIW JUlJlJllleu - 6


~ :roplO \1XlCllllJl OC!l'leClOOl pem.:

Ibo:
."II)l1I1I:

nepooii or:

OIa OlW7

oro1l177
CJDJJ>IO IIX "
()mDJm: ;

Ollll~l"""'l
~1 JIII c()/juy ll?

C-4rtUUP

t)- .u.5t

-mel"1epb - .
o-4- 4'L
bt 1"10 01lU.C4rtU-;

u.W<

t) u.u,@.

73

-u

no,a6omamb


, .

,
,

Ireeu lIDJU II8UIIQ.U - 6eue .....

P~amy lIt1OpJO lIUIIQeI ~ 1IJ'IIIDtJIaaa.

$_POST.

VII:

~ .'\!u.il

.'\! cu,e.apu.il

rt.r: ;;..'\! "'\!


?dJu.kbtx d...bix cpopbL.
:%)0 .u.G\ . .U:VI\$t!
<form rnethod="post" action="'report.php">
<label for=" firstm">: </label>
<input type="text" id="firstname" name="firstname" /><br />
<label for="lastname'" >: </ label>
<input type="text" id=" !astnarne" =" lastname" /><br />
<label for= " email">Bam :</ll>
<input type="text" id=" email =" email" /><br />
<label fr="whithd" > r ? </ ll>
<input type="text" id=" whenithappend" =" whenithappend"
<label for="how!ong">KaK ?</ll>
<input type='"text id='" howlong'" ='" howlong'" /><br />
<label fr="hwm"> ?</ll>
<input type='"text'" id=" howmany" =" howmany" /><br />
<label for=" lidsriti"> : </ label>
<input type="text'" id='" aliendescription'" =" aliendescription" siz="'2"
<label fr="whtthdid'"> :? </ ll>
/>
<input type=Htext" id="whattheydid" narne="'whattheydid"
<label fr=fgsttd"'> " ?'(~.t, l>
H
"/>
<input id=" fangspotted" name=" fangspotted
type=H
<input id=" fangspotted" =" fangspotted" type='"r""ir' "~~" '''F'=
<img src="fang. jpg" width="lOO" height=H17S"
lf

lt='"

.. (iI')PU1 >
/>

1(d..:>I<:90;;'0 1')0

4 .btx bt

. >

)I.'\! )

<label for=" other'" > : < / labe 1 >


<textarea id='" other'" =" other /></t extarea ><br />
<input type="sabmit'" vlu="' " narne=Hsubmit" />
</forrn>
</ body>
</ html>
H

. '\!jt)d.
1{

'I'r,\.. G\..bt.

u. .

- , ,

reporthlml

$what_they_did

:
.

74

$narne, $how_rnany,

$other.
$name ,

iiIUa

. -

~, -,
... ,

- -.-.........'
~....;,, .

-.,..w.WIIIII\IJI.D-~,,,,,,,,

.1IOOpe upownoro roa OI'C)'rotWOIIaIa C'IC. 11 'I8C08.

:: l8.:fII&C C.ICRC 1fC.iCI

ICocll'let opllJlleJl1oW OOllrau IIfll - 6fllf 101Ill

""" :ra?er
.1~Jlygrten.COl

...... 3IISI'JIOfIOII UO'I1':

: _ opoi.

D _ . oro roa. orcytC1.1I088I teatllO 11 ......

oecrao -1lpIICIIWIO:

"""*""""

0m0rreJIX:--
1_:~.,g.:ro-""""

~ t}.3 0 d"Yf\. I-l ."Yf\

l!6a ... ...., oou:y ?

~opw!.u: iJoDJlyiicrl, roocyre ......


oi om.r. alfD@lheyIeallygROII.com

&>Jbz 3 .I-lLt5l .

~I.t t} "Yf\. t-lLt5l,


olr\ . t}u."Yf\.
3.91-l, Zd !. :i9
qocblJa"Yf\b ~I-l~ ~l-lU
!", l\tl\I-lDU t}"Yf\.

, ,
$arn, ,

- .

echo

'

ech o

'

echo '

. < r

1> ';

' . $when_it_happened;

'

echo

' :

echo

' ?

echo

'

. $how_long .

'<br 1> ';

' . $alien_description . ' <br 1> ';

' . $fang_spotted . ' <br 1>';

'

. $emai l;

75

-uu

~u u

, .

,
,

.
$_.

otu'leeQeIlp......... 1IOUIU IIWI-C8O&Q_.~


cnJp lICIJUUeao 1COC-"1I\IIDe.O1WO:
-.

JlllJ':

<form method="post" act i on="report.php">


<label for='" firstname '" > : </ label>
<inpu t type= "tex t" id= . . firs tname" name= "firstname '" /><br />
<label for::'"lastname" >: </ label>
< iut type="text" i d=" lastname'" =" lastname'" /><br />
<label fr="mil"> :</ll>
<i nput type="text" i d=" email =" email" I><br 1>
<label fr="whithd">r ?</ ll>
<input type= " text" id= * whenittlappend" =" whenithappend"
< label fOI'="howlong ">KaK ?</ l l>
<i nput type="text" id= " howlong ='" howlong" /><br 1>
<label fr="hwm"> ?</ll>
N

<input type="text"
id="' iti">
ht>ll" =" :</
howmany"
I><br />
"1~~~~~~!,'1!1~1!1!1!1!1!1!1!1!1!!!I1!.
<label
for=" l i dSI
l l >
<input type="text'" id=" aliendescription" =" al i endescription'" s i z="2" / ><br
<labe l fr="whtthdid" > ?</ll>
.
.
<input type="text" id="'whattheydid" name =" whattheydid"
/><br />
<label fr ="fgs ttd"> '''""J'''' l
}(.. t).
<i nput id=" fan gspo tted " =" fgsttd" type="
/>
<input id=" fangspotted" = " fangspot ted'" type="
'V;'l ",~="n,o"/><br />
. btx
<img s r c =' fang .jpg' width='lOO' height='175'

(illput >

cpOpMbt.

lt=" n .

.">

<l abel f or =N ot her" > :</ l l>


<texta r ea id=" other " =" other " I></textarea><br />
<input type =" sabmit" vlu='" n" name='"submi t" />
</ form >
</body>
</ html >

..u."YI\ )

. "YI\ll.

"!)Uft\ ..bt

u tl.

-, ,
: $name, $how_many,

report.hlml

76

~Ol)
li.

$what_they_did $other.

"Yr1 .:m,

: $name ,

5(

",

cfX\MWJu.u.

. -
, -,

,

.

((ecnetne .,._ IOIIIJ\Ieu - cteaoIe 88ll

R~ te<IIIIe 11 """"".
I

____

__

Omnme:

CIIacol_opw
I_ 81111 t1pOlDJIOtO _

WJIII_ 81t011C1pe IIPOIIIJIOI'O I'OJII R arcyIt't8OIUH 8 _ . 11 _08.


OtIW"'" : -eaat,,,,IlC'4
... ""'" oouy tmt? or
..., IIC8:IpOtDIOI """"': alfu@thcytallygrocJLCOIII

OR_: =::-.t:"~

t)jct'Yf\ I-le u.ee'Yf\

. NOIO cou:y ora? ...


onOJ1ll)eJl>llU :aopauIII: o>cayiicnt, rIIJIOOYihe I ......

. j.d l-

amI/CC.-rpo- ~.""",

C'Yf\pctl-upt "'Yf\:I-,

'Yf\ . t).du'Yf\..

\1o.3l-l., .ct .bt. d'jgeM

"ocbVJct'Yf\b I-l 1,l-.


\10 'Yf\.. u. \10'\..
, , .

< br 1> t)OMozcte.

$arn, , rh<:\......
-

g,

'yf\

"IUPO ct.u.U
u\.,/<:\u,u.U I-le. jctdbt.ctu'Yf\e, m

.lGIljYl1

echo ' . <br 1> ' ;

/IIbt

~f\u .

echo .

Jol4..CI e.cho

30 t)I-'Yf\..u
~<:\u,u.U

'11

KctK~ echo

L-l<YI1YI1ct.

:.-J:>CI ollepctYl\Op
::""-, ct

.. :!")'Yf\..
: u..l-lUSl Mec'Yf\e
:1r,POK Yl\eKc'Yf\d.
.. ~..bt.x.

~ I

UIlj.

. $when_it_happened; j

. $how_long .

'<

HTML.

1> ' ;

~~~ .~~.~~~.~~ .~..~~~?'.:. ~h?~-:7'!!\.<:'!1~:..' .~ .~~ .....;.. ............ ........... ................


echo

' :

'

. $alien_description . ' <br 1> ';

..~~~.'~.<?~~..9~~. ~ ~.:.~~~.7.~.~~-:7~. :.'.~.~~/?.'.;...........................


echo

'

..~...~ .... ~I)~~~"!')~~~~. ~~?p~~::


echo

'

' . $fang_spotted . ' <br 1> ';

.'..?~#)~~.: . ~~. ~.~. {~:: .............. ......... ... .

' . $email;

l ~

77

- -u

-
, .
report . php, ,

HTML.

-, report. html

. ~

5bj~a.e't1t.

gVl1bJX ffi Ol1focoffi

': , ': , - HTML


, ?

: Bo-bl, bl,

<<

( . )

(SS?

, -

. , bl

. ,

- ,

KOMaHAbl echo,

HTML-KOAOM. BbI

< ? php ? > .

':

() ,

HTML, .

': , ,

- L/(SS-. ?

: .

, bl bI

bl . , ,
,
, .

': PHP- ?

: e c ho.

bl , bl

e c ho

< ?php ? >.


U55-. bl
,

HTML-KOA ,
echo, bl

: , -.

-bl.

HTML-KOA,

report . php, <br / >

. -

, bl

78

HTML- 55-.

HTML.

~~-mr+1 flm&er>w
eJ emm .Um, 1'10

w t1 rwm&em t1

etitl. , m +1t1
mr&w tl ~mrtltlu m.

epecn
:erpooii .

,
~
.

,
.

42U

ed- c 'fl1pd..u.u,e
110)t~.u...

'fl10 l('fI1.

t)UCbMO J.u.)t

11 .

: .
:
.

)td.)tubt. )teI(C)t

? .

u d..bte ..bt.

: , .
-

,
: , , .

,
- .

79

, ~>,)
() .

,
,
.

' m:

' .

1.1.1.~~II'I;tllj . ' ?'

tlllt.[~r

' ? ' . li~,~llllill.j~I! .

'

'

m :

'

: ' .

._

- .3d.dbtd.UlJ:

...........

d. d.51 \d.51

G..u.lJ ClJ OJ<)'

-, .

lJeKClJd., u...,

- ,
. ,
, (

!.. d.u.
11 u. .u. ,

) ( ),

, .

, -.

~1

' m: ' . il~~~I

g gy uu KopomUMu.

HeosXoguMO

sg ocmocm

npegeuu ..

Kyga

ycaHOBUffib

gnum gumu

80

npu

-() ()17ui()

i()u . 110 "? ViJ.\r


u17u u U r
nUCbMO ,ru nu
.IUu ?

. , PHP- ,

ero

HTML,

-. .
,
,

HTML.

11 .

: :


? :
, ~.

- - Of "1'\ .. , Y"rrjo

. tlpe9.lloM2dJ1 liU:)'f)

f1 I{d,"1'\1s' l("1'\ I-ll-l20

.&!Ol.G11t,

ZVl1blX ffi ol1focoffi

~: 0
-L :l ,

113 -?

: . ,
'. content type ( )
;; .

Ilu.cbfi\d, t)u..u.u.

l{..u.u...u. lifu.U,d.u.!

~~~

11,~~

,

?

: L-.

81

...

~-neg5\.ocmu
u8t1\C9

cu.o. <cpamag

L-,

<br / >

s-
( )

'\n'.

8oas epma

(\).

,
.

$msg =

. '

'\r,' u.I10.'ll) 1I1o~o, YrI!.


C'll)d.u.'II)b tJ.ft\ .oo C'II)POKU.
'll)e/{c'll) ~'II)..~ r,U.Cbd..

$when_it_happened . ' ' . $how_long . '.

' np :
'

m:

' ?' . $what_they_did


' ?

' . $how_many .

'\'

$alien_description

,I}

' . $fang_spotted . '

' :

~.
~

'.

' . $other;

~
11 ~ :

~ :

@ ?
~ \

~Mec't\o 't\o~o "Yr\bt


t),u.'t\ C't\POK~,

?~ : ,
.

Ife

.GJ.1h.

'\11' t)'t\$t
't\e/{c't\e
- - - - - Kd.K dbt..

ZV11blX ffi 011focoffi

'F: s-?

ll":'l't.'t\
u..

: s- ( )
, (

) .
, , s-

HTML,

, : &#169; &; .
s- : ,

82

(\ ") ,

, (\).

(\ '),

ill

6 ,

, -,
, . (\)
, ,

.1 . ,
,

(\ )

, ,
, .

. ,
, !> , ,

, .
, , .

,
, .

Smsg

$am

"

"

$when_it_happened

$hw_m\

J( 0.1\ e!-i4u,u.u' 01\ l"\d..9d 1\,


1\ t)epemeHJ-lbt.
.'jI bt.1\ cI.J .1.
Lt).'I\.. 1\e.KC'I\e,

" ? $wht_th_did\~ u. LOo

C'I\POKu' "yy\el"'lepb

o.p..alU.. Ci.1.u'

U,L1\tJ"\U,1\5{
"

$thr

~ cdJ/IoM, KOLu,e Le'l\ Ldu.'I\u'


cmctu''I\b Lt LoO 1\I
"I\a~< Kcl.K 71\ i\L5{5{ 1\cI.

7'I\.. I')u,cbo.,

l\du.Ld.. d5{

\
.
.

dLt1\ ot)epo.u,u.u,

$li_dsriti\

" ? $fg_sttd\ .

$how long
~

d~bt.cl.u'.

!-i4 ce. paLO

.bl.. dbt.d.

L.Lt dl"'l.u''I\
d.LU, !-i4 L

1fG ~OlG1h.

CO~u'Le...bt.x Me.~y

Zv11 fl. 011P OCOfl.


V
jcJ
1
'1)

C'I\f>OI<' 'l\dbt.
dbt. ~L. u''I\d1\.

~: , ~: , \ ' ,
?

\ . ,

: , ,

, ,

, rr ?

\'

\ \.

,
.

83


, ,

, :

. ,
.

().

~A-:9pec
1'I\ .

t)o'hr,bi 4.
,
- .

,-m, .)!) dbt"rY}b

,-m, ct.

)!) r,lY).

."rY}.

"rY}.KClY)d..

7Ino d'. .lY)..~


t10lY)i.1t , KO'i'l\0pbLu.
lY)d. .lY) dbLlY)b
ClY)FOKOCi t1lY)- lY)e.KClY)d..

t)o'hr,bi
11 0 .lY)U"rY}..

Cd.U)!)d.,
KO)!)opbLu
\..

g t)e.peMeMoU
$."rY}d.i).

: alfn@theyreallygreen.com

()IllLe".~~~iillt'

2009 r 11 '54'00 GMH2:00


: 5
. , '

: owen@aliensabductedme.com .
.. .... .......................... ..
"........
"
ocycoan 11 .
An Xl1
nuwe'

on

F"

.'

we.

en

? an

' ron .
,

I: d.. C"rY}pOKY
4.u.. )!).. I1cbd.,
)!)d.' t)plA.Ceoe.L1. t)..... $)!)s.

,
, .

, ,

<\ !> ... , , - , !

84

z 1


$msg,

KOMY~ < KOO~.

.l ,

I KOO~
3email , , .

$i1

,
: alfn@theyreallygreen.com

ecltll en"
elUl
, ""
11'54'00 GMT+2:00
: 5 2009 , . '

: owen@8Iiensabductedme .com

'

n poworo

- II":-

-.. .. ..

..
roa 0C'fC'I1'088" '!e8tI1I8 11

et'f KOC~ ~: M~ enoe

b8ll ane bCll onac1


lO ? OII8W
1
r ? er

. uU ro .
, . -.

en .

I
I

,
I

" : $how_many\n"

" :

$alien_description\n"

" ? $what_they_did\n"
" ? $fang_spotted\n" .

" : $other";

u..cii.J,l.t.

(01'8')1(8111'8 ll8r ".

'l!j..>1..0~

. . T8111t& all8anpoHHoro "8. I")t.A.Cbci. 'd.4


u. ZO'l!jO{d.
------~.A.
O'l!jt"\pd.gKe'

-v 'l' 0'l''8'II. ( KOfO).


8 ll81t'1'II "014"'" "Il"1'll. {).
, ~

85


, -,

. -

mail ( ),

, ,
.

.
_
~~U
,J M\I "~
\i"'lY\;;" J '. 'f

mai1( )

omnpaAget1l

\ m...z.

V~ r'jlJ.cbm.
mail($to, $subject, $msg);

PHP-q>ylJU9

nUCbO

cueapU9.

~ .4.u. I'I)..
lliJ.cbMd.


i 1 ( ) ,

~~Ci
t)otrbt -1tdgu.-.,

, .
mail () ,

d.l- d cpyt-U<u,u.u.
-n\di~(), Jd~lO

mai 1 ( ) ,

lO t"\-d-
'fr-: '.

. KOO~

<iFrom : ~.

lldgd g d~g

~
~

mail($to, $subject, $msg, 'From:'

. $email);

~
1-

Ot)ePdl'l)0P <I'I)d
' - - - t)I'I) u.t)J)1'j
5/.. j(dl'l);,u

$t

gd r' ~pecd

;:::, .' wen@q-.!iensabductedme . com ';

$aubject =

' npn - :' ;

. n ;
?

:.

..

$msg '" $ Q $when_i t_happene


- w ;

" ?

)1'j. t)Yi)bL

8bl~OlG'fh,

'9: -

$aliefLdescription \ n" .

$what_they_did\ n" .

$fang_spotted\n .

. ;

JfG

Z4fl1blX /c>Ol1fOCO/c>

$howJ1\any\n .

$other" ;

: .
,

.

l<Pd.u.pO~dl'l)b u.gbt
I

..
J

Jct ~P\lZu.
J
31'1)0 tlpd u.bt. ct)OCod.
"

!. IJ.\l.3 gLi.bt. dbtI..t,

86

' :

''

':

'

From: '.

,
,


, :

~uFrom :

$from

U\ r\nCe

'I!1dK KdK tliJ.JI.\.. d.u.dbt


\J.d-l-u. \r u. \~ .
_ _ _ _ _ _- - - - '

l u

un;&m UIO mailO


nraKmUKe~

()

. . , ",
........ mailO.

, mai 1 ( ) , - ,
, . ,
, ,

, .
report . php,
mail ().

<html>
<head>
<titl>
</head>

<bod~~
<

</tit l >

V\"i!\

> -

</h2>

. . " .I-e mopI ~~


.. 1-

ruJv

1:

~ u..3 )oICCu.~a $_?$

<?php

$name = $_POST [ , firstname ' )


"
$ POST [ '1
$when "t h
". astname');
_~ _ appened = $_POST [ 'wheni
thappened' ) ;
$how_long = $_ POST['howl ong ' );
$howJlany = $_POST [ 'howmany' ) ;
$al~en_description = $_POST[ 'ali end escription')')/d
$whacthey_ d id = $_ POST( ' whattheydid ' ) ;
$fang_ spotted = $_ POST [ 'fangspotted' ) ;
$ema~l = $_POST[ ' email ' );
$whaCthey_ did = $_POST[ ' WhattheYdiY');
$other = $_ POST( 'other');

I\Pu.ceau.ae"i!\
ux
10
.,1- ..
u.1-}u.~u.:9\1~'\

U.

!)epeMe.bL.
":J

,u:m ~ "Yr\oJA, 'm


b!. 3ct.u. aa~c

l<"Yr\..u-wu- t")O~

$to

'owen@aliensabductedme. ' ;

$SUbJ:C:

$msg _

' m Q

$name

$when it ha

~
' m~- p$hPene

O"i!\!)paKa

bt. .. COu.,
t") "Yr\eM l<al<_"Yr\ec"Yr\u.poea"Yr\b
"Yr\"Yr\ cu,e.a.pu.u.
-
';

$how_l ong.\n

:
ow many\n
: $alien=description \n'
? $what_ they_ did\n' "
"
$fang_ spotted\n' .

"i!\I-U'tz.

: ?

l\u.cb.C..

~~.";;:'''Q' "al ' ~Qtbf>r""

~~$t~:

' .
$subJect, $msg , 'From:

' .

l\."i!\

~"i!\.9bt. "Yr\u.

$emaj)

l<"i!\..u-wz.
t")u.cbh. t")e "Yr\eM
ez.o

O"i!\IiPa~u."i!\b
I

echo
<br 1>';
echo : ' . $when_ it_ happenedi
echo ,
. $how_ long " '<br 1> "
echo npm"
$
'
' : . $alien_descriptio~ . : <brO~;~~nY . ' <hr /> ' ;

'

: ?

$what_ they_ did . ' <br /> ';


' . $fang_ spotted
echo , : ' . $other . ' <hr /> ' ;

: '
$email,"
echo
echo

..

, ?

'<br 1> ';

?>
</body>

</html>

87

-
w

ero.

($to, $subject $msg), report . php,


mai 1 ( ) . , $to
, . -,

. !>,
.
.

..bt.e bt
,ll.

().1\u.r. Clt
{ 'Yl1tl.bt u.

Ibtr:

... _~""",,:

() .. .

orna..,...,....,.....,7

rlu. cbo..

~.''" O'1'tyttDO.at1
8lD:lWt01D.6,,1?
fUU,lUlC:

,emL1M ).$1.8'~

8J111C11M !I' ... JO ra7

, ,

BaweM

-, ,
.

il

()

m,

,
n.
WWIN. php.

net Imai 1

88

CcJ.u. bt!,

.d.

. ,

, - ,

~ lIu..ct.

, . ,

Ai)pu.dyYr1 d,ctiot) i)e,c!,


<fori) > Jd,t)~ci(d,ei)

- ............iiiIiiiit,CcJ.u. .3dIl fW..}1d,

~~~:"'_-:::"_.-.d:)k~~f~;~du.d.

~~.~ ~?~~: ~
::::=~'::._, ~-=--.z,..

~..,..."..--- ...

..

r<-f-o-rm-a-ct-i-o-n-

"report.php"

;~;=::':~;~~~K
~P'

\t .

"""""--

....

~=::: ~~.----.--I

=:.-==~..,...c

=:-,..::--..:::;....-..
..... ~--.-'

=::-:.:.~':

m m!

l!\uu
nUI!\!1U, nruu

mru nm, ,

m () ,mr.

-,l{d,u.

i)d,j(

cOJ.9d,ei)

i) ..
t)U.CbMo

u. i)t)r~g5(i)
.

89

nQ n

e
, , . ,

. ,
. ,
.
.

----~

----

........ -.-..--"':
"._o _~

( _ .. w.!

-~

.,...----.~

..

_..,~

' -.......1

,--

~~:;;;::]

:,;;;;,,;,:..

.-,:: ::~

-~
9Jo_"IOIC_'

. 0......:.:
_ _ c-'

....... ....

f...- "'''--..:;

.I

m n"O)(o."f7;,rflfll-iUm
Ike 3mu "mr n!

)( kakou-m n

ru.lam 3mUM
morva, Korva )3)(. m
)( )(raUmb )( &n
Mecme, m m"U.

.
I

111

.. ...I

90

,,

..
t

?
,

tHML

HTML-

- , .

-
-,
-.

Plfr

, ,
L-.

, -

- .
-, ,

POSTi>.

, ,
.

, .

-,
-.

uho

-, .
, -,
.

-, .

c:r-Cf \fa,jf
~1tfCMGlflfa,jf)

, -
.

,
.

8l ~

91

?
,

HTML-

, .

-,
-.
, ,
L-.

, -
- .
-, ,
~POST.
, ,
.

, .

-,

-.

-, .
, -,
.

,
.
-, .
, -
.

,
.

92

n 6

MySQL

, .
- . 8r
,

...

93

-+

2 8,lftlf,t tr4Jt1L

tl 8te , torntltye'tll -.t060


 u> 10UlOum

UHmf.j?lIJwyuo [,
wuum

urym.

, .
-, .
.
, ,

. ,
.

MySQL .

- ,

-------

, .

95

, n lm

xopowo.

- 60

'~

xopowo ...

HO&bIU cwarUU t'aOomaem

.,

[w

I ,

.....

xoroulO, m nm (UU!

~'
,I

mr nUCe. cory nt'um


m KotpWHa, m r3t'm
tom &.

1,

..

l' I

.\

"
~

n
. n , n HeMHoro
, n n n
nw n - n nw
Toro, .
.

, II ,
.

,
... ll

, ,
, ,

"'/l10
t']!'l')f-(f-(

ll.ctu.

I') cex
du.U
!l u.ux,

1') U.tct)OUJ,UX

4 !l'!\bt u.
-., 1( .u,
.U, t)u.1\
ezo 1\u.

011110

-I'st "!
", -
' sa\\y@9regs ~ .
\IIen nJ(IIaJ111

:II ""

... .

t)lJ.Ll.1,.u.u.

010\2.: "',,
2008 r. 12:11:29 ".
Aata: 1 llII. abductedme.c:om
Kolo\Y: owen@a\lenS
... .

II 3 !\

.)111 u..
.

Konl\'l"'" \j6CIIX llen.


nIIl\ll KOCMII? ~~I'~~::"::_r ?

nOl\llen!\ pIoI

"'/110, -'t'Yj0

.. ll 1 .

IIl)!CyCl1!OeaJ1

anll........an
1\IIKOCI\'l8C
6bl KII)( llen~:. : ',,:ebI::~wes:~~~l~-:10 01111 ennIl .

u.u.

nJ(lIll llll

~.

.._------\1

<:l.l<. ~u.u..

) \ Fd.j
)j<:I u..u,u..,

)l(l!8Cb .

ena )' cr!JaVl/,

!'!')\ ..

all!l: 03OII, !\

tA.l>"\d. ..

Kpa..e~o

l1 jd. u.

0"'/11 bu)u."'/I10. .

. .tA., '!\bL

!l.9 0 .bt.

"'/l10., d...u. 0.9. \-ld.rw .1\,

. !. . MO~ !-UJ.}Ad1\. Ilpocct"'/l1pu.d."'/I1b \,


"'/l1u. ct . "'/I1e, g K0"'/l10Pbt.x: ll.u.."'/l1. , 'II\ -..
bt jd.e ..

96

MySQL ...

,"," ', " !h ',"?- J

.. j.~)! ; jv\iZu.. ro.

t)u.,3D"'/I1

M\/SQ.L

. Q--I{)-~.

MySQL

MySQL -

,
. , -
, ,

. ,

, , .
,
. MySQL.

, ;

SQL.

Mv::;(}L

,J

-, ,

gabte

ma

Be-cepep OdPC\d~i'f\b!gC\e)\') 3C\tlpoc

\.3 \ !)-i.t..l d-"\fCl.t..ltJ,bt.,

L,Ki'f\eptlF,ei'f\u.pye)\') -cu,e.a.pu.u
u,

~.

C\..L4.e

& MySQL

)\')t)\.)\') HTML-"\"YI'\.
...

U1,JaX

~~S:;:ct:~:::rt':.~ ~~ d: !. )

MySQL ,

() ,

. -
,
, .

Cepep \.} .9\!.

/JI.\\iSQL )\')

\"\

()-to

. .d.)

IIGI'!\d..l'!\
U.3 . .IjI\~

d.u. kd .I'!\
u..

~ \ d.btx .l'!\
dbt.l'!\b .~Yri

d.,3u'.btx )\')\ u.u,.

d.i'f\ .)\,)

\,3u''-J.btx \.} 9\..btx.

. ......

::;(}L
-
S131 .

uCnOAb3yebtU

gASl
,

MySQL,

, ,
!> . , ,

SQL- J.

uqpuuu
U 1.

My::;(}L.
ebl >

97

MySQL

6 6

MySQL

, : MySQL - ,
.

report . php ,

, .

, ,

MySQL MySQL
.
, -

Cogue
ga.V\ My~

mpesyem osea
uqpueU

~\

gaHHblx.

SQL.

.::; .du..
Lt.~.~Q.

I1POzp4MMi-lo

dl1.u... ~ob!.
3d.Yl1 43
:ld.1-t.I-t.btx /m4dLtu,,
~ "f5 1\ . "l!'\

Xpa.u.~b .u5t

!')Lt..u.x
Ltu..Lt

11 Ltu,o.u.,

~1~~L~~.'lY\u.. phpMyAdmin - "


f~tju..Cd.rt Kd. ?,

,.

~pMyAd1Y\ill )1\ .fd.Lt45t


yvnULt1\4,

1l 05trolJJ,45t
\10 3 0 41\-ro

3441\
43Y94~

Lt 1\4u..$ ,3
d--l1\ fu..,

MySQL -

phpMyAdmin.

SQL ,
, . ., phpMyAdmin
, - <1
. phpMyAdmin
MySQL-, MySQL-
MySQL-.

98

82

MySQL

ll ycaHoneH

MySQL,

lO .
!

MySQL
-

, .

11 , .
MySQL,
MySQL.

, .
, : , .

D MySQL- (IP-apec JDf ): .................................... .


D llX: ....... .. .............. .... ... ... ......... ...
D : ........ ............................... .. ....
u /: r,, fr}
0<=

\J-tQ5I. K.u.zC\ t)ot)~eYf\

)3d. .eox0.9Uo

t)xu , .

J\1l 0.5l.UYf\ .7Yf\Y Cr,POKY.

.7Yf\O IIpOeepUYf\b,

MySQL ,

, .

, , MySQL-.

~
l3CI
't\\'t\.

oYf\MeYf\u.Yf\b
Yf\
.9.

t)o..,u.u,u.)O.

D MySQL-, MySQL-.
D MySQL-, phpMyAdmin.
D MySQL-, ... ................. ...... ...
~

u. gbt w.u. K6.ky)'O-t-W. z.)


ymu.u.'t\ MySQ.L. btll51.)OI..U\j) .7Yf\u.
3.96.u., .36.I'\u.Ulu.Yf\e ).96..

8iJ ~

99

oam"blX u

MySQL

6 6

MySQL

MySQL .

, , SQL- CREATE DATABASE MySQL-.


MySQL- . mysql

Windows

!.

MySQL: mysql>.

CREATE DATABASE aliendatabase; :

.ct 1. \j:'1\
""!\"', k.d
, ,
. :

C""!Y\d(Sb""!y\e ""!\j

jdlI""!\U

USE aliendatabase;

mysql> USE aliendatabase;

aHH~

SQL- ,
, .
SQL-, :

%W',.m!,W.II~
~~

:71\ SQL-3dI"\ _
\-ld 3dUJ. Koeou

'aliens_abduction'
-Vn4v.l.t,
'first_name' VARCHAR(30) ,
'last_name' VARCHAR(30) ,
oCYl1cV1brloe ""'wh_it_hd' varchar(30) ,
'hw_lg' VARCHAR(30) ,
Yrj v..JA.d.iJ,u.
'how_many' VARCHAR(30) ,
"rY!, ct.bL
'alien_description' VARCHAR(lOO) ,
4 'lY\) ::l3J1
'what_they_did' VARCHAR(lOO) ,
<.l5{'Yrj5{ ~ 'Yrj
'fang_spotted' VARCHAR(lO) ,
YrjG\v.v1.
'other' VARCHAR(lOO) ,

.email .VRR(50)~.lnd.~.lY\i-tbL J4llfocbt,

); ~
ggu.bt ;' fJ'\ySQL.-'IY\v.!{d~
~ L"'L 344 .\J.d'lY\ 'lY\O'4KOU
G

100

3dtt""!\..

(S

\-1

ct:90. JdllfoCd.

MySQL
, CREATE TABLE
MySQL- ( -

www.headfirstlab.com/books /hfphp).
aliens_abduction.

Ch!)e"Yl\ cepepa

MySQL Q.uery
(3aI"1POC
..

jl"\.)

~ooPu."YI\ a
"YI\ 'vr\

"YI\du.u,a dbl.a

COjqdct "

11 . -----:

MySQL -
phpMyAdmin,

. hdmi-


SQL- ,
MySQL-. ,

phpMyAdmin,

, MySQL-.

S-r: gjJ IOcaIItost ~ DatabaSe:

i!P "lIendatabe

~~1 ~ i ~~ ]iSe.tI:!I I~QtliVll ~O}iiatI-l


CREATE TJI..LE 'aliens_abduction'

firstJ1ame'

VARCAR(30).

'last name' VRR(),

'when=it_happened' vrhr().

IslJendatabase

.::J

'how_long' VARRt} .
'howJf\any' VRCAR(30) .
'alien_description' VARCAR{lOO).

'what=-they_did' VARCHAR(lOi ,

l3bt 1} 1}u.
~dU "ctIlPOC,

b!. ,uu.

MySQ.L-1}u...

1} .U1}
K.ol"1KY

( ,1}), 'vr\dbt.
"Qt) dbtJi btt)...

@! Show II\~ qUe!Y here lij)aJII

or
~ of .tom_1Itr.
.,,_.----=>... . , 8rowse ... ) (: 8,19Zl(8)

SQ. L-.3al) POCd

COmPreSSIOO:

@)AutocIe\ecI Non8 O ~

CIIarac:!et $8tof It\e :! ut18

,,

.::J

.u.- 'rrt

.t)- "rr\dbt

btIlI'tU- e~o.
, SQL- di
SQL- ,
MySQL-.

101

INSERT

1'"en, KOf"Qa
"Q Umu,
~~ecmu ~ HUX C~OU "QaHHbIe:?

n.

TOrO ll,

ll

INSERT.

SQL

. ,
,

, ,
INSERT.

d.
.)(YV!J
u.e~

")d..bt.x

3dt1?OC
W.!. u.1\.

)'-Ibtx
I~SIT
I~TO.

,
, .
, .

102

MySQL

INSERT

, INSERT

aliens_abduction.

n6,

7n,o u.st 'VI'}dUu,bt,


V\eM UX l-lO
.
6m
KO'Vl'}0pJ)O dJJffl
~ CljucKe, )... ~; nmmnR,
d..bt. .bt. 7n,o
.. Orw. '!\.9.bt
~ muuma6u.
' u.st dCIJbt. ..!..
. O"i\ . l"l51"i\IJtU.
: 0

aliens_abduction (first_name, last_name,

when_it_happened, how_long, how_many, alien_description,

what_the_di~ fang_Sp~ted, othei email)


('',

'',

' ',

'3

',

'1

' i

'',

' 6'

' ', ' i, , /t'


( 'll@

IhnoP<?u

_ _

gregs-

1.

~st

CIlUCOK

4~.u. cl..bt.x

cex . l().
I(du. O.u. "II'IaJ(

"I!'I.bt. J.

0'Yl1 9p:-J. .3Il'Yl1bt.u..

.net

,)

()

' KOI-ill,e. So.\..-JQI"l~.

C"i\poe~ ~ ~f-d

"i\ l"l51'Vl'}U.
\-Le

c"i\au"i\c51. .

C"i\au"i\c51 "i\ KOl-ill,


c """",o u.

~M"

VH\'-\(dl-bt.

3Qe':1O
)e(irn&urnQ
Heo~ Q

~ce 'Vl'}U 34.u..

()

O'Vl'}I-lO"ll'l
"II'IeKC"II'IooMJ

&rs:l~~u.lUU

I1I?UlJJ~
1-

"II'IUIlJ.IlO"ll'l.

O.u. Jd.).bt.
U4 .bt.

clgbt.~{u..

IOta6omllllb
l iens_abduction, ,

.
.

~o \J.eM
\-L .

- ,
, .

8 ~

103

u mm

~ u

aliens_abduction,

.
- , ,
.

3.bt wecl'r)b)()

.. \lPOCI'r)O \3Z0ctu.u.
u. I~U QI(U. "/

~\')<.V1bU,QMU..

aliens_ bduction
Cctu

3 .Q,3~ 1 .

Scl))@ r S -)isl.t)
~.3...., . u.

<&1.. ~

"\bt.

IfG 8J~rlG11t,

ZV11bJX ~011rOCO~

~: , ~: phpMyAdmin?
. ?

: , .

: 5QL- phpMyAdmin -

-,

My5QL. , -,

-,

, ,

. -

, .

. ,

t1)

. ,

- MySQL-?
?

. MySQL- -

phpMyAdmin

, ,

phpMyAdmin .

www.phpmyadrnin . net.

- ,

MySQL,
- MySQL--.

MySQL
. MySQL-

, , ,

MySQL-, phpMyAdmin.

, .

.
, , 05 .

: .
phpMyAdmin ,

My5QL-,

, ,

SQL-.

MySQL-

( -

).

. ,

11 ,

5QL

MySQL-.

, SQL-.
.

104

MySQL

--
R R
w w
SQL- INSERT.
MySQL-, MySQL- ,

SQL phpMyAdmin,

INSERT

INSERT

INSERT INTO aliens_abduction (first_name, last_name,

VALUES

('',

'
'',

'',

'3

',

',

',

'1

',

'',

'
,

',

',

'sal1y@gregs-1ist.net')

~ .J.1\G\i1! u.t"]..LI.5!.

JG\l1pocG\

, ,

INSERT

MySQL-1\r,u.
1\\u.~ d.~iet"]s_C\bduct\otl

INSERT .

dbt.d. .90dd.g .94 C"tl1fOKd..

, h ~

105

SELECT

SELECT,

J J

, ,

. ,
. SELECT - ,
<;~ . , SELECT
.

3d }bt.

SELECT 'll\

SELEC cel.9ct 01}.u:~.


.'ll\.U 'll\ct~uu,,
ct . ce ~clJe .9 ct ..btx.

t).

.!(, .9ct..bt.e !(O'll\0pbtx

ctc
_

t d1} 3

li

SELECT
I<}2-0 ct fR.OM
ctli POCd

li'll\, 3 I(r.\.!( 'll\ctduu,bI.


3.9'111 bl.uct'll\ ct..bt. .
, ,

.
, .

SELECT

1 i ens_abduc t i :

3\\1

SOL
SELECT

uaem

gaHHble

u3

rnasU1.jbL

SELECT

u.3<::I1) .9d.bte
1} .3 1}d.uu,bt

<::I.Riel1s_d.bducfiOI1.

FROM aliens_abduction
INSERT ,
,

, . SELECT
:

u .3.3ct oooPU'll\

SELECI, 1} .du
u,3l<<::I'II\ ct..bl. cex

3<::1lipocy

!(.D!( 'II\<::I~Uu,bt. ~

SELECT * FROM aliens_abduction

106

l2

MySQL

--
,

IN5ERT

w ,

5ELEC.
INSERT, MySQL-,
aliens_abduction. ,
, .

SELECT * FROM aliens_abduction

~o I(J{lJ..

3cthpoc SILIC gflJ."'!)

110 ~li I-lXu.


~\j..bt d...bt.
. i"lee.

u.."'!)g} "'!)

~~~, Q.~
.f5 "'!)Qdu.u,.

107

, n
MySQL INSERT.

AaHHblX

MySQL SQL

. ,

SQL-

MySQL .

108

MySQL

MySQL

066
,

SQL

SQL, , J

. ,
SQL-

. c039ctel'lj SQl-,3ctt)

INSIRT KOI'Ij0Pbt.u. 901.6'.l'lj

, L-

MySQL.

ct..bt.

t)lAcbd.

, .

11.3 \..z

g dd3Y 3C\;-(1..

, SQL-, !

IOML-d. -..t'r\ ~

Yr\... liu.ebMO.
KOYfjOP0e. l\ocYfjyMeYfj

., 110 .
.90.. .'j)
ctu.Yfj

..

::::=-=--___ _

::';~,:='-

110.!-\.!-\.bt

(l!-\.!-\.bt dcIJJ
& :

SQL-

INSERT.

: -,
SQL-

INSERT,

Toro

.
<?php

Sdbc = mysqll_Connect ('data allens J:x1


'allensdatabase')
u uctedme ',
$

'owen'.

'allens r ool '

~r d~e .. (' MySQL- ' );

INSERT INQ aliens abducti


'
wheILit_ happend, how 10 - how ( lr~tJlame. lst_arn . " .
:what_ the_ did . fang_s;ott~d, ot~~Y ~~~~:-dsriti , " .
VALUES (' ' , ' '. '3
,,
'
" ' D '
, , 1 ' , ' ', " .
.. '', '. Ba~ ::~:~~:;:~:~: ~ ~

qu ry -

$res u lt. = mysql.l_query ( , $query)


or dle

l-cpop.o,
6'bt.3bt6'C1.eYfj
-cu,e..a.pu.u,
KOI'IjOpbtu d1.6'.l'lj
9C1.KH.bt.e cpOfMbt 6' dct3J'

('

' ,

.. .

sal1y@greg s -list . net')" ;

' ) ,

mysqli_close ($dc)
?>

PHP- u,..-:lJ (~ w, 3dl1POC

SIR. /{01\lOpbtCt ~d,.'YIl


9ctHboe bt g- Oc.IJ} ..
l)J~.

rte t)J..u.Jctw,

reportphp

:. ~Yr\/

.I10.Yfj,...J{,. .~ctYf\u..1

109

n n0 MYSQL


-
,


. ,
, , .

report . php

Gtnu.

coceM
.Q.

bto. t)xu.
1( . 1( U.

reporthtml

t) u..u,ctu..

110

\.

MySQL

report .
MySQL
, SQL- INSERT.

.usl 1l0u..u..x

d.)QYl\st "VI\d.6u,
d.~ieIlS_d.bdlActiOI"\ C"VI\POK

_,...../ d....bt.x (Jd.lilAceOJ.

,
, , .

. index . ,
.

Cepep . d...bt.x .7"V1\0 IlPOC"Vl\O IlPlpa..a,


Jd.Il~vJ,J-(Qst

~ cepepttoM

I(OMIi!;;)QYI\epe, btrw

Cu,e.o.plAu. illdex.f*'p d."Vl\

~"VI\, !\

d.J:i LJ.J "VI\d.LJ.(t.


d~ieliS_d.bdu.ctiOI) dd.Jbt "VI\dK, !\bt

e-cepep.

o..u. .u. dbt"Vl\b "Vl\.4"V1\LJ.d..bt


LJ. t'\OKd.Jdttbt 0y.7tty.

111
-.

8 ~

111

MY5QL

w 6 '!\.9 "'I1'\.u.I(~
-
MySQL, .
MySQL ,
MySQL-.

.ud.... d.
"'l1'\..~ I(Ild..u.. u.. d.

ed-.a.c"'l1'\ep 'jYYI9d."'I1'\ C\

!..AJIi\5l .7"'11'\ xoc"'l1'\d.. V., . d.LU

. ,

ed-cer,ep . M:ySQ.L-
J'"'l1'\d...bL .ct ~.9.OM . "'11'\0/1',

? ,

. I<OM"b/O"'l\er,e, fb!. ."'l1'\

, - . .

.Ict"'l1'\ I(d."'I1'\ .7"'11'\

.f-UJ. ~ocd.~hosi:.

MySQL- (I- )... .. .... .... ....... .. ..... ...... ,!

0 :

')

........ ...... .......... ......... ........... .

: ........ .... ............ ..... ... .. ... .. .. ....

/.-\5!. dG\,3bt. .9d...bt.x. I(O"Yr10pyro

b!.. ~d.. d... d.1:d.bd.se. ~u


"" ..
t)o I(d.KlJ.M-1\ d...u.7V \
b!.. .9d.\.I. coe dd.
.9d.I-tr\.bt.x .9 .i.-\5!. u.u

: .. ......... .. .... ..... ... ... .......... ....~ G\~\et)


MySQL-, ,

-
MySQL - .

u.. .t)J,3d.1I\
1l\g~)Q dd.JY.9d..b..x,

SQL-, ,

t)u....U"'l1'\ .7'1'f)O 1.JJv'5{..

MySQL-.

nd.pd.e"'fY1,pbt, l(01l\opbte

u\') 'l'f) bt. JIt.oc,'jYYI


01l\. d.1I\.

011\ 1I\e.x,
1(0'l\0pbte tioKC\3d..bt .u...

dd.Jbt
.9d Mbt.x -.d.)ie"q'G\1d.bd.se:
. ..do.9UJ.
,.ct

. oMe.Q
(A.<:po~.a. ,. u
'l'f)u dd.J
\..bt.x

<

dd.3d. d...bt.x

. 'IY1\d.up.,
/{01l\Opy)O

vt'v\. 'l'f)d..,bt
d.~ie.rls_C\6ductiOI") .

3d....

.90 'l\ex t]op. t)OKd. b!.. . .c.I.'l\


.ti30~\-I1'\ 50..\..- 3C\t)pocbL

b!. "(f\ '-I"'f\o


112

l2

. . .c.l.u.d.'l\ .

MySQL

-
MySQL- -
.
-. ,
. , , ,
. -. ,
,
:

3 bt dbL'tr\b 'tr\bL
Ilct~)}d.; MU, ct . :....

<?php
$

mysqli_connect .'

or die

(' MySQL-'); ~J.., b!. d:igeW\e ut) 3 0d.'tr\

~occt~host ~MecW\o ...


()
ct"" Mecl\ct
$query = "INSERT INTO aliens abduction (first last ". ue.u ""''''
"1
~'"
,
,
ctJ..u.. ctWeU dctJbt ct!-l.btx.
"when_it_happend, how_long, how_many, alien_description, "
"what_they_did, fang_spotted, other, email) .
"VALUES (' ',
"'
"'',

$result =

'.',

'3

',

',

',

'1

',

'',

" .

'
,

.',

',

" .

" . 'sally@gregs-list.net')";

F-----------~ ctU'tr\ 3d.I1POC INSERT


mysqli_query($dbc, $query)
ffu. c'tr\P0I{U PHP-ct. 3 3~\e

or die

L----_

('

');

..

.uctl\.bL

U\J ct.u

mysqli_close($dbc) ;
?>

oU.btX
U u.btX ctbt.
1\ct , KctK
U \)rd..u
I
\)r U \) .

, - ?

mysqli_connect()
mysqli_query ( )
.mysqli_close ()

113

- SQL-u

n PHP- n lii30 AiHHblX


-, ~

mysqli_connect () ,mysqli_query ()

MySQL:

msqli_ls

().

-, /
MySQL, mysql i_. ~

sqli_nnt()

MySQL,

,
,

mysqli_query()

MySQL,

MySQL.

6 AaHHbIX, n

mysqli_connect()

, ,

MySQL.

, .

SQL-.
SQL- .
, INSERT ,

aliens_abduction.

( -),

$query

( ) .

.3qt)poc J.9Q .

.9 c~pOl(oeo
l1 . $9 uery.

'-------=----~~
114

MySQL

n n nlt0

mysqlCqueryQ.

$query mysql i_query ()

al iens_abduct ion. mysql i_query ()


MySQL ,
,

(1), , ,

(2).

mQ ,'jl-U<u,u. btt).l!'\ Q 3Qf1 POC INSERT ~


4 .90~.u. .9tbtx "YI'\Qu.u,.

";.5...",,,

mysqli_query ( )

()

&m6u, mr

&!

n ycneWHO!

pne 63 a'IOIIlt3OIICI
, ,

mysqll_closeO.

mysql i_close ( ) MySQL ,

00

.
~o u.. ccbtJ1KU. 4 coe.9.e.u.e
daJou .9a.btx MySo..\...

$dbc = ilit~likJiiJI'_~ifil1i,,( 'data. aliensubductedrne. ',

'owen' , '

INSERr,

J"Yl'\Q"YI'\ btt)..u..
I<O"ll)opozo .9 .!.

"~;,~:t~~~~~.

<?PhP;J_ .2__
,..

m SQ.L-3QI1POC

u. Yr}-.u.d.9 f1ou.ge"ll) . "II)aK,

~dJlb.uu.u .9 "p0.pabt

.90g.})}. Q dc1J}
iensrool',

'aliensdatabase')

.: : die (' MySQL- ' );

t~~1 = "INSERT INTO aliens_abduction ( first_narne, last_name, " .


"when_it_happened, how_long, how_many, alien_description, " .
"what_the_did, fang_spotted, other, email) " .
"VALUES (' ',
" '

'',

'3

',

',

'1

',

' ' ,

'

"

',

" .

"' ~':;j'.~:i:::':{' ~a , ::~~~~~~;;~~~s~~qj~~9u.~r()

$r,,:~, d;~:::~~~':':npo " a~ ." !~:~:r":'~1:::r~~~~.

JIIbt
~i<k;!i".nr&tdl%~
_,!:m::.\!:="",}!!

JQl<fbt.'aeM

?>

.9t..u..

.9 :...
5 u.u.f !,\;..l ~l,
"II) 1<0.9

50.1.-, Q . 1ft .


- ,

mysqli_connect ( ) ...
~

115

Un308Qu MySQL

~ CoUllllallIH nOOUlIllO ysqICconncd(). ~

mysql i_connect ( ) ,

,
. , ,
,
MySQL-, .

""&lII ""POI(II }anpoc&

f ..nOAtlalllc }anpoc.a ,
IIMIi_1UuyO.

". lIalUII , noO\lllltO


117S11i_ cI.osc().

nooUllllO

6 .
,

. ,
,

MySQL

MySQL,
.

6 .
aliendatabase.
, , .
, ,

6 ( , .-

localhost).

. MySQL-.

localhost, ,

-. .
I- , ; , . . .

CJ>yuU9

,
MySQL-

mysqli_connect ()

/
~

mysqlcconnect< )

t)JU'fl) Yr1

t1eyeMeMYK> tl.u
d,JLA .bt.x Ot]ePdu,LAU ddj .9 a .bt.X.

$dbc = mysqli_connect('data.
aliensubductedme.com' ,
51
~ 'owen'

\ (5d'V!\.51.
1.
'
1
' - - dJft\i-llA.
~ , lensroo '
Q,3bt ClMbt.x

('aliendat~base');
/\..
'''----- ,>St \3'-

.9 C1 rt.bLx .

, .

116

$dbc,

paccapuaem 50

(u
n0Ab30ameA9

gA9

gaHHblX.

MySOL-cepepa u
usv .

noomOMY

uu

ux

MySQL

~ nmm
-,

"

. , ,
, .
, , .

$dbc = mysqli_connect('data.aliensubductedme.com',
'aliensdatabase') ;

'owen',

'aliensrool',

$dbc = mysqli_connect('data.aliensubductedme.com',
-aliensdatabase-)

'owen',

'aliensrool',

$fangisgone = mysqli_connect('data . aliensabductedme.com',


'aliendatabase');

'owen',

'aliensrool',

'owen',

$dbc

mysqli_connect('localhost',

$dbc

mysqli_connect( ' data . aliensabductedme . com',

'owen',

$dbc = mysqli_connect('data.aliensabductedme.com',
mysqli_select_db($dbc, 'aliendatabase');

'owen',

'aliensrool',

'aliendatabase');

'aliendatabase');

'aliensrool');

117

~ u
-,

"

. , ,

, .
, , .

$dbc = mysqli_ connect( ' data . aliensabductedme.com',


'aliendatabase ' ) ;

'owen',

' al i ensrool',

... ...... . ?:tnc;J...<im.p.~~c;J...~~m. f.~?C?m.c;J.!!\~:......... .. ...... .... ... ......... ... ................. ................... ..:.... ....... .

. . ~~~t~:~:~~:~~:~:i~?-~~~(1:~'ffI;6:~~~~:~;:3~~~;;~~~r~~::l~:
5l
: .u.

(t('data
; . aliensabductedme . com',

$dbc = mysqli_con
"aliendatabase "

u.Ijj~dku. u.x ~S(),L-jdt)rdX.

' owen' ,

' aliensrool ' ,

.~~: ~.1YJr9.~~. ~~ .~~.9.~m .~~?:-rnt;.\'(I)?',..t)~!1\~~~ .~9..~. ~~. ~.9t!-~~. ~!1\~Y!!\~!:,)~)'~!1\. !!\?~~~ .~. '~I).~~?~:.... .
.o~9.i;i.~~ .1:<~~i:'.t.~~~.~t))'9~~~~~,. ~~~..~.~. ~~~..l!-..<?.9\!-.~p.~~: ... ........ .. ..... ........ ....... ........... ..... ..
u.u..u< u.d'lf\u.. ::. 5l j.ctt-lU.5l

_--._~=--- t) ..i1 .u..t-lU.5l ddjou. dJ-tbtx.


~ngiSgO~= mysql i_connect('data . aliensabductedme . com',

'owen ' ,

' aliensrool',

' aliendatabase ' ) ;

............ rtJQ.~.9.'. p,<l.dQ"tI:\d.mb, m .'Q .u.JQ.Q. -,:\.. ~!,.l,WQ... .... .. .. ....... ........ ............. .
............ \J:t1:R.~i\~t1:9~. ~.,[]-?\.I.1.~f.~~~~!1. ~9?\J:~?~ ~. 9~9.~. ~~........................... .
.-- llpu. gu.u., 'h\o . ddj .9a..bt.x '!1d.g..
r--~-

t\.d

'!10 KOMllb)O't\jepe., 'h\o u. ee.-ce.pe.p.

$dbc = mysqli_connect~calh~ 'owen ' ,

' al l ensrool' ,

' a l lendatabas~ ' ) ;

.....'Q. ct.1I f<l.Qi1\ m. !1 !,.l, Y~11Q!,.I,v.. ~Q . C.~f~P ~.;!J. Q.~ .:~1r.\!1..9.!1~t1: ....... .... .. ...... ......... .
..... .!1\.<?~..~.~.?~lJ.~~.~/.~~.\J:.~~~-:-.<;-~f.~~............ ............. ...... ......... .. ......... ...... ........ ..... ...
ll'!10. t'\d -

______

.. u.u..u< :Jd.ct5l u. 5l . ~
$dbc = mysqli_ connect( ' data.aliensabductedme . com ' ,

' owen"~

'a l iendatabase ' );

..

......u. .bt. ..1f\.dgu.:Yr\. .\':);;I:,.. ~ctQJ.l.,9t .ct..il. dQJb1. .t- .-Q .~~.9-e.m .pt.\dQ:YJ19.mp., ..... .. .
..... .~!\. :m~.[]9H~ .-7."!\\R WJ~<? .~.I? ~~~ "3<;\':/-?\ . ~.~?!-! . ~ !l~~!1\ .~~~.~~ )'~!1\~~~!I~~c;J.~~..... .
I1d 5l d>:u. <:\3!. d..bt.x.
~ d, u. '!1gi11t aP~Me..'Y!1 .. .

., . .do.u. di11 fs'bLdPC\i11b ddjY


d..btx bt.JOOM .u,u.u. i11ys9~\_se)eci __db().

$dbc = mysqli_ connect('data . aliensabductedme.com ' ,


mysqli _ se l ect_ db($dbc, ' aliendatabase') ;

118

' owen ' ,

' a li e n sroo l ') ;

MySQL

110, nmerm u-u8' (),


Heo8'xoQUMbIe () wuu 8'30(I, 8'!l
mrY()a m"em. I<aK 8'wum,
m ra8'omaem:?

CII,

-
-

KOrAa

dle().

die ()

, .
,

die () :

- .

- ,
mysql i_connect ( ) ,
, die ()
,
.

119

u. ,

Mbl ,uu

PHP-wuu u ().

menerb~ nrocmo
nerwae,amb cere,erY ~r
()u Jmo 5Qvru~

!
, mysqli_connect(),

SQL- .
, MySQL-,
- ,

. ,
-

MySQL.

, ,

al iens_abduct ion,

mysql i_query ()

SQL-.

3Qd(;nJ{QuYrje, rw.w'o. u,
3Q1{l d,ij5{ g YrjO/\>\ 't!)bL

d,gYrjOJV\d,'Yr~u.~U.pogd,Yrjb \,u.
3d,\ipocc\ j,NSF.RT t), .

mysqli_querY($dbc,

So.L-"" \i~\Yrj5t

cpyU<u,u.u. YrjYS9~i_9uery()
?H?-1\.

mysqli_query ()
SQL- - (

$query),
.

120

MySQL

INSERT

SQL-

mysql i_query ( )
. ,

SQL-,
,
.

INSERT

Ol')epct'l\op '<'YI'\ct: zogopu.'YI'\

.u..u.'YI'\ 'l\ C'YI'\POK'y

m 'l\. \i.Jolct ?,
KO'l\opct5l .9.:>f.'I\ .3ct\iPOC I~SIRT.

.) C'YI'\POKOU.

"

"what_the_did, fang_spotted, other, email) "

"VALUES (' ',


"'

',

~Yctp.o gecb

;/'

~o.9 'Yl'\~U C'YI'\P~KU. _._~

"''I\o
f -., ~ ezo
1< . ..90.

.'Yl'\'YI'\ 'YI'\/(ct
j< 'Yl'\ .

1):

',

'1

',

'',

',

" .

',

" .

'I\. jctt1pocct ctll.9 . ..:9:i .u.u.


C'YI'\poKctMU. KOQct 'l\dbt ct'l\ ezo dbt.
.9 . IlYr\rU:; u. 1l0.u..ctt.. u. ~'YI'\
u..u.'YI'\ gce KOPo'Yl'\Ku.e c'Yl'\POKU. g . u...)
J
I
I

SQL-

INSERT
mysqli_query () .

IfG 5bJffi01G't1b

ZVl1blX ~011OCO~

1): INSERT

SQL-KOA INSERT
(query)

" .

"

"'sally@gregs-list.net')

TctK I<ctl<

',

,
"'',

'3

'',

, -

1):

INSERr?

: ,

: .

, - ...

-.

MySQL-

, ,

SQL-, INSERT

: , (query)

, .

INSERT

INSERT

INSERT.

. ~

,

8 ~

121

mysq/Cquery()

J J
J

MySQL

mysql i_query ()

:
SQL-.

n__~__~,

~
~
..trI\O ccbvll(C\ u...u. \.3. tbt.x,
I("\. dbvlo "\\. \. bt.jOOM
u,uu. "VY\YS9~i_c.ot)l)ect().

);

So..\"-.3C\l1p0c., KO"VY\0pbLu.

~ d e"vy\ t.\")... "vy\O"vy\, KO"VY\0Pbt.U.

y~

""

\uu. C"VY\DOKOOU.
_

1) .. u..

jC\db!.C\u"yy\e: "\u.

, ,

"vy\u.\"\ \u.

1( o.cpu. ypC\u,u.u.

mysqli_connect ( ). , ! ll e peMe.bt.e J!!l

&t.3bt. \..btx.

~IIIII = mysqli_connect('data.aliensubductedme.com', 'owen', 'aliensrool', 'aliensdatabase');


or die (' MySQL-');

btl(\ u...v. dcIJou. \~


bt. \. "vy\u. l"\epe.Me..ou.
\..

, (
, ,

$result

= r~( $~

l'or die ( 'Error querying

L ~_

..1 "\0

$dbc) SQL- ( $query).


mysql i_query () .

j"\\"vy\

3\1l \.

$~ -m SQL-Jc(llpoc.
database. ' ) ~o bt\
l-U-I.bt.X
u..... dcIJU.
d.

mysqli_query ()

SOL-an
mpesoaue.
nU

931

SOL

U otnn

. ,

sa

gaHHblK

$resul t.

INSERT

. ,

'\JUU

mysqlj,_query () .

gs

et

mysqlCquery( ) eosogu1

~Heue ~ sao gaHHbIK.. 9!:~Ka SOL-a1!JJ9'!l.


gs om .

122

z2

MySQL

3e

mysqli _close()

INSERT, ,
, .
, .
,
, ,

,
.
mysqli_close () .

XopoUJa9
nU5b1
apb1atnb
coegueue

7tnO

bt.d. . Gu..r.

d.Ju. d...btx,

KO"Yf\0pOe

bt u.t\0.u. . 6.
u.K<f)O p.ct u,u.eu. . u..

mysqli_close ()

~
$dbc) ;

MySOL

ei1.

gaHHblK

1-l':1

sai1

$dbc.

..u.. "Yf\ I1... .5!."Yf\. btd.


. u...u. dd.J .9C1..bt.x,

GOJ.9d.Ko

1(0"'11)0

dbt

bLJ-;:.u,u.u. "'II)'yS9~i_cfl1l1ect() .

I(.9 . "'ll)C1tt>d.

l1 epgbLe.

l'

u COWUHe.tiUe

u () ~r&aem
&mmuu, ~

f10um~

ll. r ll
, . ,

1., lIw.
,


. ,
, , .

,
,
.

123

': SQL-KOA

': , INSERT,

mysqli_query()?

mysqli_query()

$query?

: , .
SQL-

mysqli_query ()

- ,

: , . die ( )
,

,
- . , ,

Q.

.

.


,
, .

mysql i_c onnect ( )


- MySQL.

di ( )

,
.

SQL-

mys ql i _qu ery ( ) .

msqli_ls

() ,

- MySQL
.

124

z2

MySQL

-l-
n
report.php , nRn
ero .

report . php,

MySQL,

. ,

MySQL,

SQL- -,

, , .

report . php - report . html

, <i

!>. ,
.

MySQL

SELECT, , .

? , : ,

, .

125

$_POST INSR-n

110()()um (), f'l' rl'


() Jaem l' m, m l':Jm ()

l' cf0rMe Urum ux l' ()?-110, 110 r


~l'()m O()HU Ume () l'uu om moro, m
l'~e()eo ~ cfOrMY. ~u, mm f1-If'-cearuu
l'mmUUrYem nroecc..

nw n. INSERT n
cocaneH , n ,
.

, ,
,

,
.

msqli_ury (

\....""----.,..
~ mu. 34t-U-lbt
.06u.

q
t)u..u.u.

l\ol\4cYf\b g CYf\POK~
j41"\pOCa $C\uer~.

)(.u.u.

t'lfu.Uf:tu. 'll1 Mec"'tYjo,

0'111 .94
t)"'tYjt)\'I!1

.9 4 .bt.e
t)."'tYju."'tYjU

C4U"'tYj4.

126

z2

INSERt-?

MySQL

$_051

report . php

$name

Il..d.}Q
ll ...lO $_POS bt.

$_POST. ?

$_POST [ , firstname']

'

, . $_POST [ , lastname' ]; u.llg~Jlu., 110bt

$when_it_happened = $_POST['whenithappened'];

~ u. I1pU.COU.l11b I11u. 34f5t

$_POST [ 'howlong' ] ;

cool11 g.1\ C1Y\g}Q,u'

$_POST [ 'howmany' ] ;

$fang_spotted

t)Jlu.I11 J4.f5t :90.


t)5t !. ~..btx 4

t)epeMe...bI..

$_POST['fangspotted'];

$rn

$_POST [

$other

$_POST [ , other ' ] ;

'rn

'];

, ,

INSERT

.
,
$ernail. ,
, .

$first_name
$last_name

=
=

$_POST [ , firstname' ] ;

$_POST [ 'lastname' ];

~ 3~.u. U,f u. du.u.u. 1l01\u.1\5t

<:

"'

c~1Y\~ 1Y\ellepb I1ru.cgoe.bt. u..uu.J'cUlb.bt.


ll e peMe..bt, t)1\ .. Mol'jY'f\ dbt1Y\b

coxp~.e.bt. ~:90.

g cgoeu

l11~u.u,bt. Q.fiet)s_~bductiOt).

Jl(

- INSERT

$query.

aliens_abduction .

127

$query.

aliens_abduction

INSERT

. \-LI{ \"\.uu.
SQ.L-,}<:. 1\\-L 1\. ,.,
. u. t\ .

\
}

$<1~~r.J .=:. ]N..$f.RT .lN.J9. .t;lJi~n-?_~.~~i.m . \.fjr.~t_nn~,}~~t_r.1.m~, .wb.~\I_!t_b~p.p~!1~.g, .h(_~).~,. .


~hqW_"m~n,.9.!i.~!)_q~.;;~.ift.n,. YYhcAt_i~~~_sl.i{ .f~!1-~.qtt~~,. Rth~.c .~:m. (.~~. ~ . : ... ..... .. .. ..... ... .. ....

~!1h$.,( $.f.i.r:~.t~n~"!1)~:,..'.$J~~~~,I).n~'.,. : $~<?!)~~t.~h~f.p.~.I') ~~'I' : $hf:>!:'~f~I).~.' ,.: $.b.~w~~~I)i, .~ .'.......

~'.$,~.~!~I)~4.~~~X!p.t\9n: .'.$~~t~tb.~;;L~{ <.'.$.f~!)~?,,~tt~{, :~9.tb.~r:' t~ JX:.. ....... ........

BMe. c"l1o "l1."I1u.1:rlX ..rtbIx t(u..u.u.


\u. . "I1eMpb .bt. 1\.. "I1e

........ .

lo . .Q.tW.5ll!J-tbu< _90. CY1\po~o


coXY1\~eY1\cY1\(oo.Y1\b t).<l ".... \J.e.

jo.bt.e., K01Y\opbte t('YrI,"I1. Co."l1o.


~ .

. 1\.,u,. <..fmObt .. Jl-Lu. dbt

D.I-L.1-LO coe. ..
I

IfG 8w~a.G'}h,

Z1f1tblX ffi o1tfocoffi

~: , : , .
,

. , -

$_POST?
$_POST $query?

. ,

$_POST .

, ,
,

, , , ,

. ,

, .

. ,

, ,

, ,

SQL- .

. , ,

6.
, ,


,
.

~: . ,
,

SQL-?

: , ,
.

, ,
,

Mory r
, -

, ,

~:

. ,

SQL-, .

128

MySQL

, , ,
,
. -,

report . php.

<?php

$when_it_ happened = $_ POST['whenithappened'];


$how_long = $_POST[ ' howlong'];
$how_many = $_ POST['howmany'];
$alien_ description = $_POST[ ' aliendescription'];
$what_they_did = $_POST['whattheydid ' ];
$fang_ spotted = $_ POST['fangspotted'] ;
$email
$_POST['email ' ];
$other = $_ POST['other ' ];
$dbc =

$query = " INSERT INTO aliens_ abduction (first_name, last_name, when_ it_ happened, how_long,
"how_many, alien_ description, what_ they_ did, fang_ spotted , other, email) " .
"VALUES (' $first_ name ' , ' $last_ name ' , '$when_ it_ happened' , . $how_long ' , '$how_many' ,
" '$alien_description', '$what_they_did', ' $fang_ spotted ', '$other', '$email')";
$result

echo ' . <r 1>';


echo ' ' . $when_ it_happened;
echo , ' . $how_long . '<br /> ';
echo ' : ' . $how_ many . '<br />';
echo ' : ' . $alien_description . '<br />' ;
echo ' ? ' . $what_they_ did . '<br 1> ' ;
'<br /> ' ;
echo ' ? ' . $fang_spotted
echo ' : ' . $other . '<br /> ' ;
echo ' ' . $email ;
?>

6 ~

129

nu

, , ,

,
. -,

report . php.

e f-lObt l1 ....bt. d.'Yr\ U..5I.

u. ~ t)'V\u.'V\ cc.Hl'Yr\Q, KQJ{ dbv!o


.

(?php

.$.f.i.r:~.t_I)~"'ffi.~.:=:. $._~9$f.'.f.i.r:~1g,"t)'\~'J ........... .


.$~~~.'t_I)~"'ffi~.:=:.$.J.Q.$JU9.~~M~~'J;...............

~b!. .bt 3Q1\ u...u.

$when_i t_happened = $_POST [ 'wheni thappened ' ] ;


dQJOu. Q..bt.x, t)Q u....u,,
$how_long = $_POST [ 'howlong' ] ;
.du..) ., I1:.
$how_many = $_POST [ 'howmany' ] ;
01\t)Q"1\ btt)..u. )u.
$alien_description = $_POST[ ,aliendescriPtiOl']; JQt)poc.
$what_they_did = $_POST[ 'whattheydid'];
I
3Q
$ fang_spot ted = $_POST [ , fangspot ted ' ] ;
I'1pOC 3Q.
u.
$m = $_POST [ .m .];PtJP-1\u.u. I1 .30Q.u.

$other

tbtx . .btx .

$_POST [ 'other ' ] ;

$ = ~J$9~!_~9.l)h?,~:~,g,J.i~\\$~.~~~~.q~~..~9:(1}:,..\~W~hJ.:~gi.~!JR9.J: .'.~.~~~\\<;!~tg,~?~.')')
5?, .~. Q~~g..q9~9~t\~J:W:5!.Ci. ~~~Q..~:-:~.~f~..~:)! ............................... ...................... .. .../
$query = "INSER'l' INTO aliens_abduction (first_name, last_name, when_it_happened, how_long, "
"how_many, alien_description, what_they_did, fang_spotted, other, email) " .
"VALUES (' $first_name', '$last...:.name', ' $when_it_happened', '$how_long', '$how_many', " .
"'$alien_description', '$what_they_did', '$fang_spotted', '$other', '$m')";
$result

.
$
~
_
= '{I)~$.q~.\-<1IJ..~.r:~.~., .$.~tA~.. ~!...........

~ .31\Q1\ btt)..u.. .3QI1POCd

cepepe t.bt Q.5t/1\. dQJe.

: .<;tj~. (Q\JA~~K<:\. np.tA .!:1t:t)p!Jt\~Jw~ ..~1).9.!1. .~QJe d.btx:);

."'ffi~?<1J.i_Y~9.:?~($.clkY.~:~ ~J{pbt?"u.e u...u..

oQJOU Q.btx.

echo ' .<r />';


echo ' ' . $when_it_happened;
echo , ' . $how_long . '<br />';
echo ' : ' . $how_many . '<br />';
echo ' : ' . $alien_description . '<br />';
echo ' ? ' . $what_they_did . '<br />';
echo ' ? ' . $fang_spotted . '<br />';
echo ' : ' . $other . '<br />';
echo ' ' . $m; \
ll"l\u."I\ l1. COXPQ.e.u.e

. ~ Q..bt.x bt Q \..&t.x, "I\.


1\Q KQK b!. :\u. "\ C'Yr\QPOM

?>

cu,eapu.u..

MySQL

--
report .php , llll
lle ll INSERT.

$name report . php, $ f irs t_name


$last_name, $query ,

INSERT .

, .

.
MySQL-

aliens_abduction.

SELECT

ccwlu. .:..

'\du.U;
Ll..'\. 0.9d.
.J1ULUI{5l. '\ d

UOI"'1'L'I. O'YIpct.

. 1I0.Jld

: .90 'V\, KdK

!.
: O'YIYf'\u..ctu.
t'ju..rw.u..

ocMu..Ll.u..

r,u..w.upu..

Il.u..u..
'\du..u,.

. jdllPOC INSIRT
.. g.u.'\,

ytOu.
<;d b!. y3d.e'Y\e,
KdKy~'Y\b
..bte

,3dt'\u..cv..

131

6Qu

WHERE SELECT

6 ,)
report . php
. ,
, ... !
ll
ll\ ,
.

Ueiil'u1 1'0 I'euULI,


uaHHblX l'n1uu nfl
UJ,uu noxuUJ,eHuu u nUUJu,
cocmal'fleHHbIMU nu Moero cauma.
nOMoraem I'uu , MorflU
~_-""o Haumu r.
n ,
, KOTOPItIX n r.
,
:

fang_spotted.

~a

~HeT , ,
. , ,

al iens_abduct ion,

fang_spotted

, ll

, :

SELECT

* FROM aliens_abduction

SQL- SELECT , ll
. WHERE
(. ~e) , ,

. ,


, 11

fang_spot ted

::I .

~(:\ d)I J<::\IlPOCd SELEC "\<::\i'\


.3 i.LJ..u - u. WHIRf )\(~l1')
3<::\ U"\<::\u,u.ro 3j"\d"\d.

132

MySQL

--JJ. - - - - - SELEC

WHERE,

MySQL- SELECT WHERE


,

, .

~o J'Yf\UX
3d.!')lJ.cS\.x rtl{lJ.
fd.l'1 __s tt.d
v.e)O"/\ 3 4 .u
.

133

SQL-6

06

MySQL

L- .
,
. , ,

,
~, , ,

SELECT.

.. -~'1l\u.

u. 1l0ww. ~CIJ

..bu<.

134

!<rymo. n;,l?u ;, )(
[ ~mru nm. MOry
menerb rwmumSI COOOlJ..lel-\USI)(
no)(ulJ..IeI-\uSI)( uuu nrUUJu, 1? KOmOrbI)(
lJ..lem m cP~H[ ;,el-\.

MySQL

HTML-,

- MySQL-.

SQL-, - MySQL-.

, -

L- ,
.
, aliens_abduction.

fCfortfhf

L-

P041I

-.

, report. html.
.

- MySQL-
.

- , ,
,

report . html.

3ii1!foc

MySQL- .

HTML

,
.
,

MySQL ,

- () ,
.
- -

MySQL- ,
.

135

HTML-,

- MySQL-.

SQL-, - MySQL-.

, -

L- ,
.
, al iens_abduct ion.

L -
-.

PO&jI

, report. html.
.

- MySQL-
.

- , ,
,

report . html.

MySQL-n .

HTML

,
.
,

MySQL ,
.
- ()
,
.

- -

MySQL- ,
.

136

~rlJ-{,G , 3rl1)oJ\J-{GJ-{,G Orlbl grlJ-{J-{~

'*

*'

" "

6n f

.
, .

, .
, ,

, . 3 ? !
, .
- MySQL-.

rn

139

<1. eC"'t\b 328 .,.

nm.t..: I!O'fvY)bt, -<1.!-{14,

p4c-l\el\ 43bL ..

!>:

nll l1

MakeMeEl vis . . .
,

nvn 311

>

, - -,

n '

andreWWiI/

n/lros,cor

angryPirate@b;h~gumbol/.net

c'aY@starbuzzce~ neckpizza,cor

annmeeker

@hn:~i~hf;-i.r

86@0.

debm

bJectviI1e.net

>
' . onster@breakneckp'

v
tarbuzz.COffi,zz.a.com

>
ffi
ee.Com
SZVedjoe@ob'
'

s"1

e.pes:l flv>u .u,

~,q

11. m l1uce!

\Jf <1.U

/fri@:,;jtv.nt

m uem U\.l.l MHofo


e.peeHu. /\\.l.l S:I mmu .

.4U.u.

US.Com

:
,q

@breakneck .
g9S@boards_ r _
P1zz.a.cor

overcraft@b

AnneToth@fear~akneckPizza.com

. ,

,qlO

60

------

)Offe@sirUd @breakneckpiZZa

R aran2IuV@bUCk.com
.
,qr
ed99@bOno reakneckPizza

O~AH jOjoround rnsup,com


.

,
.

,
\lrti:-u

l1110

"':

;:. jifl_anderson

.ct <1.ru-tb MoMeKYf\, . ux !\I'.

u 4.

~tv.t

sheridi@mi

'nowman@t;htY9umbol/.net

g/enn0098@0~;~ean/ounge.com
anneh@bOttO

nobigdea/@

ctvll/e.net

'.

:;"::

ddreamgir/@b'r~;~~:Zkcoffee.com

l{

feeo1iyp~...~ msu.

'

A+v
n

rmem @bOtt

PIZZa.COm

<:C"'"~aeneo

. nep@starbuzz
ama,com
ncc;man@tikib COffee.com

3n
grace23@object:~,7founge.com
3~CC

n
zefda@we
e.net
~,q clifnight @~herorama.com
6n ~
joYCe@choc~eak~e~kPizza.com
6~1n
annebJant@b hOflc~lnc.com

'I

31{

Iind
reakneck .
Y@tikibean/
P1ZZa.com
gareS@Objectv."ounge.com
99@ . I e.net

~ectvme.net

J1"tou.

J1"tortbt.
ct)IJ.COK 4~
!

MakeMeElvis.com
!

u.

20 %!

mi-'J-
n"m>. .

- ~
! .

~,-"1\Ft)fi.l..t~

1..i..94)11, 2-

CMOZ,\[Yf\ ?,
"

t)oJv\oW,b]<) ew,e
!j 3 '!"":

4 ;u.4.
,

.

.

140

- ,

-nueu

guu.u

. ~, :

I
, ,

pasotna .

, .

, :

peu111

~ O~!<l'b &ti... anl'u u &&nu &t0I'MY


.()'u~ ~ml'r

nUCbMa.

~ m !<HOnY omnl'a&!<u t0I'MbI Uf'&' ()

ODI'J"om!<u, & l't.3mm~ tr m ~mI'~


nUCbMO 6'()'!" ml'&t & mumt .
Makt~ls.com, u ()l'tC ~mI' m

Utm.

&c.nu(.I<(.

npeg
gu gs

nocemu

caUtna.

1n tJuJ10. .u. 51 fd.bLU,

m..u. 110Yr1 bt .d.ljoMu.H.deW,


\lDWl.u. .d. I'""ju..u.5lX

~ &mmu~u &m c.nuc.o!< a()l'tc.o&


~ u.U)I>,U,l1U,w.\Jf.i,f;\U"
~mI' m, nl'woana&u& &an
. mU,'-fd.l'!\51l'!\, "t\ .
ynmt I'tfUanI'Ul'&m. 't.3 &ti...t0I'MY
CljU,CO'K ~pecog I'!\1-,.u.
t10"t\bt 3d. ~l'!\

.51I'!\. ctI'!\d.I'!\u.U,
u. I'!\-L-<t \iu,cbd.

ym I'!\\id.f551I'!\51 ,

, ,

...

KI'!\0 \iu.. g l'!\


c\iu.CKe. l1uJ10. .u. ct
t1d.I'!\u.u. ,\.GI'!\ro

ctf5'I'!\d.I'!\u.u,rd...!

MakeMeEl vis . cam

: -

, -,
. , .

141

3 ~U ~U }~

cl')UCOK

"IY\..Q I!'l\bt.

. , , U l!)}O"fY\
- , "IY\.rtbt.
, , , ,
I!U.4, KO"lY\0pbte

. "lY\l!.m

MySQL.

~a KOMdut.".\u,u5l

~o.", -u,ru

rh~41 cu,et.".\puu.

--...==::-=.;..~=..".................................... ...._..
.....
,

~_ :

.;

(~

't'

\103

."lY\

\lYl\UYl\

_
. aLi"Yt'\a

' CI')UCKY D15


I-

u-bt.

~"IY\..\..lI!'"1
I

'=~~===-~_-.
~.~~
_

........ -:
....... _..

. ~~~

~ ~

.. jc\11 0t-L5l.1)
.
'Yr\ ,
sendemc:il.hfml

. "II10

'vr\~bt J d;\1
U

0'tY)t) pctU'tY)b

~l{"II1.

I)ucb.o ceM ~.

I{}.bt

cl1ucoj( ~pecoe
"lY\. 110'vr\bt.

142

~'tY)bL

1') Duu.uYl\.

addemc:il.hfml

'tY)t)d.'tY)

"

t"]uc .ct f.)CeM )QQ

)bL

J~V'\

ct)UCOl( ct
'tY) ()..
1-

t"]'n1 .

m,

rrm - UMySQl--ruu~
.D.oIIluu lI! Hanucamb f}tf'-cearuu,
m )<> mlIU VII )(ru VaHbI)(~
IIU Cl\Wyem vm mIIU,

-- cearuu~

: , .
, , .
: , , ,

- .
: - .
, ,
.

: ,
? ,
. ,
?

: . :
, L-, . ,
, ,

,
. - .

: , L-.
? , ,
.

: ! L-, , ,
, .
: , . L-,
100 %, ?

: . L- , ,
. , ,
, , L- ,
, .
: . !

: , , , ,
.

, , ,

MakeMeElvis.com.

, ~

143

nuunuu

-n''

. ,
.

618. 6n n
n .

,
,
.

6- 6n
n )) -

n 6n

HOBoro

n .

,
.

6-
n )) -
n

cornacHo

n .

, -,

, , , ,
, ,

, .

144

addeffi<il.php

oddennl.html

gaHHblx. KometlHep

,
. ,

XpaHet19

, ?

5Uge.

, -
(, , ...).
,

gA9

gaHHblx.

: , , ww@stuzzff.!>.

:1mO .d.

~ .---">
't\u.
1\ 1\!.
df.u.tbtx

./O"I\c5(
1\\du.u.pu..

,
. - ,

, .

,.

~ tt.btX,
~\eW,w-\.d

5 mau
5

&\3 ~.

u nucsx.

M~so.\..-cefeefe

-t f

duu,ct.

-t

of

~o J.

;:?~&a5\.

d \J.u.p.

...-

..-

...-

....

~o

J C\ t')LAcu.

..-

..-

...- ... ........- ...-

......-

"~

....

"""-

IfG 5bl~01G11t,

\ cl1\t-

ZV11bJX ~011fOCO~

1\ \3 d)
:.9 a ..btx -;

---- --- ----- -- ---....

xpammcs

....

"-

.1\.

? Mory ?

u..clu,u.u..
I

; ?

, .


.

SQL -

8 ~

145

(CREATE)

MySQL- 6
.
, ,
.

, ,
.

SQL- CREATE DATABASE , .

, ,
SQL- CREATE TABLE. 0
, MySQL-

. ,
.

.Yri.-d,. t)po~pct...oe ri '. .u. M\lSQ.L

M'J 'Q.L

( ) . ) ' 'rI<1.l(oe,
J'"' d -'rIu.\, t)J~.'rI . coe..9u.h.u.-.
J
- ... <!J ..9<1.J-It.x t)pu. u.u., 'h!o b!. Yri,Q
.\'rI, z..g e ..9 u. 'rIu.'rI ."!1u. d,t). cepe.p ~
c\IlPUJ.....ep !{<1.

M,ISQ.L 1'

..9d..btx, u.. t")J<1."!1. u. ezo t")d..

- ,
,
MySQL-

phpMyAdmin.

, .

,

SQL- . ,

MySQL
-

146

z)

~i"'~lcll ."ai~~. .
A8Iaf8WIlL
. ....
.. . d
~lJ..l*"'~ii&

~;=:,t:::=:J."~
oynhfAII. AUQ8 .~~.

~1II1ic tci-+l'IIIlllllpaha

-pot04 ",,,u ff~Qlapu.

)~. 01IIII1'*11 nolo COfCIIp ~"""7


I'acQIA"

6 3

Cf\EAE
DATAASE

,
,

el vis_store,
email_list.

SQL- . SQL-,
,

CREATE DATABASE (~ ).

, .

~ .u. dd.3bt.

_-- d...btx, KO"Yf\P~)O

.dL!.. 3d."Yf\.

CREATE DATAASE elvis_store

~npoc.
ucnro

gASl

CREATE DATABASE. SQL-

(<<gm
g1) -

gU9

H050ti
qaHHblK
Koz.9d. b!. o.9"I1e SQ.L-Jd.ll pocbt
. "I1 LA.ctd., b!. d.
~&'."l1 "I10 Jd.t) "l10U
KoKu,e 3d.llpOCd. ... .LAI<~.9

, .

. d."l1 "l10~. KO~.9a 3d.t1poc


"l1. "l1.
mysql> CREATE DATABASE elvis store;

'!.) u,

~~

1 (0.01 )

el vis_store

"I1YS9~i_9uery().

'-----~.

CREATE

DATABASE ,
, ...

t..3d d...btx .3d.4,


. 4 . .."l1

..ct"l1 d...btx
SQL-

TorAa, KorAa

;, "Yf\d.du.u,.

- SQL-

MySQL -

,
SQL-. ,
,
.

6 ~

147

(CREATE)

6 6
, ,
.

, , d.uup. e.!'Y\d.\~_;\st-

, .
, ,

.-!'\ 0.91-14 U' ..!'\ d.


!'\d.uu,. KO!'Y\0pbLe .jiY\

mi1_1ist.d.J .9aJ-\bU<
,

, ,
. :

1ast_name emai1.

first_name,

12 0JMo ",,-,"Vn

11
o/fVr<.
",. 1\Cl. 1\.""!)\'), d.ct

.ct, !'\oo. OJ-( 3ctrtlAb!.\ \

-"'.... ___--..-........-...--.../"---w, ~~ . t)o'h\bt., . Uyrt1 .u

~ pcte,te.u C!'Y\F.Yk""!Y).Ypupof5'd.K1-1\

]~~~i~1i~~~i~~ ~~I:;~~~:~~:;=~' t)ud.1\


.... _ _ . ,' ,

_~~~{~1~~o.!_:~~~~~~
__
......

......

..... .

~~~~~.~ __.-

email_list

,,,

___ ....- .

-ik~g@g~~::Ils~,~t . ~
......_....
-.
....
.......
...... _-_. ------_.-.-

m .u..

13 1-14u "'II\\6uu,

mcilinglisttxt

<

!'Y\fU'

, , ,

nu mau\,le
pacnm
.
'u

148

email_list.

, MySQL-
.

,
.

aaHHblX

6 w
,

MySQL,

.
, ,
. , - ,

, -

. .

MySQL

, , . ,

products,

Jw,Q l(.Q ."!1 "!1eKC"!10oe


Ot"ju.Cd.l..Le d.z "!1 0 <:Id.

,.d,.ctJu.. d..
;

16

93

1.99

48.00

~<.I

23.50

cr cn<

i~ u:Yf\ .d.

\\

orice

t-U< I

(<<u,e\d)

a!-t.bte g gu.

ji-ld.l-lJ. u...9."!1.{d."!10d. () ~~~ u..

Jl CJl

i<d., -!\d.fd. d.zctJLlrle N\<.l. :vnu. ,

p roduct -
product s. :
price id inventory. MySQL

(lnteger Number)

,
.


, . ,

, , ,
,
. ,

- ,

MySQL

. ,
, , !>, ,
, .

gaast masU, g
m. KaUe

munbl

gyt

cogtnC9 gu u3 .

,
,

149

MYSQL

MySQL

MySQL. ,
,
. -
.

3ctLtcu.ocl'l1 lA. 01'11 epc ct.


cepepct ctJ ct..bi.x MySQ.L ,
.Yr\ "!'1ct.Yr\ 255 u. .

epco. li.. 5.03 65 535 u.

epco. 5.0.3 bL..

n 6

IfG 8J~itGTh,

gV11blX ~011roco~

"; CHAR,

, , ,

VARCHAR ,

, .

"; INT DEC?

; .

,

. , ,

( ),
,

,
CAR (2) . ,
,

1, VARCAR (1 ) .

MySQL.

CAR , VARCAR,

,
.

.
,

(lNl; ),

, .

"; ? ?
; , .

, ,
, , .

MySQL

, .


CAR(l)

TIME

VARCHAR(2)

D(4,2)

VARCAR

(6 )

48.99

19.02.2004

CAR(2)

DATETIME

(10,2)

8 ~

151

....--------+

f~,.

MySQL

, .

48.99

-
:

19.02.2004

DEC(4,2)
?


CAR(2)

DEC(10,2)

1 \

DIC Odbt.

~u d u

Ul)-m.

110 Kct;3btd)O't\.

u,u.cpp

. d..u.
.d.
u,eK 1u 2.ll.. lI.l\Zd.1\

.-m u1i
u.

~~u-m t)f

~-mu.u
3dl"'t5(.Y1\Ou. U t) .. .

152

~bt. g.)..

gdU D
d1\.u

..iu.u.a.. ,3d}O)Yj
1\.} d1\..!~.J..

MySo.L 1\g1\

2.0 U. (1I01\ .u,u.a. .


lU.u) 1\
t) 1\dg..u. d..btx

d/1\.

Ullgu R,
. u 1\ij 1\
IlpOC1Y\ u 1\d1\.
1\ug..

6
, ,

( m i 1_1 i s t). :
emai1. ,

first_m, 1st_m

SQL-,

~IIU~ &-.o Ao5a&Aettu~


"8 :t.w<mrOIlIlOIi nm
Uf'Hf'-;ettru i) i)5&ettu IIO&Oro
nynm~ & AUan r~bIAKU.

~IIU~ &-.o Omnra&Ka

. SQL-
CREATE TABLE (<< ~).
CREATE TABLE .


. ,

. :

_2 z-.2,

~<.u..
u.
-u..

omnra&KU nm G011\aGIIO AUGmy

r~bIAKU.

"'-5t u.

:tA~mrOllIlOIi nm Uf'Hf'-Guettru
i)

u.t) .bl.x

.,_J(U

snL-an
CI\EA1f.
uCnOAb3yemcg
g gU9

511 truu
~b!. - J:1.bt >:1."\ u.e.ct
. u. 1I0u.:1..u.. .
dJQ ..u5i. , - u.u. 'l'l\u.

gaHHblx.

Ilpo~pc:1..u.pOec:1...u5i. tlIl:1.,:1."\ .:7'1'1\0.

no,a6omllllb
SQL-,

emai1_1ist

: first_m,

1st_m

emai1.

6 ~

153

nu -

u
SQL-,

email_list : first_name,
last_name email.

'_.- - - - - n n n.
CREATE DATABASE CREATE TABLE,

el vis_store

email_list, -

MySQL-.

CREATE DATAASE elvis_store


CREATE

TALE

email_list (first_name

VARCAR(20)

, last_name

VARCAR(20)

m VARCAR(60))

m ? ,
, , , .

154

u n 6

110uuu, - u Uu51.

"" (}, u 'u,

CdLI. Jd,t')pOCOJvl, CRIATE TA~LE ce


t')f~Ke. . MySQ,L-)')u. . JrtdeYr\,
I{ClI{Ou. 6\3 ... gctd,Yr\ Yr\Cl6u.u,..,
~o h-u'I{.9ct . ~.9u.i\

, , "uu ... "

- coocl.1\eliue ..

()

KctKl.L/'A-i\ I!pu.Yu.MM Jd,t')poc CREATI TABLE


. ctYr\d I1pU. t)o\lbLYr\Ke g'bLt)O..u..
u.J MySQ.L-Yr\u.4ct.

.n

__

IJli

,. ,

MySQL- ,
, . , ,

el v is_store,

. ,

, .
, ,

MySQL-,

...

f\3.9fdrt,

If 8J~a.G')h,

t')OYr\0Y "I} e~o

Jdl1pOC CRIATE TABLE


Jt1., d MySQ.L,
Yr\eM . .
COOdtll,de)'Y) 1(~I<-Yr\

u.J<.

ZV11blX ~011YOCO~

~; w >,
SQL-?

; -> , ,
.

MySQL

, ,

, (<<
), .
(,
),

MySQL .
~

155

6 (

USE

USE

0 6

CREATE TABLE ,
MySQL-, ,
. USE ( . )

,
SQL- .
:

onpegeAget11

. ~ 3cs.l1poc USE lOOPU)!} MySQL, 1<0.1<:/,1O dct,3y


J!:...bu< bt .o.epe.br. (t1O!lb.1\.
JI_~

USE

gaHHblK

gA9

negyux

~p0c06.
USE,
.

lVi.lris

156

=~-TeCT-
8n n

USE,

n.

USE, 1 vi s_s tore

- MySQL-,

CREATE TABLE,
USE

emai 1_1 ist

l vis_store

CREATE TABLE email_list (first_name VARCHAR(20) , last_name VARCHAR(20) ,

m VARCAR(60) )

('
Ko~ 3Q.u..SI.

'YI\Qdu,bL

'YI\QI( ,

I(QI( u. I1..
. 'yI\<o

'YI\~'Yl\

I:PQ'YI\b ~y

i.t,,l1 .
. 'Yl\

PQdO'Yl\Q'V\b.

157

Qn DESCRIBE

! ~ ~11poce
CfJ?A11~1~~ 0l1m,
~ce pa~HO ~I10"He.
~b ~ SQl--att()

SQL

.. ))

..

nR

w - .
, , ,
. ,
i

1_1 i s t Bblr

l-"m

emoil

, .

- , ?

158

DESCRIBE

Toro , .

, .

SQL DESCRIBE (. ~)

, .

_ SQL-:

~ Yf\cJ.duu,b!., ot)UCcJ.lA.e
DESCRIBE email_list

..bt Yf\u !. ~geYf\b.

KOYf\ODOU
I

~ . fieJd
b!. ctu."Yl\ u.5l
KcJ.)!(.QOu. . u

cJ.UJ.~U "YI\cJ.uupt.

MySo..L

. yYf\UYf\.

peZUcYf\py

cJ.UcJ.Yf\bL,

zcJ. uYf\ /bix cJ., Yf\QI{UX I{dK 'Yt)ut)bL


d.btX, t)'Yt). u..d b!. Yf\ uYf\ Yf\U Q,
rtdt)Ucdbte Yf\~ YKd..

IfG .ffitiG'Jh,

f: ) :

Null

(<<on,

gVl1 blX ffi Ol1focoffi


), (<<n),

Default (<< )
Extra (<<)?

~;

: MySQL

SQL -

; . DESCRIBE

f;
,

phpMyAdmin?

; .
, hdmi ,

DESCRIBE

. ,

... ,

81

159

(DROP)

ur~u U

~u J3nroc C~I? -ru:; ,aHO~O


u HUKaKoro r. ,
u ~ uu u ;'!

' ..u. I\epgou. tu<. bL~


~d.u.. .9ol\yw,e.ct l\d.'Ir\d.
first_f)d.e'lr\ ...

'

ll.
ll

CREATE TABLE,

cn . ll ll .
, II 11

CREATE TABLE.

:I)!

, :\1 II<l..'Ja .

SQL

:l

DROP TABLE

< !. .'l
.
,

f i rs t_m .
V\/~\. f\6,\)',J..~;)L KOW,O?y)<)
1. w,. l:,t.9d..w,
'j"< \,( 9,....
"v
0_".

160

3 J

mU.l1 moro
)( u mu ,

SQL- CREATE DATABASE, USE CREATE TABLE

('.1
.
3 ,

romo& , m !lt'ucmynumb
)(t'u &)( )(
um t'u.

:. ...

d.3d. .9d..h!.x e.Rvis_slore


..u."YI\ Uf\g.)
"YI\~Uu, e"Yl\d.i.C)ist.

email list
lascname

emoiI

)'
d.u.u,ct elY\d.i~._~ist COC"Yl\ou."YI\ UJ "YI\pex
.. U1\btx . xpd.rleu.51
d.~ u.lY\Q Pd.ccbtJ1u. d..

I
tfG ~itG't1I,

ZV11bJX ~011OCO~

~.

~.

9 , SQL,

" SQL-. ?

: . , .

. , Head First SQL (, , ). -.. 3, cn an ,

: ,
; 5Ql". , ,
~.o<;peCBeHHO

SQL,
-:>-;1()' , SQL ,
;artpoe, MySQL
;.anpoeOB .
- ::

::; 1i_query ( )

- SQL- ,

~ . ,

'9: 3, ecn ,
?

: , .
,

SQL ALTER (<<),

.
.

-;-..rt;y -.

161

QU QddemQi/.php

addemall.php

L-,
.
, -

email_list.

(addemail. html)

action ,
- addemail . php,

~aIIU~ &U--I'_ "l'&


'<"I'OIIIIOII nO .....1'> u f'Hf-CIIaI'UII

A-mU.dyn1 actiot) -

'II o"nl'a&Ku no ..... ~O "U""1


1'aca.t"Ku'

..7Yf\O Yf\O, m .9tA...Yf\


L-d-,

PHP-u,.u.
(ac{cleYf\ai~'f*1P ),

'

KOYf\Opbtu u. IlP0U.,30.9u.Yf\
.eox0.9u.bte ollepau,u.u.
.9a.bt.u..

__-

~~ELV;~.CO
.....
.....
.................
.:

_~::.....

---.,

tIIIIIIIt -"-

~-~=~

'-.--'\:------<form

th d=-post- action= - addemail . php->

o</label>
for=firstn~e :~.
narne=-firstnarne - I><br />
--text- ld= flrstname
type
' </label>
for=-lastname >
' .
e=-lastname- I><br />
_.
id=-lastname
type- te~t.
:</ll>
for=~mall.>~~~mail. name=-email- I><br /> .
type= text. ~d
=.Submit- vlu=- />
type=-submlt

<label
<input
<label
<input
<label
<input
<input
</ form>
</body>
</html>

/
162

"

nu 60'" ",

addemai 1. php

. ,
1 vis_store

email_list

INSERT.

. SQL-
, .

,.,---:>

Qt'luu"W\ '.9
t'lpuep .3Qt'lPOCQ,

':>"W\Q"W\

I::i)..u.

l<o"W\0p0Zoo ~

~.9,YY!) .90~bt

"=rnQUu,y pct.

<?php

$dbc = ... .. . . . . . ... . . . .. .. . . ... . .. .. ... . ... . .. . ..... . . . . . ..... .. .. . ... . . . ..... . . .. ................ . .......... . .. . . . ........

... ....... ... ... ... .. .. ............ ....... .............. ...... .... ................................................. ............
$first_ name = $_ POST[ ' firstname'];

........ ...... ....... .. ...... ... ... .............. ...... .... ... ......................... ............ ..............................
.... .... .................. ...... .. ........... ..... ............ .... ...... ....... .. ..... ...... ......... ..... ....... .............. ..
$query = . ... .... . . .... . ..... . ........ . ................... . .... . ............ . ... .. . . .... . ....... . ...... . . .. ..... . .......... .

......... ... ....... ..... ............. ......... ... .... .... .... ..... ........... ............................... .... ..............
mysqli_query (... .. .. . ... . ..... .. .. . .

....... .......... ... ......... ...... .... ......... ...... ........ ..... .. .. .......... ... ........... ... ................ ....... .....
echo ' .';

.. ....... ....... ............. ................. .... ............. ........... .......... ...... .......... ...........................
?>

addem<iI.pl1)

8 ~

163

nuu

addemai 1. php

. ,

e1vis_store

email_list

INSERT. . SQl-
, .

.~~. : .~:m~~!~~~~t..(f~r~t~IJ~)!\~"!4~t~IJ~)!\~,. ~-m~i~)

...~~~~~ .~:~~~.~:: . '.~:f.!'<,. )':':~.i~~~~~~~.~~~~r.~~~~:COlY\') )


11 Ptuer. t\ INSER.T Mpet\ucatt
u- PHP-"YI\,0U, "Yl\d.
toct"Yl\ . ..bt bt
t).(,lI,u ~t).

~o 3d.u. ."YI\
#4ccu.a $_POS. KO"Yl\0P btx
3 ct1()d. .

u. #4u,ust..
, '_

<?php

$dbc

k'

,,~ .

$:tore')

= .m~~.~gi_.q!"l~t.d.~-t~.:Vn~~~"Yr.I~~:-{i~...;~-ro ...~~~c .. !-fI;...\I1~., .... ':-1:\$-

('

.Qr..d,. .

"J.l

. ....... .... ..

~
u" .... a r \JSQ..\..-j)j).)l . s..r~.r..), ........... .......... .. .... .
Ul(d. co.e.9"""'~' ''' .L'.':J
. . I
I

..

$first_name = $_ POST[ ' firstname'] ;

.$.g4~i:_Mmf:...7 ..$_'QS)~$:tt\J\~'J ......


'
. '1'
....... ........................ ...... . ... .
.$.~:m~\~..7. .$_t1>0.. ~'l
" .~:m~\~. '........ ..... ....... ...... ..... ...... ....... .
$query -_

It.lS-'
It.lTO
e"WI Dist (first !1'I1~,~~~:t;_t)~"'!'I)~
.~m .~ . : .................. ..
\~ h'~
'~ 1'" :1~~ ... .......... .. . .
A ,'

.~V.ku~.(:. $.f.;.~;.~~~~~~:~.:.$g~$t_\l~-m~'J' : $.~"Yr.Ig ~ .................................. .................


( .$~.~~,..$.~y..~r.~...)
,
..9.( . d.i.}Q\q9. .~q/J~~.I:,5!.. .3~t:1.p.RY~. . 9.Q3~ :9-4~ .)!............ ......................... ..... .

mysqli_ query

echo ' Customer added.';

........ ....... ............ .... ......... ................. ...... .... ....


?>

u. b!. xO"Yl\u."YI\e "YI\ c"Yl\pauu,y

u.."YI\., .."Yl\ u."YI\ to

zu.ll btI(. l(ctJbt~) d. d


} 1l0) HTML-"YI\z <>.
164

addemail.php

--
<6.n n .
: - ~

" "~ www.headfirst1abs.com / books / hfphp.


.3 .9 11
chapter03 -
UJMe.u.Y11b
a ddemai1.htm1 . (style. css)
t).JO.
(e1 v is1ogo .g if blankface. jpg).

~f\~

~ CCvl.,III(Y 4

addemai1 . php

coe.9 ,e.u.e

II . . -
11

Y-l11

addemai1 . htm1

\z

-.

1( ..11,.

~ .

~~
#~
- ~~~""""~
Ma~M~EI.."'$.CO

s-te--.
~._"""""""""
ntII
......

'*""*.Cati'rt
.-.)
IIIo :
~ .... _ - _ ......,

80'

_:

.....

~o;;.--"' '''' --'

~"*"",,",,," ........ -" "''''''~ '

cepepOM

dCIJ .9.!.,

emai 1_1 i s t.

01( .u...

~ dd'
.oo.o

JC

~~~===~Ba_=&._ 11 0 I16.11.
11
?dbt.

I11\:9,
cu,e.d.pueM

6.dd1\di.~.

. SELECT
Jlll

MySQL .

8 ~

165

n SELECT

tlG 8~OlG'}h,

Z4t1tblX ffi o1tfocoffi

~; SQL ,
, ?

; SQL ,
,

,
.
,

, 3

SELECT.

,
SQL-,
.

bl :

bl ' :

bl ,
bI Is@jtvill.t:

bl
:

166

m.le ~
ynm ()m
m ,

-. mm m
mem .

~ ~o . I< ., "l!1JJ,bt.
"I! d.tu. ..d.

pctc"I!e)y) )Y)_et)epb
;;... c KOPOCYf1b}O.

n cocanATCA

n.

-II _
,

rr.
. , ,
L- -/{

.. -
'~"I". &., ...
"""'_14"
Cq"aaUf "'(";0o".",

iatlllb81C

~Yf1opou. }Yf1d.1i
gbtIi..1

.A

",.....
gq t"IIUI

=::.-:t::::;.1fOtorb
"81.,... AUCIIi " . ",,, ....

~aK W-top.", Olllnpala


!aClllpo04 nIllIll7) U fH"-tlfl

"lI OIII11pa&U IIIIII ~O "18Iy

Pac.c.w"KU.

167

m.,um

,
SQL-,
.

.~.-:J. .~..~..~m~.i .~~~\~i . W.HtRf; .f\l:"~t~lJ~m~..7..'~.~rm( ... ... ..............................

:~:~o::>,,;=X~p"".
~ :J.u.,
~~;..'C; ;;;l~
.3f{d.u...
!(.!(
i'!\ddu.lt.

u..3 gcex

COZJId.CI-tO KO"Yr}0p0My

ft!:.i'!\ i'!\OllbKo i'!\e Jdt)U.CU.,

!(Oi'!\0p btx u... t)t)di'!\. -

di'!\u...

,
Is@jtvill.t:

.~Jq .f.i.r:~.-t~t)~ro~..~~~.-t~t)~ro.~ . FR9.~ . ~ro~~.fi.~~ )mF.~ .~m<;\i.~..7..g~.~9.Q~~~t.Y.i .~~~. !1et'


\.. lIb<

" eJ!W1\< " Jduu:]61"

.I(,

t)pu.

f\, l.J.ef{d !(. ~ .3d t)poce

dJ.bL Jdt)i'!\bt.u..

:

168

Jll 3J1

Jlo4 (}l')r-Q

,I<'.."YI\

, -
,
L- -.

ernail_list,

addernail. php

"YI\.u "O'ftr\b!. .9Qe"Yl\

ec"Yl\U "YI\eMY U .9 ,u.


"Yl\.~ l')ucbJlo4
U 3Q"YI\eM O"Yl\t)PQU"YI\b
e~o t)"YI\....

u...bt. u."YI\

'OJ?=MM 68) ......." ...... '~ -.

,.,

1'8".'."

'"."' hf= 4-'''''' ..... ,.."

:=:=;:::1:1;..

.....,.

~O"YI\ 'l\QK.
bt .

.....

t).

"1 111 ~. .

'l\Qf'l

~
method;'post'

'sendemail . php'>

for=*subject*>TeMa r n:</ll>
. put type=*text* id=subject- name=subject* /><br 1>

<~n

n"</ll>

<label fr=lvis~il~>~:l ~~~~~:s=.8. iS=** ></textarea><br />


<textarea id=elv~sma11 - 11
<input type=*submit* name=*Submit vlu=np />

</form>
</body>
</html>

8 ~

169

sendemai/.php

nOIlTII)

(sendemail.php)

sendemai1 . php

, . ,

emai 1_1 i s t

1 v i

s_s tore.

, ,

(sendemai1 . htm1). .

um&attUt U.<tpattU ,Ae~OftHOfb nUGbQ &

. uc.n,&attU ntpetHOO , _ f051:"

( sendemai1 .htm1) sendemai1 . php,


$_POST.

'noAtut ,n 5~ m5uUt tmiL_Lt.


PHP-II

mysq1i_query ()

SELECT,

. , ,

SELECT *.

'60I<a ~) nynm '" ~mm ,anp0C8.

.
, ,
.

,~& 1UUU iLO - omnpa&KU ,<mOftbIX nUct


- nynmto.

,

=--==--=~ .~~

......... .

(~': " "" "

..

. , ,
,
,

SELECT.

email - list
Iast

, {;rst;:.narne

juli@rkkizz .m

"'rt-U-W~

"

J\QI11e

t)u,cb.d

rt-UJ.

sunshine@breakneekpizza.eom

t) . r.\)O"I\ .
cu,e.aru,)O .r.

...

t)r~.~)

l"\~....)

u,\fQ

h.eodxo-lAbt

L I
\

---""

el'T1C\i,C-ist.

u.

..-

(,3 l'1\uu,bt

$_S.

....

~\t.bt.

170

u,

jones@simuduek.eom

."

SUn

u 603." ."

,
. $_POST
, .
, ,

$from = elmer@makemeelv~s.
$subject = $_POST [ 'subject' ] i
$text

"'I\. 1l 0Y'tr\bt ct

~ coxpctoeo llepeMe.ou, Y'tr\odbt. k


"'I\..3.ctu., . . .ctxu."'I\,

$_POST [ 'elvismail' ]

, sendemail . php,

MySQL .

email_list

u. 2d.-.u.~ e0.3.u.K.e"'l\

.dLA.."'l\ . tJ.je.u."'I\b.

cthr. .!.

/(Yrl.. I ~

Yrlt)pct~/(ct

coxpctKelibt Il D Yr)!. Yrld.I(.


t)epeMe..btx.

SELECT. , , SELECT
MySQL- ,

sendemail . php mysql i_query ( ) .

ll $C\uer~

JI."I\ SQ.\"-.3:\I1

g f:u C"I\POKU "I\eKc"I\a.

"'I} Q jctl1poc, '"'l\d."'I\

~ bu)..u.. I(O"'l\0P020 Y"II

u.3.bt .3.ct.u.. cex l(.I(

"I\d.uu,bt. e"l\d.i~_~ist.

= "SELECT * FROM email_list"i


$result = mysqli_query($dbc, $query)i
$query

J<-t "'I\YS9~i_9u.ery() U I1 0.3"l\

11 ..), ~d.~) ccbuJ.y


Q u...u. <:'Ju. ctbIx (~cl!'c)
u. 1\I( .3d.IlPOCd. ($9u.ery).

~ \.d. .d. u..u dct,30U. ct..bt.x


.du.d. "d.U .3d.I"\POCd.

Q btll..u . "l\d.U, ctd.)OUJ,u.

"l\. u..u, "l\.


l1 e pemet-U{.u. $dbc,

. en
?um, Ike, m() U() um, -

. $result

", 6n....

3!n() n.umu no m. ft3mm

n, <etiu ()m().r() nruce,()eti()

~__n
.....~eetiH()U tresult, maK~

$result
echo, - :

Resource id #3

$ resul t

MySQL,

, .

: MySQL-
,

mysqli_fetch_array ( ),

171

unm mysq/Cfetch_array()

mysqli _fetch _array()

JJl JJl

Janpoca

, ,

$result . mysqli_fetch_array ()

. ,

..,--

$row .
-

~C!. J<u,st J'cJ.1\ J\r. 3C!.bt.x

J1\\1\ Jdt)POCd D\1\


..71\ d.bt. ' 'oe .ctcc
I
$r~w
mysqli_fetch_array ( $resul t);
So.L J
cJ.. 0 '-~
C\:*:9btu
-J\t} u..ee1\ CMU
1. $row - ..7"n\O .ctccu', 1\ ~~ COC1\e~ u. .1\u.u.l(du,u...bt .,
t)e-'4d.Jlb. u.1\ t)epy}O JdllU.bb
I(1\btu IlJ1\. . 1\IJd
IL

d.bLx 4. JJJb1\d1\Q.

1(

d:.bt., dCCOu,u.U.POd.bt. .J1\d1\

..71\.

, -,

$row.

mysql i_fetch_array

()

JdIJpoca.

<J>yus1 mysq1i..fetch_81ay<)
COX~ anuc

gaHHbIx

. ,
u3 Abtnatn06 an
mysqli_fetch_array () , 1\ accu&
$row.

= mysqli_fetch_array{$result);
= mysqli_fetch_arraY{$result);
. f;r_l\Qnte

= mysqli_fetch_array{$result);

Io,,-,,

4..u. I(dg I(J<u.

\1\. u. ..7.1\d
.ctcc'a $row.

$row

172

$row

$row

,
,
, ,

echo,

$query

"SELECT * FROM

rn_ s

email_list.

t ";

$result = rnysqli_query($dbc, $query) ;


$row

= rnysqli_ fetch_ array($result);

173

CQMOe petUeHue

~u u
,
, , ,

echo,

$query
$result

email_list.

"SELECT * FROM email_list";

= mysqli_query($dbc,

$query);

$row = my sqli_fet c h_array($result );

~m9. .$J9.w[f.ir$~_t)~11~:1. ,.:.:.'..$.r:-9.wU<,\$Lt\<'\-wn~:J ..'..:..'.:. $.9w~:m~\.r.l ... .'.~ .~y: j? :"


..$r.Q~.. ~..11~ $.Q/i_f.~:t.clL~:<\~.< $. r~$.v.i.t).;... ..... ......... ............ ..... .. .........................
~m9. .$J9.w[f.ir.$~_t)~11~1:.:.: .'..$.r:-9.wU<,\$Lt\<,\-Wn~] . .'..:..'. '. $.9w~:m~\.r.l ... .'.~ .~y: j?:"
$.rQw..7. :m~$~.~j_f~t.9.L<'\rr~~.< $.r~$.v.~~)i .... .... ....... ......... .................. ..... .. ............ .
~m9. .$J9.w[fjr.$~_n~11~1 ,.:.:....$.r:-9.wU<,\$Lt\<,\-Wn~] ..'..:..'.'. $.9w~:m~\.r.l . . .'.~ .~y: j? :;.
$.rQw..7. :m~$~~j_f~t.9.L<'\rr~~{ $.r~$.v..~~)i .............. ........ ....... ................................ .
..~m9..$J9.w[f.ir.$~--I1~11~1t.:.: ....$.r
'. ' t.$.r.Qw~:m~\.r.l.. .'.~.~r.j?:"
$.r.Qw..7. :m~$~.~j-f~t. . - Me~ ra)bIrt'bIe,aeme. f!oe,morel-iue ul?yx
cmrOK , u , -- ;,a~mue,
~m9. .$J9.w[fjr$~... .'.~ .~r.l?:"
~ u-U ,uu. ye,epel-ia, m
$.r.Qw..7. :m~$~.~j-f~ .. n.
.~m9..$.

~~f!IIII!1~!!!!l'!!!t"~"..<.~.'1~i ..1 ....'.~ .~r.l?:"


($.r~$.v..~~)i ............................................................. .
:1. ,.:.: ....$.r.9.wU<,\$Lt\4.-wn~'J.,.'..:..'. '. $.rQw~:m~\f.l ., .'.~ .~r.l?:"
.< $. r~$.v..f:t )i ... ..... ... ....... .... ........... ...... ... ..... ... ......... .. .
:1. ,.:.:....$.r.9.w[.'i4.$Ln4.-Wn~]., .'..:..'.'.$.9w~:m~\.t'l ....'.~ .~r.l?:"

n n :
n.

,
, ,

. ,
,

174

6", ",

whi 1 ( ~ ) -

while

lJu

, - .
,

$got_custorners,

, - .

$got_custorners

true

(<<a~, ~),

, , ,

whi1e
nosmopgem Kog.
(whi1e)
ca.wogaemC9

next_custorner (),

kakoe-UO u.

while:

rUu. t)ol\op51el\C51 crwa. u. crwa., t)OKa.

.,f,

eCl\b l\51 ~~ u.. 11 0 t).l\.

while ($got_customers) {
next_customer();

~Ol} d"'tl)
t)ol\OP51l}bC51 t)pu. Ka.~OM

l1ol}opeuu. Up.KJk1..
}

~ 3.).u. . u,uKM ~.ypbt.e


..l\ .,.l\ t-l.l\
l\ Cl\POK .., a
.U'

, ,

, .

while,

a./HeT~ . .,

true ( .. ), ,

.9 Up. whi~e
t)ts'"'tI)51l}

.,

false ( .. ),

Ka.~o.o
11 0 l<I1<:1l}
l}ex

, .

t)op. 1101<0.

. "'tl)<:I.l}

next_custorner ()

, ,

false,

t rue.

?\.l\ t)poepKu.~u.5l

?
while

... u. true, u.30 fa.Rse I1 .....u. u,uKM (-t.ru.e) u.u.

t)r...u. u,uKM (fa.Rse).

(test_cond~tion)

action
}

.u. ~.o.o

.3....

whi le

email list?

8 ~

175

while()

0660

whi le

while

. ,

mysqli_fetch_array ()
$row,
- tA' d ~i~e ..'Yf\. _
. while J.u., Jdd/. J(u.
mysqli_fetch_array ( ) ,
'Yf\~s<1~i_fe1~_drrd~(): tru.e

, .

("tAC'Yf\tAM) eC'Yf\b tA
u.

u.x

u. .9a..bte

fd~se (")

.'!!\.

} ,
t)du,u'

gbu')-
I1. )/(,.90,

t)pox 0.9
u,u,KJJct.

email

I
I
I

,,

iuli @rkkizz .m
iones@simuduck.com
sunshine@breakneckpizza.com

2-..

\
\

ltkn

\
\
\
\
\

176

ClJe,q"
"

'~

" rlOlf
O~OA,

qltl{JJa

, ,

9~~ugoUQYt, U~J~~

. ~~Q

1(

j.~~

.fv'I.QCCU.::t

..~ coo~e)Jc~oQ~b u.e~'

: julian@breakneckpizza.com
: jones@simuduck . com
P~aHa : sunshine@breakneckpizza . com
: bo@bOttOmsup.com
: amber@breakneckpizza.com
Hep~c : churst@boards-r-us . com
. : joyceharper@breakneckpizza.com
: meyers@leapenlimos . com
: martybaby@objectville.net
'i : walt@mightygW11ball.net
: craftsman@breakneckpizza.com
: joe_m@starbuzzcoffee.com

I(J(tJ..

IJUA while

npoxogum

gaHHMe

tnaAU\,Jbl

nu
anu.

org nuceil
UJe
\}UA

n.aetn9.

'-

()

$row [ . f 1rst_name' ]

' ,+

1 Q
\

$row [ . last_name' ]

~ .~u~~~u Jbt Ut\ .


.u~.~ ~u.x C~POI( ~e .3
<l:t)), Q o~epQ~Op ~d.

while()

tfG ~iiG't1I,

ZV11bJ- ~011OCO~

'9:

while

.? , , ,

true false, .
mysqIUetch_array() -
, $row. ,
n true/false.

: . ,
,

true.

, ,

false, true. ,
mysqli_fetch_array () , $row
( ) t rue,
(), false.

while

SQL- CREATE DATAASE



.

SQL- CREATE TABLE


, ,

()

'9: ,

3l -

true false?

SQL- DROP

: . , whi le

TABLE.

true false.

true

false. , ,
() false, true.

mysql i_fetch_array ( )

'9:

while,

mysqIUetch_array()

: ,
,

mysql i_fetch_array () false.


while , ,

'9:, , pw ?
: . ,

, .

whi le:

while (true ) {
,

whi 1
,
.

~:;':::=:.~
1Cacuoe. ~a, .,.

C~.IIUI .. ',,_

Ae681:*I ..
"01010

1111.,....."'11 ~ac:"' f8l\'I>

Co,'aatlU~ IU--cf''" -.'''''


:JA_ "", Uff~QlUII
)i\ o"np.'KU ..", COfJI8GIIO i\Ucmy
P8CQIi\1I.

l .J<1~""''' ~ dC

ce . . bt!')..

'l\0"I\ !').uU
ll'\dl') . t\O.z.

,3ctw..u. Pddoll'\bt.

178

MySQL

, ,
, ,

mail(Koy,

, From:

rnai 1 ( ) :

<?php
$from = 'e1mer@makemee1vis.com';
$subject = ............................................................. .
$text = .................................................................
connect('data makemee1vis.com', 'e1mer',
$dbc
mysq1 ~_
.
,).
or di(' MySQL-.
,
$query = "SELECT * FROM emai1_1ist";
$resu1t = mysq1i_query($dbC, $query)
or di('m

'theking', 'e1vis_store')

.');

whi1e($row = mysq1i_fetch_array($resu1t
$first_name = $row['first_name'];
$last_name = $row['last_name'];
n

$msg = ' $fist_name $last_name, \ ............ .. ..... . ....... '

$to = .... ... ......... .......................................


,
(

echo

..................

.........................

' :

...................

'From:'

) ;

...... .... ..........

..................................

'<br

mysq1i_c1ose($dbc);
?>

sendem<il.php

179

sendeai/.php

MySQL
, ,

, ,
. - , i 1 ( ) :
mail(Koy, , ,
<:\3-m LtJMehu-m flr\o?" <:\9
~

, From:

-m..u. t)'\bt cO -mbtu..


<?ph p
$from =

$ text =

,
$dbc -- mysq l'~_connect( ' data . makemee1vis . com' , , )' e1mer'
.
or di( ' MySQL .
,
$query = . SELECT * FROM emai1_list .. ;
$resu1t = mysq1i_query($dbc , $query)
or di( '

$to =

<:\ <:\1-W..
u.ee-m u... e.l'V i S"t\<:\ i ~.

$first_ name = $row [ , firscname ' ] ;


" '_n~a " $row [ , laa '_n~a' [ ;

' e1vis_ store ' )

"t\.. t)u.cbc\

whi 1e($row = mysq1i_ fetch_ array($result))

$msg =

' theking ',

$fist_name $last_ name ,

.' ) ;

D .d..u.
-m..
UJ Lle.u.

"cb~ coc't!O't!

r:
_
'; ~$ J tex:.t; a?~eoGO COO'Yr1~C'tJ\J)()'jfee
'"

]t)<:\-m. u. .d..u..
;"""'I""- t]b"",

t)O]Je CPOpNbt.

mail(

' From :'

echo

' <br / > ';

J'--"

mysq1 i_c1ose($dbc) ;
?>
.~_

...

.:\ 't!<:\duLt.
Lle.eM e-m<:\i..f

.u-m <:\.9
't! ..
t)Yr) t)I(t)<:\'t!.,
l(o't!0poy ..

dbl.'t!b 't!t)<:\.

't!.. ".

180

bt. U"t\<:\'t!. .'Vl\<:\)\'\.

Ot)<:\c.oU t)f<:\K't!UI(<:\ t1.<:\<:\'t! ~bte,

.J-ibt t1 0 't!u)\'\ cc:\'t!c:\,

. 'VI\<:\i..fO J-tet))\'\..,

< l1'<:\u-m,. t1poepl<l)..

~ c:t u.,yicI.:\JC'II1 .o-mbl.e

~.uu I1pue/Y\bl. ...u flr\


t1d/Y\bt.

6", ",

)_. TeCT-JJ.
nlIIX ynaen., cn

ncr ccwn, n

n .

U:YI\

6- . . .

'!\ .. :

" ". apecywww.headfirstlab.com/books/hfphp.

u.~,

Yl\.u.

chapter03. 6- .06
., 6-

t'\'!\bt..tt
~1:.'YI\ u.'Yl\

sendemail. html, (style. css)


(el vislogo. gif blankface. jpg).

pacCbU1KU.,

g-

J'YI\~1:. I:.

sendemail . php ~ I"\O~u.J1u.


, l .

Yl\tt!'t

l'1u.cbMo.

sendemail . h tml

... l
~l ,

MakeMeEl vis. , PHP-u,;ttd.u.u


, 6-

O'Yl\l'1po.{)Kd.

, .l .;I ,
.l. ~ . while,

u.'Yl\~u.'YI\ttO

t'\u.cbJ. ttd. ~pe.ca

. . PHP-. ,

'YI\.u. \')'Yl\bt

'Yl\t)...'YI\

'Yl\ttttbt

: . -@-.m.

1')0~d.'YI\u.

u.)OUJ,UX.

dct,3e

ga~, 1'10'Yl\~

~'YI\ 'Yl\';f..bt,
dttl.u.

u.

~~1~::a~....~.If.~==roo~11OI'I"I'"" : julian@breakneckpizza.com
_

: jes@simuduk.m
: sushi<Cl>reakkizza.m

"*"""""" -

_.........
.
~,!!............ ~. _ _ _ _
.
.~
: ,........ _ _ _ - 1co~ XIIl
~____

.... __

... ---

:::~_-=:.=_
~........

: bo@bOttOmsup.com
: amber@breakneckpizza.com
npo : churstOboards.r.us.com
., : joyceharper@breakneckpizza.com
om: meyersCleapenlimos.com
: martybabY@Objectville.net

.1 ll: waltOmightygumball.net

~ _ .... _... ,. .. __,... _... ~ ......... " ......_ ........- .. -..... _........._..._... - .'1 Ol'pa.r8eHO: craftsmanObreakneckpizza.com

(o~,; \

.,-rII()(' :j_mCstauzzff.:m

1 111: bruceCchocoholic.inc.com
: prOhoney.doit.com
: bertieh@objectvi!le.net
: bettieh@breakneckpizza.com

_._.,./

lJ

..,Icrp< : wiliamwuOstarbuzzcoffee.com

. : samjffe@starbuzzcoffeecom
?ll : Is@ojtv. t
.
. J<r : bshakes@mi htygumball.net

181


. ,
,
. , ,

_
", '"
!

!
tie

titi

ti
. ntiti
, tiO tie
ti

. ti,
,

",

n",:: ~H ", :,
n ", n

n.a _ nn
,,""

nr, UU

., OCoetl uumuro&amb r.
uum mu UW
n ru Urwmum
mtJ.\U .

:i n;
. ll(, (~
. ): ' ", 3 ;Qa,

titi :

cbriggs@boards-r-us.co

------------

' dY@tikibean/
. OUnge.col7I

______-JI(:::~~8~~~~,

'
- .
, _

, , .

,
.

bP@honet-dit.I7l

'

. . u,

.90. 1\... 'flI'\o


. )1U.1J.!Q.'!\. . 01Y\Opbu<
110l'~1\.u., . . .9 0 ..

.9 0.1\5l1\ u.x I1pocbbt.


~t. u.x u3 u1\~
dbtl<U.

MySQL- :

email_list.

, ,

,
. .

182

z3

DELETE

,
DELETE (<<). DELETE

-,
...

(DELETE) .

SQL- DELETE .
,

:tr=:;::~=:UR

... a paccH,tt;

'~&lIIIe.ei

'1' '1'.... (C.A06at~Ulue


1108010

A8t'1"aJRC.". " f8eebIAI'''"

WlCIC"f'8111180 "8~ln"''' 11 4 611111af'1III

~.'>A 8""l'alll "1I~ln'" COI'II8CIIO ,"?

DELETE,

, I-I.CI.

DELETE

.e.oxo.9~ .ct.
Cl\Yf1e..b ... .ct

.,3 ctz.-u.d

I1Mbt ..-)!\.!

z.pctu.ct~.z.ju.

.,3j\tl\. I:.I)...
3ctf1 poca DfLETE l\ctu.up
dj.9e.l\ u.L. Ol\ ce.x
.9.c:lu.x. .. .9a .bl.x.

, .

DELnE

oro, .

.
,

DELETE,
WERE

( ). ,
SELECT ?

11

23

. ,
:

DELETE FROM ernail_list

WERE

first_narne

DELETE FROM ernail list

WERE

first_narne

DELETE FROM ernail_list

WERE

last_narne

'';

''

OR last_narne

''

183

DELETE

WHERE

~weHue 8ll:., ". .,,"". ." .,


,

23

11

. ,
:

DELETE FROM email list WERE first_name


DELETE FROM email list

WERE

first_name

DELETE FROM email_list

WERE

last_name

.23 ...

'' i

''

If0

WERE

OR last_name

''

.3.3...

WHERE

IX

DELETE,

, , .
WERE , .

DELETE FROM email_list


WERE

I(J-U

"l\\u.u,bt..

email

Q.Lte, I<0l"ll0poy ..
coo"l\e"l\c"I\ot{<I.'YI\b <l.qpec i<"l\.n
t)"l\bt, "l\bt J<l.t)u.ct, !. Y..9<1"eQ,

-r@hn-dit.Qm

~ ~o. <l."t\
bt<l..u.
W'HERE
n
J
-

t)u.J~u.'YI\ t'\po d..gu


.3d.t)u.cu. YI\<l.du.u,bt cOOYl\ge'Yl\cYI\u.e
.3.:s.~.}t ja .u.).

WHERE

.
(=) ,
,

email

pr@honey-doit.com.
, ,

,
first last :

11=:
vv 1 u:.1'1:..

uuaem
.

pacnpocmpa1-m

onpeg
nucu

184


, ,

WE1\E

WERE
,

oruuaem

email DELETE .

WERE,

pacnpoclnpagg

. ,

ero

WERE , .

onpeg
nuCtL

DELETE FROM email_list


WERE

email =.pr@honey-doit.com.

Il.3 0 d.u .u.

eYl\d.\~ .d.uu.d.)Q..

u.u. Wf\IRI 1l0.Yl\

email li st

YCYI\d.oou.YI\b ~.u.d.b.Yl\
u. cW\(,d,eYl\ pU.CK d.u...
Jr.Vl.u. 3d.IlU.CU..

fInt~\ ~~ 4'

" ..

..,

-""'1.

I~

wilmawu@starbuzzcoffee.com

--

Is@objectville.net

bshakes@mightygumball. net

johndoe@tikibeanlounge.com

samiaffe@starbuzzcoffee.com

I( firsCIld.YI\e
MeCYl\o I(u. 11d.i~,
,711011 11 t)d.11 bt.

gregeck@breakneckpizza. com

,j

,n"_

bertieh@obiectville.net

Ju.u. '-'

n. -

.r:

bruce@chocoholic-inc.com

dbt. 11 ,19r.Vl..

m""' ~

ioe_m@storbuzzcoffee.com

Iu. !. bt.
U.C t) ..u.
o.p'alJ. u.d. ),..

/\k

grommetp@simuduck.com

')

..

'

185

- n

DELETE

-
DL
lI.

MySQL
1_1 i s t

DELETE. ,
.
WERE DELETE,

. an ll ,.
ll

r lI II.

, ,

- . L-
- ,

DELETE . FROM
WERE.

186

(removeemai1.htm1)
-

. , ,

email .
removeemai1 . php,
.

~~8iiiliiiil!ft~~I

ct4'"1\v. KDI1KV.
<tJ1V.'"IY\

'"lY\I1~.'"lY\
~ct.bt.e <>bt
~ v. Jctl1pocct POS

u, '.

<?php

$dbc = mysqli_connect('data.makemeelvis . com ',


or

di('

mysqli_close($dbc) ;

'elmer',

'theking',

' elvis_store')

MySQL-.');

removeemcil~

?>

8 ~

187

.,U removeemail.php

(removeemai1.htm1)
-
emai1 . removeemai 1. php,
. , ,

"l\20

avsM~EL.V;~.CO

I) pop.bt. _
..neneJPOllOli nOWlUlyeItII
e"l\cti~ .
~ ~3IIIjIOOIinOW:
..,
(_)

d..ct1\U, KtW\1KU, . ct U,1\

01\\1ct.1\ .ct.bt.
bt u, .3ctt)pocct POS
u, PlP.
. ."'II\t1.OCi t)o'-h'!\bt.,

.4U,u.. ~2ct.
Cl $_POSI d..."'ll\.
l'\..Ci u, U,t"\.31\.
.31\ .3d.l'\poce DILITE.

removeemciI.html

$dbc = mysqli_connect('data . makemeelvis.com,

188

z3

'elmer',

'theking',

'elvis_store')

n 6

',,' ') oa""1II1( 11 IIIailllllo.,4}MI


.....w6.1

pycWttt.

..
~:::=:a_"O&OIO
~II!, '".{'''',,''III Aoia&AQlu~
"8ItJ'"'MII

!X>"II u.

ce, ~

t-\4.u,-1\

.31.I(.uu.!

& Aachl1'81Ce1i1i\1t1lo

:-A=:~:;==
i~III1'81i1ill "8""'''~

4}I 8"'''1'1.1111

11 f!Wf

l1li'111"1111

118""'' eolCllO II,

,.& Ihtt

'~81ll1e 8eS

'1'0"11" 1~"lfiIllle

"O)"lllllu,1I ~ fll_l'"IIIL

-[-
n noynaen. n ,
nlt. n n .
, , ?

~
www.headfirstlabs.com/books /hfphp.
chapter03 -
removeemail. html, (style. css)
(el vislogo. gif blankface. jpg).

" "~

removeemail . php

removeemail. html -.
~ ,
.

~~EI..V;~.CO

'*""'"-~ ...... ~

~~IIO'fIW;

! ~:u;;m---_.~

~')

189

n !

MakeMeElvis.com -

be6-J

MySQL

MakeMeEl vice. , bl bl
.

MySQL

bl - .

L-, -

SQL-
bl (

bl ). ,
bl ,
bl bl.

/).; ;;()r>Ctl~t1 11-tf UMySQt..J


1enerb t10 (?W'-nrUe!-iU. MOry

ll
n

t1(?t1 (? Ut1 ru, t1nr(?t1 nUCbMa

o6aIIAeT

(? MOUM t1 U() COKrau.\3t1b Ut1 ...

HOBoro

n n

U(? t10 U) MoerO (?W'-oraj3era!

n.
odderil.php

~V;S.CQ

=ra=--=.....-..
~~~_

.... .. ..

~~.~

....... .. ..

ll
n II
n
nlO cn

sendeIOOl.php

-----..~~.~~. _ ....

[:;;;;;.)

Ot1(?e t1nr(?ut1!

)'VUt1f. Me!-i, nt1,


U~ Ut1 ru er.


n )) n.
n. n .

190

KpOCC50pg

u MySQL

, .

r0

1.

,
.

. SQL- .

4.

MySQL

. SQL-

2. SQL-

- .

. SQL-

7. SQL- .

~ .

5. cn

8.
MySQL

SQL- ,

9.

11.

10.

,
.

12.

MySQL.

1 . -
_ _ _ _ _ __

191

KPOCC50pg

192

MySQL.

u ",

MySQL
.--~~~~~~~~~

DSRr ~ N

. ~ .u.o 3"Yl'\

C"Yl'\pY'trl,Ypy "rI}ddJJU.u,bt, "rl}"Yl'\


3dl1poc- .;mo,."m I{'yJ!6.o.
~ pe3J'lbll1ct11'\e gI:iU,J-le1-.
!m0~o SQ.L-3Ql1pocct gbt.
J-le fi.1\ 4J(< ctbt,x

ct; .~ 1\ctdUu;, '


. YJQe"rl}e \. cex
u. 11.t). bt.Qblx,
jfl,.YlIl dbr.lI1b g <
DELETE FROM

FROM

~ tJ

~OI)3'u.1\ .7lI'j01Y\ SQL3dt'\poc 'y~1{LI.5f.


3dt'\.i1 1,;\.31\ctLl..
~ ~.\.1\. 011'\ "al0~0,
KctK ,gbt. .t'\QJJb,1\
lf\1\ 3dl1poc, gbt. Jl<,e1\
.9ct1\ I{ u.u.
3dt'\.u..

6bl ~

193

.IlI .-n"" -.-

4 frlJ\f u, 11f~11t,U,qcc1;u,c 11fU,J\oJJcr(Utjf

.-

-*

~u 0311311 ~ ~)
aUJUHbI MOeU ~umu,
aUJuHa )~Wem. HUaKoro ).

morCJa m ) )m,

ycmroumb , m m
) ~um ~O 0311311. orCJa m
KomOrbIU ) )m moro, KomOrbIU
u )m...
em

-r

or .
.
6- , , , .
, , , ,
.
uu, , n ..

..3 peJlOllMa " .. .


SQL.

195

3 n

JJl v
, 110

. ,
, , , I10aJl

110

.
. .

: " amo <dennyOmightygUmbaI!net>


....: c&n- ony

I
I

: 24 Q1Cp112008 r. 12:20:29
: neP elmerOmakemeel.com
nIIeP.~

i
!

I
!

: ..........

....: WWEO

- - <aJ,sons@SlarbZZCOffee.co

: nep

r: 12:18:50

nr.:::

.a: 24~

~~,

I,

~kemeea.com J

~I

~ l1OC7OJIO

!!!I---t{
_,.1

... - - _ . - lIIICIOe I8 ""


...
' ! "."
n ...._
III" I81IIIIeIe
~~~
"V_, I1'. Y8l1lne . . "
: " ' , - ~ lIOC)nan
/)Ieoro
, ~ 11311W8ro lIIItra ~

AiJCO -~.
p.s. lII7rOPe
,

m . ,
cl?~o ",

11IIte~,y..,,~
CIoIJ.

? 3.cte'Y\.
'\ '\..
t\d. U u

J9 '\ .ct l')

" '\. '\bt l').'\.

'\ . t\?UU'\

U'\U'\.'\U'
196

4.

OmnpaI?Ka r.U :? _

n., nuUR

11t,~Jib11t rJgMU,Hu,c11t,irJ..11t,0iOM

J\u,c11t,rJ.. irJ..ccblJ\tu, J\GirJ..


g

U Sb19CHUm.

nS9cs

nycm1e

nUCbMa.

nogpesam s S9
q.tt sendemail. htm1.

d.I'1U,U,1\,

jQl()d.1\.

I'1Q

1')0

mh..eJ-.)

<:J

~lIIIIIOpOIQu.~ _ _ ... _ _

(~ )

ser ldemciI.hlml

8 ~

197

6 3n

1ilfb11bG rJgMU,lf U,C111>frl111>O

J\u,c111>rl frlccbJJ\l;U, J\Gfrl


g

, \

69CUm. npat\9cs

, nUCMa.

Ha\)UUlU'YI'\e. eJw\
.}I(}1)O,'Yl'\st

nogsam 6 69
q sendemai1.htm1.
.Q..d'Yl'\ Korll<Y
Oml1pau'YI'\b .} JdI10.f.
\)st .94.u l<'Yl'\..

~M~EL.v;s.co
1I8POOW,O: /1II OIyII88II8Ii nepe

=:~~I*C/JIIII~ IICIO/1II /IOIyII88ne,

3I1epOttro 1IICI8:

~~

. ... +

..

_._._-----,

.--~~

sendemc:iI.hlml

tu d41r\ Kor)l(Y O'Yl'\\)pau'YI'\b


OMeo'YI'\. ..9 \) 0.9a
.9 4.u 1r\...

\)ucb.a .u. oe'Yl'\. .9 1\

01\t) Il1\ 'YI'\..


\)ucbMo. . 01\U1\st
1I0) 0.9 . 1\...
lIucb.a .

198

l1ucbJ.'d. dY.ge1r\ 'Yl'\l1 \)yc1r\oe


l<'Yl'\. l1ucbMo.

1)0 .

u nmuu nuUR

3
, .
. .
, ,
, .

6 , -
, .

-,

toIIlJ1IIIII118'...~ IICWI8:

'-'--'1,

--_-_-_-

,
, .

. _. . _. _ . _. ._. . .J

sendemail. php, ,
.

\ cu,e~Euu. set1c:le1l\C\i.f.p,p t11.1I\\1l\ ut10J\1I\ 'YI\el{c1l\,

u.uu ,,, 1I\o~o, YrIbl. cOJ,9C\1I\b l{1I\DJ-


t)U..,,9de u t10J~'YI\ .u. . KeJ.

el<c"l\ I"\u. <>Dbt ~l<d"l\ UJ ll,efeMe.btx

'e lmer@mak;;:~~~~;: com'/ $_POS['subjec{] u $_POS['e.f$isb~i~t]


[sm' 3;
~ $~~~~::~c~$:=o~ su
$dbc
or

= mysqli_connect('data.makemeelvis.com',
di('

MySQL-.

$query = 'SELECT * FROM email_list";


$result = mysqli_query($dbc, $query)
or di('

'elmer',
');

'theking',

'elvis_store')

.');

~dQ JC\I<\1l\ 'YI\.., YrI

while ($row = mysqli fetch array ($result) ) {

$ to = $row [ , email ' '] ;


.
UJt'10J,, t'1 ,,. $text
$first_name = $row [ , first_name' ] ;
/
fteJC\~ u.cu.o 01l1111 0 , .9u.1I\ -\
$last_name = $row[' last_name'] ;
~
1(\l(u-u. 1I1 e l{C1l1 Uu fte 1l1 ...
$msg = $fist_name $last_name, \ n~~E;pgf,," ;
($to, [~J'~, $msg, 'From:' . $from);
echo

' ~_____:__' __, __--$_t__--_,--,<__r--/_>--,;

mysqli_close($dbc);
?>

, , ,

sendemail.php,
:

199

sendemail.php oaHH tJ1 X

6 ,
<i
. ,
, ,
. , .

KompoAb
gocmocmu

npcogutnC9.

yegtltnbC9

, , ,

... !

gaHHbJ.e.

, lI ,

om

. ,

naerne.

. , gaHHbIe.
. - . ll om
, ugaeme.
. '\bt ~pe c

l1

c'j:>..1\ ~
I\j, .

t')t')d.1\51.

. dbt1\
t'10.bt.,

lIeOepu:YI\b
. -

3ctKdJ jYr\

Yr\l\..
Yr\ 'YI\oM

110~IId.'YI\.,

.,u

...
.Yr\d.

1') OKYIj<1.'YI\.
U . 1')0'f'l\obtu.

'Yl\UYr\.ct
U .

....

..9
UYr\U'YI\-

.Yr\.,
,
,

sendemai 1. php.

, , - I\

sendemai1 . php, II, II


. sendemai1 . php ,
. ,
, .

n n.

n.

lO
n

n .

. cn

< form a c tion


"s e ndemai1.php"

.,
onpan.eT
n

. cn
-

____

~
V

~---

W
n

...
r.

n.
L-: n , n n

n, n , wn
.

200

u nmuu nuUR

AaHHblX
)
,

sendemail . h tml,

.
. ,
, ,

sendemail . php.

: , ~ .

4mOdbt ~.rtbte. u.'VI)du. 'Vl)&.bLu.,


.du., "tI'\bt 'r0,9u. .9 'VI)aKtAX

u... .

TorA

fu. ~Q)O'II'). 'Vl)u.

u.. ce '}u.. u. bt
'}t)..'} '}..bt t)u.cbc!..

!. t)bt.u. ll1..bt t)u.cbc!.

.u. . dt).. '}0, '-I'YI1~ tAe..o ~

gg. g '}u. t), Q U. g gg. u.

'Y}Y.9 Q '} '-I'YI10-.u.d.

CIII:

I\) t)poepKu. . 1f\.'!)

bt dbt'Vl)b .U,\u.. "tI'\ .u. .


t)u.cbMO . 1f\ 01f\t)Q ., u. .
.. .e1f\ .btx 1f\. !. .Jv\ U.J 1f\tAX

t)u. .

IfG ~iiG't1I,

ZV11bJX ~011OCO~

sendem<il.html

~; , ; n
n, .

. ,

; .

, m
. , JavaScript,
n

.
,

Head First JavaScript.

~; 3

,
n?

sendma i 1 . php

.
,
. ,

n
. .
, -

,

.

201

ynptl8llRIOQR KOHCpYKqUR if ()

,
Jl Jl

i f

1I

()

ar JI. .
, , ,

.
, .
:

JI eJUI npo, JUl .


-,

yn....lOeiii

If

COCI'O 3 'ICIcei:

if

i f . ,

ryp .
,

I'}
~C\ C!Zd. I<061<\
JC\l<pbtcte"WI

dI( I(~,

<>.9S1.u. COC"WIC\~
J1j>C\ )O(.IJ,eU
l(oKC"WIpYI<u,uu

202

if

ZQ4

true

() .

i f ,

nmuu nuUR

i f

true

false.

, -
. ,
true,

false .

.. ~.u.e.
t'\

~e"y\ 3t:\e..u.. v.~

-tfue..

v.~ fd~se.

if(

----------------~~-- ~
TorA

fillOrder ( ) ;

u 'j. ~.ue I'1pu.l-I.J..(,Q'll'l

Jd.u {, 'II'I.d btI'10..'ll'l.


~I( 1<0.9", .ubt cpu.Z\lP.bt.u~

CI(O~I(dJ.\u..

JI

.
- . ,

~O'll'l 0l'1ePd'll'l0P 'dd'll'l

. ,

{, .u ,3d.u

t)epeMe..oU $~iPPit)9_stdte

if

.---

TorA

~ "\.>:9 'll'l.. 'YI'\I("\o

c'll'lp0l(e ''.
($shipping_state == '') {
$tota1 = $tota1

u. jo. ~.u.e

* 0.9;

~ I'1p~e"Y\ !:\.u. {.

"\. bui.."\. d!(

!(~ 1)0 I'1 ."\d.u.'IO

10%- CI(u..9KIJ..
, ==

( , ).
.

, .

,-- ,3(}I) 'll'l u.d

l!bt ..'Yl'\
I'1poepu.'II'Ib
'II'I :9 'll'l.. JJU
,3d.u ..
l'1 ..

,3d.u) .:..

($nwn_items == 10)

($shipping_address

I<dbtI<IJ..

$bi11ing_address)

(2 + 2 == 4)

~ ~ .."\ u.ct)oJb,3oa"Y\b dl.l."\u.u.


Ot'lepa"Y\opbt jo. ~...u.u..

ir

AaHHblX &10~ O'l~~~;~~~~

i f ,
E::!KU,lJ.K_
. i f , t1 gyr_
- . ,

true,

, .

1!1 <?

H"KM';;;;::~H;==:PHM'H:::~=:X;:~H;;;';;:;;:;;:"/

ll : <>

if ($smll_nb <> $ig_nb) { echo 'True';

!=.


(==).

~m, . (> )
, ,
,
, ,

if

($smll_nb

if

($smll_nb

1=

echo 'True' ;

$ig_nb)

~ ,'"\1Q"\1 )'yJ
>

$ig_nb)

I1poepl<u. -

{ echo 'True'; }

., .

u.c:YI\u.rtd.

ll, , .1

,
, .

if

($smll_nb

<

$ig_nb)

{ echo 'True'; }


, !> .. (>=)

, ,
,

,)'yJQ)'yJ )J I1poepl<u.

if

($smll_nb

>=

$ig_nb)

{ echo 'True'; }

if

($smll_nb

<=

$ig_nb)

{ echo 'True'; }

Oiuem m<.Jm ()

, ., . (,
, trlle
,
.


, . ~paBHO.

=)

, ,

, ,

, . ),
. true
,
.

n, ()u.luu mecm?

u m~um ~om m

~ ~ru: ("d0,9" ) "()?, CII

nlllO

if.


, ,

",, !> , !>


, ,
.

204

l4

z.

nmuu nuu

't1l,~Jf1 cfCi\O~lfblM ~bjfr1~GlfU,GM ~ cf11f~i\.fflO~Gii,


l;Olfc't1l,k1Jj~U,U, jf
g - Upaffib U9
yn9t1 KOHcmpyuuu if U . ucmUHa
uu . g U . 68.\

npeg9 9

$m_m

$a_decimal

npo6epKU

''

$another_number

==

4.6;
'';

$favorite_song =

($a_number

egyu n:

($another_number
($favorite_song

($favorite_song

== "")
== "")

==

($favorite_food =

'')

'hamurger')

true

fa.se

true

fa.5e

true

fa.5e

true

fa.5e

true

fa.5e

true

fa.5e

true

fa.5e

true

fa.5e

true

fa.5e

8 ~

205

C11\,rllfb1h,G j'C1\O~lfblM ~blfrl~~lfU,~M ~ j'11f~J\j\'~ii,

~Olfc11\,IJ'~~U,U,

jf

g - upatnb U9
yn9'Q KOHCmpYK:UUU tf U m. ucmUHa
uu . .g u .

ttorga

58.\ 6gyt

npeg9 g9 npoepKu egyu n:

$my_name

''

-- '$your_name')

==

($favorite_song
($a_numer

'')

> 9)

($favorite_food

Q, hamburger' )

I.L b!. 1\l1\ I\~lJ.1\,


1\ . "V!\..bt lJ. 1I'\lJ. .

"_,,)

odoeK"V!\d. ~. ~.J ..90~rt


bt1\ l\.1\ 1\~"V!\g. (--) ,

. !"IPlJ.G~dlJ.a.rtu.5l (=),

IfG

~iG't1I,

1!11 ~011YOCO~

'9: n cn n ,
if

cn n while?

: , 3 ,

, ,

. .

206

zs4

whi le

n., nuUR

AaHHblX
Jl

nOIlTII)

, sendemail.htm1.
.
. ,
, ,

sendemai 1. php.

06 : , .
.

$subject
$text

$_POST['subject'];

$_POST['elvismail'];

06 ,
.
:

Cn
,

TorA
06 ,
06 .

06 :

sendemcil.html

Cn
,

TorA
,

i f.

i f.

i f,

echo .

207

isset{} empty{)

~8Hoe qu

i f,

11

~)O

OM~IA1,a5t 'l!\op~

echo .

:fI')<)\AJ\j)

I(OtI.C'VII:P~I(Uf.A)O if ttjflpu.

I I

e .9)u ".9~,.9 0.9 Uttd pb1.e

if.,( $.~.~~j~~.t. :=7~. ~~I.<.~. !1.~~"!1)~~~...~..~~~:,,!!y~. ~.~r.~.~~'.. ..


:'~~U~~~K~~" . if '<$.t.~t..~:=:.:.'.).[ ... .................. .. .. ... ........ ..... .................. .......... .

t'\epou

(ttjflP~ )'

...

rf~: :::>S~:~~:~~::::~==~:::~:~7~"u~-<r
'n\\. bto. bI.t'\tt

J\\.~u\1\ .JI'I.... ".,roQ


tt1\u,u if,Q .. - ttl.USl..

I(OJ.tt.9 C1 e~o.

PHP-

== ,

, -.

isset () , , -
. empty () ,
, (),

false

NULL.

, :

(' ,

"

,,),

34~e.u.e
"..

$2

- . l1ycvr-:.;

1\\, o.Q

. u1\

1\'\. 10')J.

.71\ .

btfd..u.

uee'Y) J4.u.~

208

l4

muu uu

f!.  ut\~m ~YHK issd()

u emry() ()t\f! , m nrO~erumb ()ocmo~erHocmb


() not\e <<1 ,MemrOHHoro
u ()eru , .
, .
tl , tl
, tl

empty()

$subj ect $text


$_POST [ 'subj ect ' ] $_POST [ 'l vismai l' ]
$_POST.
isset (), true
, - .
,

isset ()

, - .

empty () ,

, .

>us ~t( ) npoepgem.


eyecrnsyem u n9

nuae u

eU

k.akoe-U50

8.eu.

>us

empty< ) npoepgem.

cogum u n9

1ft 8W~iit1h,

Zl111blX ~011OCO~

~: isset()?

: isset () ,
, lO . ,

POST, isset ()
$_POST.

k.akue-U50 enyce gae.

~ no,.6amllllb

i f,

empty ()

(==).

iJ

J>

209

uu (!)

~e"ae u "", " 'I"""" '''''', ".,


i f

empty ()

(==).

~..i.f..(~~p.~~($.~~~j~c;:~H.( ............... ................................................ .


0I'1~'YI\0P

~O:xC;~~::x

~..i.f.(~~. mp.i~($.tMt)).[ .... .. ........ .. ... .. ..... ... ................... .. .... .. .... ...... .

. . . .~.~. :~.3<:'.~~.~~.~1')~ ."!!I.~~.~. ~I?.~r~~~ .-!.-mp.~I:t:f:I:C?~9.

btd.u...x
.~~~.~~:~.~~.!.~.~" ""'"
d.IOt'Yl\. ..}

~~~~~yJ(Ui'UiHHHHH

nL

"1'..vIt>KOU

..

1(0.9

~ Je1GJt

&QI'f Q &10um

Heomorble QeUm&u, u &&

c:pOrMbl tl nycmoe~ CytJ.\ecm&yem u


u notem~()~

, C'It r

lOr

ycnoBHoro ...


i f,

, ,

true false. ,
, , ?
, , ,

. , notempty () .

(!),

true false, false true. ! empty ()


empty ( ) , , ,
.

:t1.~;:~:

((\t'empty ($sub) ect))

210

~o ~. bt.pct...u.

l"lpctUd'Yl\: ll d ?bL

.,.1.. 'YI\rJ-W~ t'\u1..


. l'1~c'Yl\0e.7::o uu .U'Yl\ u
'!\ t'\ I(dI(Ue.-U~ d..bt.7::0

"bl

u npom.,ecKe nuu

sendernail . php ,
$ subj ect $ text
i f ernpty ( ) .

nJI ,
.

Ma~M~tl...v;$.COM
n.pcoanbO: cynaee llEl

om n oynaee ,
IOl.

nepotlO nCb8:

i...

<7php
$frorn = 'elrner@rnakerneelvis.com';
$subject = $_POST['subject'];
$text = $_POST['elvisrnail'];

sendemcil.html

if ........................................................ .
if ......................................................... .
$dbc
or

= rnysqli_connect('data.rnakerneelvis.com',
di('

MySQL-.

$query = "SELECT * FROM ernail_list";


$result = rnysqli_query($dbc, $query}
or di('

'elrner',
'};

'thkig',

'elvis_store'}

.'};

while ($row = rnysqli_fetch_array($result)}


$to = $row['ernail'];
$first_arn
$lst_arn

= $rw['first_arn'];
= $rw['lst_arn'];

$rnsg = " $first_arn $lst_arn, \$tt";


rnail($to, $subject, $rnsg, 'Frorn:' . $frorn};
echo ' : ' . $to . '<br />';
rnysqli_close($dbc};

7>

,,,

211

sendeail.php -

( !

sendemail . php , ~neKTpOHHe


$ subj t $ t ext
. n n i f empty ( ) .

nn n ,

neoro :

I3ouUft"ll1.bt jal(

..u "ll1 z. u
e.'I!\ptyO.

l<u,uu

nepoe .
bt.u. t)poe.p5te'l!\,
. t)pucoe.o U

t)epe.Me..oU $subje.ct
t)yc'I!\oe. j.u.. ,

<?php

$frorn = 'elrner@rnakerneelV:LS.com';
$subject = $_POST [ 'subject ' ] ;
text = $_POST[ 'elvisrnail'];
i f

, .ud.
~
I1po Ke."II1 - "I)u.
. .
t)~ e.k~~e.$~UCf)oe..o fIU
~..u. u e.xt I1YC"II1 oe.

....u.

I
t:.
~
.c..e:mp:t~C~~v.b;).el<t.} .. .. ..... ...... .. .. .... ..

sendemciI.hlml

!.
oJ1)l<,bt jd~uCQ'I!\b . :it)g.!,--,ou.J{fIO
KOkt'l!\p'YKu,u.-, '! ~~~z.ou,

c:u..(!e.lIIpt i1 C$:teJ(:t)) . .......... .. .. ... ...... ........ . /~~d~~~~~~u~o~~o


$dbc
or

= rnysqli_connect('data.rnakerneelvis . com',
di('

MySQL- .

'elrner',
');

$query = "SELECT * FROM ernail_list";


$result = rnysqli_query($dbc, $query}
or di( ' m
while ($row = rnysqli_fetch_array($result)}
$to = $row['ernail'];
$first_narne = $row['first_narne'];
$last_narne = $row['last_narne'];
$rnsg = " $first_narne $last_narne, \ n$t
rnail($to , $subject, $rnsg, 'Frorn : ' . $frorn};
echo '
rnysqli_close($dbc } ;

212

' theking',

oepK}

'elvis_store'}

nmuu nuUR

--
lt, n n OCOBepHOClt ", ....
sendemail . php, i f, bl
bl .

6-

sendemail . hnml

. , bl ,
~.

t),'I1I1Q C1I1~ttu.up
MeC1I1 0 t).9111 u.
"'I\o.o

cpctK1I1Q, "'tIi

1I1.. t

01l1t)FQg'. . dbt..

KQl{oe-u.d .u.
u. dbt. !.
t)J. IlYc"'I\ou

C1I1 FQttU.u,bt.

213

QZ

-..----.............-----.--:

km u &HaWe
cf0I'Me byuem MHOfo &&:?

-.._----

~~

u &aU&m m&
"l'&IOU.\U m!'U ~ &um,

.... ,. .......1
JII __ "~

m nl'0&erumb ()ocm0&erHocmb &:?

--

....,

';

___-" _-\

..

.... '.: ....

...

__

~.;....

... ; ....

:.....,;..:......_-""-". ....-:.
~ ...

...; .... . ._.

"

..........

TQKOe. oJu.toe. J1U."W\


if (!empty($last_name))

.. )'I1~)<.J.X

if (!empty($when_it_happened))
if

(! empty ($how_lo ng))

i f (! empty ( $how_many) )

KOKC"W\P~KUPUif

jQ"W\:.."W\ O"W\e..u.~u.

~ coO"W\."W\C"W\uSt O"W\~)()I.(
\.t

jQpbtQ)()I.( U~~J:x

.
: , . ,
,

i f

i ,

?
:

. , ,

i f , ,
.
.
: . , ... ,
i , ,
.
20 . !

i f ,

: , ,
:

10 20 .

: ! ,

if

. ,
, : ?.
, ,
I{

: . , ,

i , ?

: .

: , .
!
: , ,
.

214

" nmuu nuUR

Jl D

OR

oruue

i f

on gam

, .
,

!empty ($subject)

!empty ($text).

5ocm

06rc N, r

.era.u

&&.

2.uu
~.,u.)I'}bte bt C K OdI(U.9d.}O'I} C<XJga58J11b
AN{) ----........
1)0)l'}, '-hI)0 o.,e~"'II'I0E O)I'}u.u,q.u..
Ol)epa"Yr\Op.
~
l\DCUl\. l\0~1( cpyA:u,u.u e"Yr\p-t. ynpar.9JUe
.

lf !empty($subJect

..

~&

(!empty($text)

if.

KOCtnnv\JUU
'f';--

'w\ ~oD 1pd.e.u.. ""2.d u "Yr\ ""d

~~e"" u.e1Y\P Jdu.. tru.e. KOZqct .,e.pee.btx oruUn


$'subje.ct t u.e)<itY\ oe..,~c"yr\f:,te. 3l\l..
AND (:..~
N ,
onepa1t1Op
,
true

false,

true ,
true; false. ,

KogupyetnC9 .

&&

.....'11

.oru:uu

true i f.

on

OR, 11, ,

(u.u)

true false, true ,


true, ,

false, false.
i f ! empty ($subj ect

11

11.

-n, u.JJo .uau,a"l\, fI10 :fie.

(! empty ( $ text) ) )

ep"I\UI<c.Vbbte ,"'II11., ytOOJ.u ,Q


~po. . "I\UI<<1Jb "'II11.
U"'ll1 S!. t14"'111u. lUk:ItA.U.I.! f>d."'II1
,Q. "I\1.I1pu. t14"'1110 u ~ift.

l'

-., D I~u. Y.g el\ ~ 3Qu.


true :n\ozqct, 1(02..9'\

01\.

~ UJ l)epe.ft\eblx $subject

$-t1 uee"" oel)yc"Yr\oe .d.u..

, i f ,

.
, , ,

- . :

10 <>bL e}Ad l\f\.D

i f (empty ($subj ect) ,&& (! empty ($ text)

".

.,;

l)ucb}Ad:l> q.k. dt:~;'I\b I)~C"'II\bt.. i:\ I)

<>bL '.u "'II1z.

1)U(~b}Ad - okl)~c"'ll1bt.. "'II\~ ce jo


~..u u.JJo .u true.

ANb, ,
i f, , ,

AND,

true. ,

. , . .

i f ( !empty($subject

empty($tex~)

AND (&&) OR (11)


~,

(!) empty ()

~~o D ~u.e dY.ge"n! ue"Yr\b


.3Qu. tru.e l\oJbl(o l\o, ct

ll ,
1

I'\ o~ ..bt TeJ.4,Q l( I'J ,u.

l1u.cb~ Y.gel\ ,eI)YCl\br..

l\p .

.9 4u. J
\ I) ..bt
I)yc"n!tk
e"Yr\p0.o~o .,u.cb~ -

f.

"

215

mum if

sendemail . php

i f.

< ?php
$from = 'elmer@makemeelvis.com';
$subject = $_POST[ ' subj ect'];
$text = $_POST ['elvismail'];

~O """,.
.... 1_

, ......\u.~. .~ .t'\pct~.u.

..1111
t

if

(1\pt($suj2
i f (!e:mpty($text)}

$dbc
or

I(OKC'VI\P'yI(u,uu.

if

= mysql i_connect('data.makemeelvis.com',
di('

nt)u.u'Vl\.

MySQL-.

$query = "SELECT * FROM email_list";


$result = mysqli_query($dbc, $query)
or di('

'elmer', 'theking',
');

.');

while ($row = mysqli_fetch_array($result))


$to = $row['email'];
$first_name = $row['first_name'];
$last_name = $row['last_name'];
$msg = " $first_name $last_name,\n$text";
mail($to, $subject, $msg, 'From:' . $from);
' :
' . $to . '<br 1>';

?>

216

z4

1(0.9

u.t).i1b.30Q.u..~u.I(u.x ot'\epct'Vl\opo.

'elvis_store')

u n., nuu

-l-JJ.
, II0r
ll )) lO ,

II II.lO

if.

sendemail . php ,

i f .

, , .
-

sendemail . hnml . ,
, .

, -
?

JiG Obl~itG't1t.

ZVl1bJX ~011OCO~

'9; , 3

, r && 11
n

if?

; . ,
,

. ,

,

fal se,

.
,

OR

true.

'9; PHP-, r
AND OR &&

11. ?

; AND OR - ,

. ,

&&

:: 1se,

&&.

11.

,
.

217

mum nRu if

sendemail . php

, 0 r

i f.

<7php
$from = 'elmer@makemeelvis.com';
(1)
'\.
$subj ect = $_POST [ , subj ect ' ] ;
Ot)epa'YY\0..p O"lY\pv.up.USI., u.v. N _ . , v.cl"I0 3:;
$text = $_POST [ 'elvismail' ];
-l"Igv. .el"lyc'YY\bu< t)u. J-\.btx
if

~
ii!~l;i::::~;=;:~~:) +

!. UCt)OJbJ0o.'YI'\b Ot)ePQ AND

fc 1:~ePK O~O)( :obtx,~-;'~~Iu

~ .9: u .'f\.u KO:C'YI'\Py;J:'f.


if.!:t~$SUj.t1).&&.''nlrt($tt))) { jd.~bI.ai1'YY\e: .9a u.. &&, dI"lU~
.................................
$dbc
or

~................ .

./

~~~;r:::~';e~orAND~K v.

= mysqli_connect('data.makemeelvis.com',
di('

MySQL-.

$query = "SELECT * FROM email_list";


$result = mysqli_query($dbc, $query)
or di('

'elmer',
');

'theking',

.');;

'elvis_store')

~cb .9 K.YWIeu.

v..btx

.9 0 . ~bt'Yl'\b c#u..::J'YI'I

while ($row = mysqli_fetch_array($result))


~ .. 0.9u.. ypoe:b
$to = $row[ 'email'];
~ ,.u. 'YI'\aK
$first_name = $row['first_name'];
U . PQ".
$last_name = $row['last_name'];
o .. '.
_
$msg = $fist_name $last_name,\n$text";
I(O~ ~po. ~w,u
mail($to, $subject, $msg, 'From:' . $from);
'YI'\.I.J,Uif'Yl'\
echo ' : ' . $ to . '<br / >'; .9 . 'Yl'\ 'bt
";9.
mysqli_close($dbc);

-:-

i1..:J dC d l1.)O(.lJ.o.Sl. .'\u,u if

~ '\ 1,1. jd.bt~)O(.IJ.. v.... CKO~Ka 'YI'\0. ..

.1.. ................ .. ....................... ............ .


7>

218

z4

w nmuu nuu

6 06 J
u.u."tI1 "tl1

sendemail . php , I1YC"tl1J~O C"tl1fC\Uu,y


, ,
. . .

t') 0"tl1t)P<:11<u.
mopbt ' .

. ,
'1"' h '" ...

. . ."tI1wt .
. , , u.
-.
...-/
ee"tl1. t')O "tI1C\1(
11 p0U.CX0.9u."tI11
u

-------.

npocxoo~

~ ~
" , ~ce, , ~
31110 .

,
.

false (

), ,

, , .

, :

<?php
$from = 'elmer@makemeelvis.com';
$subject = $_POST['subject'];
$text = $_POST['elvismail'];
if ((!empty($subject)) && (!empty($text)))
$dbc = mysqli_connect('data.makemeelvis.com',
mysqli_close($dbc);
?>

'elmer',

'theking',

'elvis_store')

u.. . I)Pt0u.cx0.9u.'Y!\, u. f'5l.)u.

if

KoKC'Y!\EYKu,u.U.
. ,9\'!\51. 6'bI.t)U'!\ d \, iW 1)0 '!\u. rtu.u..
u. ..u.'!\. rtyc'Y!\C\5I. C'Y!\PdUUP, ..9 KC\Ku.e-u.d
u.j .eo~x0.9u.b1.x .9a.bu< rtp0rtyw,e.bt.

, , , ,
.

219

else ()

, ,

lO ry
nRlO

echo

If,

BblnOIlHRCR r.

i f ,
, ,
, i f
. , . ,

echo

i f

false.

Cn

TorA

else

i f

(), , ,

false . ,

1 se.
,
II.

else

i f ,
.

220

nmuu nuUR

i f

sendemail . php,

1 se , .

, .

$subject,

$text

~.~"~""~""""~~"~"~"""II""III!II!!II"""""""~
/ / $sub'

<?php
$ from
' elmer@makemeeV1S . ' ;.
$subject = $_POST['subject'];
$text = $_POST['elvismail'];

else

//

echo

'

'

$subject,

$text

.<r

/>';

else {

echo

.<r

/>';

else

while ($row = mysqli_fetch_array($result))


$to = $row['email'];
$first_am
$lst_m

= $rw['first_m'];
= $rw['lst_m'];

$msg = " $fist_m $lst_am,\$tt";


mail($to, $subject, $msg, 'From:' . $from);
echo ' : ' . $to .

mysqli_close($dbc) ;

?>

221

ynpQJHeHue

i f

sendemail . php,

1 s , .

, .

<?php
$from = 'elmer@makemeelvis.com';
$subject = $_POST['subject'];
$text
$_POST[ ' elvismail'];
,' empty ($subj ect)

II

$text

empty ($ text)

emptY($subject)

$subject,

$subject,

$text

empty ($subject)

echo ' .<r 1>';


else {

...........

$text

~---~~~~,

.................................................................

' iiIJ1 .<r 1>';

else
//

Yl\.~ momet-tYl\~ t)

while ($row = mysqli_fetch_array($result))


$to = $rOW['email'];
$first_name = $row['first_name'];
$last_name = $row['last_name'];
$msg = U $fist_name $last_name,\n$text
mail($to , $subject, $msg, 'From:' . $from);
echo ' : ' . $to . '<br
W

mysqli_close($dbc) ;

?>

222

t)poepKu cex ubtx

..J,DYl\U JIObt
Yl\. 3l1.e, Yl\

t)51 d.bu< Jw\bt.


Jdt).bL

1>';

u muu uUR

~ 3mU &~ "r&>\Uu


Ctn!'>'uuu ~ IO& & tLse
33mt')'u>m ~u UnOHUM3l-iu wru.

m KOfua-uO uemb U noooOHbIMU


wruu! HwOXOOUO y"~umb,
kmo-uOu &&u M03f1.L

w CI'II" rpa.

....pa_aeTctI

TalOe

n_ _ n
Cl n. .

. cn.
&_. .n",

ApyrylO.

else
i f

, ,


, .


,
.

223

if

qu,~J\u,t

C11t,rJJfb11l,t "l;ogO~11f~J\jIjO~Gii,

l;O]-f11t,k1l;~U,u, [

. g - urpaffib n.si1
KOHCffipYK:UUU tf U u

KOHCffipYK\JUU

IF

LS.
_

nuu Kog .

Coe't\: 't\.,

t: .'t\

J 3 030Ui}LLCb
~ .} e)se'

Usa5u9 1.

KOHCffipYK\Jui1.

ysegumeCb.

nu.

if (empty($subject) && empty($text)) {


echo ' .<r />';
else (
if (empty($subject) II empty($text)) {
if (empty($subject) {
echo ' .<r /> ' ; ~
else
echo ' .<r />';

else {
//

224

z4

npDKmU.,eCKue nuu

n
6lt

if,

, .

sendemail . php ,
i f ,

if.

, ,

s endemail . hnml . ,
.

~: n
orpoMHoe ?

: .

~: else?
: if ... else
,

. , ,

~: . 0

....
-., ,

IUlQ , .

, ,
,
,
.

310,

MOry

if else r?

: , .

,
.

225

u if

u,1u,~

11l,r1lf1 YtogO 111r~J\j()~Gu, t OlfC11l,k!tUaU,u,


g - urpatnb n591tt

KOHCffipy.uuu if

u
ELSE. _
KOHcmpyKUuu IF u

nuu Kog .

rr

~oell\: ll\.,

tlbt ll\
) d odOU"II'\u.cb

~ ,3 ~se'

U8U9

KOHCmpy.uutt.

ysegumecb.

n5U.

if (empty($subject) && empty($text)) {


echo ' .<r / >';
else {
if (empty($subject) II empty($text)) {
if (empty($subject) {
echo ' . <r />';
} else {
echo ' .<r /> ';

else {
//
1

nuu nuu

rlOmj?flC~. I<cr()a fI &&ecmu &o/0j?MY


mey mj?r nUCba, mo m cmj?auy.
Kor()a fI <)'>, nj?UUJ
&&ooumb & "mj? nUCbMO &.

7vrId C"YI\Pdl-lJ,d.

d"Yl\ .

"t!\ 01-1. df1

I-I.ell dUbD,
1-1.0 I-. .

n n ,

Mor n" n n .

sendemail . php

, , .
, , .
, ,

, ,

, .
.

, ,
,
?

8 ~

227

HTML-iJ

17bf 3<)oro~o noa~mb 410rMY ~Mecme


cooornet\ue 00 OL. ~ ~bI~ecmu
410rMY ~HO~b, Un3fl KOa"Qy echo, u mea :MemrOHHOfO
n uu efo eru nycmbff-

&n n n ,
n n
, n3 .

,
,
L- -,

echo. ,

L-:

7vn1\ ??- ,..u. 1\ L-


t'\1\). t{d u.l-td. 1\. <fr1\ >

echo '<form method="post" action="sendemail.php">';


echo '
<label for="subject">TeMa
label><br />';

:</

echo'
<input id="subject" name="subject" type="text" size="30"
/><br />';
echo'
<label
label><br />';

7vnU.

.u.5l

Jct1\bt..
t'\,35!.)O"Vf\

echo'
<textarea id="elvismail" name="elvismail" rows="8"
cols=w40 w ></textarea><br />';
~<input type="submit" name="Submit" vlu=""

~. u.1\

/ > '~

echo

C;""M(L""\ID\J
'"
"'JIJ

-.

fr="lvismil"> :</

-----'</form>';

:
!( !(!(.34u.
t)aw.e'tY\~o
HTML-!(Q
,,1_ "-,,1_1,

.J

o.pa1t er=L .9~U"-VIJV\Lt !(a~' I(QLt, t)

Ltt)' 0 'tY\ 0.9~bt.e l(bt.I(Lt .95!.


o.pa1t ..u.5!. !(c:t:90U t)u. 1\I<u.

HiML-!(.9 .

, ,
. ,

- , , .

L- - .

echo - ...

228

u nmuu nuUR

6 J
, -

BPP~puu

L-,

-. -,

apbmatnb

MOU -og

<?php ?>, L-. ,


- HTML,

gs mog

qJp8Met1106

L-og.

L-,

echo

...

am

~.

ot11pbmatnb

ux

516.

flAd 1(0.9 U"!\ I((

<?php
$from = 'elmer@makemeelvis.com';
$subject = $_POST['subject'];
$text = $_POST['elvismail'];

...btu. HTML-I(0.9,

"y!\QI( I(QK

"!\"!\

1(0.9

Qll...

~.e PHP-"y!\ez.o.
if (empty($subject) && empty($text))
// , ,
echo ' .<r />';
~?>
:-"'!,!\

':-2,

7)

~:,~, pb&C\e'Y\

:
:. -? -l(o Q
-:

~ : g \\
-..:: HTML.

(empty($subject)
echo '

&&

QI( KdK JON.:ft.. ce


..yvt\u

(!empty($text))) (

.<r

((!empty($subject)) && empty($text)) (


echo '
(empty($subject) && empty($text)) {
// ,

/>';

I(.1 d

IlQ5llOW,u.
Kokc"Y!\PYI(~U

if,

.<r

/>'; L-'g .9 "!\


btou'\ ,
u '\ bdQ
1l05l !.
'\d..yvt\5l

.3Qll....btu..

. (?~p o"Y!\l(pbtcte'Y\
..bt.u. PHP-I(.

, , ,

1 \ bt. ce

. ?

..ye. I(\
K0.9 Q )'t)Q}OW,

if.

."!\"
bt. .90...bt .3Q I( !."f)b
.,

l1epe.9

"f)eM

~9"Y!\. .9d..

KQK
~

229

, -
L- (
). ,

truel false,

(), .

true ( ) .

, f 1 se

$output_form ( ), true ( )
, -
n4db

l"I'. $outt)t~c tr~.u.e

~ Jff-5{ fo.Rse ~4."Yrl, m

II. $output_form l~

false

~"Yrl g-btoU."YrI.,

J}e ~.UI(."Yrll"l'
IipObepl(OU 3<1...bt.x
4 -m"Yrl.

vt!u. .u. /

u.l(.
_ V .2.0rA
~ ,
Y"Yr! ~l(.
true $output_form

"Yrlu.<I."YrI.
Jo.u.cu..oc"Yrlu.
0"YrI "YrIo~o, 1(00I(

:~.~.
~orA ,
.0
.!.li...bl.u..
JY\VI.

true $output_form ( I(.u.-u.

"'lY\<l.u.

1i0. bt


~TorA
,
;::;: ~

"'lY\..Y"Yr!.

.J.li.~
t)epeMe..ou

~o ut_f r 1\

true $output_form ~ lipu.coerw


J..tl $i:rue.

(u. . I').

. .bt
,3d.l').t-ibt,

'l\..
l')u.cbMO

/,

01\l')..1\.. /
V

TorA

bL'

. d"'lY\ ... lioKd'

$outgut_form true
TorA

\"--

. li., "'lY\.lje ."YrI. "YrI"'IY\u. ...btx

Ii."'lY\. J..u. $output_for"Yrl, '-fvr\odbt bL..u."YrI,


.. u. btu."'IY\ '' . u.li..u.. 0.90..
~ ~, . 4 .u.. HTft\L-l<o . lio"'IY\0POzo
bt. bt. "'Iy\(o u.. pCIJ.
230

z4

u nmuu nuUR

HTML-
Onpeg99


$output_form

85UC'U.ocmb

5b15Oga L-og

, (

om

) , $output_fonn true.

<pJ\88.

cmaa-oro

Bynpa9lOUJUX

.ocmpy.lJ'U9 .
npeg0tn5-

n06mopeueKoga

if (empty($subject) && empty($text))

//

- cueapuu

",; ;"ho 2 "; ~~il . < / >' ;


t
ii$'1ilt;n:ufQ~ ::=(\1tj';'\l~ ~
.\
n. ae. rtepe.ertDu. 31-{tj.u ru.e,
}

o,,~ ~"<~~ ~_*~,,t""~,~, ~;

J.

----i~~~~~6;,~;,:~:f~~;:?D,

i f (empty($subject) && (!empty($text)))

~ u.CI"\()Q~u."Yf\b
O~KJ
I

{'YI\J1"Yf\~JOD"Yf\

.<r

/>';

(\ IlPu.c(\U.(\e.M )... J..u..


if ((!empty($subject)) && empty($text))

echo

'

}~~tif$~

true, u. "Yf\e.ct "\~ Ilu.cb.ct


- e..g e .

.<r

/>';

~ ~~~~~/Je~~~%~~~l:~J-l.O
,(\u ."Yf\..20 l"\u.cbI.

if ((!empty($subject)) && (!empty($text)))

//

~
,.

~~ _ _'Iffi:!}_1'W
?>

!. I"\OI(U-~u. -.9, ce, "h\o


I"\pe.9~c"YY\~ye'!.'l u.2~f- .
~KP (\).u. ~)(\~J1.~)()
KOKC"YY\PYKu,u.)() if. u.)j(\"\.

I /,-I\AJ;Ui KO.G"YY\pYKU,u.5l
\JUQt:.\J.
(

o"YY\h-.u.. d.!i:t .9(\.

v,., ~

"\ mI'IL-0.9

'~"" "'-'.'" L- bt (\ .9 t-bIx


"\(o 0.9u.K

P(\j, "YY\ctK KctK

bt "\tJ.u. c)() 2(~ t).9.~)()

. )..u.. e.9u.h-"\f:,)()
Il ..)() .$Ou.tpuCfor"Yf\.

231

", ",

& <fr flW, tio nmtiti


()w

&&o()umb 33tio&o ~wu n


KomOrbIe u ntiw nr&ubti

tia3tiytie. m r3<>raaem.

L .
~ ~
,

sendemail . php

. L-,
,
.
,
, .

m .u. u.

a.bt.e. KO"Vl'\0Pbt.e ? ~~

.9de"Vl'\ .34"V1'\. Yr\

~ fj H4Kdl-tjl-t.

Ol-t "Vl'\d6'u.. d"Vl'\ 110 bt

~~~----------b~e.3a~~__

-1r,

I I
dI-tQ

sendemc:iI-Pt1>

sendemciI.hlml

"'II}d.u.. J)}u. 110.


l1yC"'ll}bt.u..
Yr\

"VI'\el1epb
l1 o'Yl\OMj
J"VI'\O

rl-tl-t
l-tQ6'd ,

d. ~

l1 d4 u,4

sel1c:fe"Vl'\d.iR.php 110
"VI'\ozo. Kd.1< 4<:lJ1
1<I-tQI11< :O)}I1Pd.u."VI'\b:O.

-.
, , ,

,
...

232

nmuu nuUR

~MII ."8fioam
, ,
, .

, , ,

(HTML

),

I I

sendemcil.html

~ nmm

, ,

"

, .

, , ,

(HTML

) ,

tu

u ce ~r-----~--_
bt0.9U'Yl\c51.

._.--__ ... . cu,e.o.pua


jc\110I3Ut

~o 110 .9 d .blx
!. ce
. 3dI10.. ...

J<o'Yl\0pbte "
..d.., u Yr1dU

I I

sendeil.pt1)

. P.ttP:-:-~I,A,~~r-~iA.~~.~)I').~ .Cf~~~~~':I~ ... .... .... .


.~.~~~.1,tf.~~4~..9r-~ .~9:% .~~ ... .... .... .
.~~ ..9/. mc;t.~.~. !19.~~ .~IJ.~~~~. 9..~....... ....
~ . ~.~p.~~r-: :Y.I'I~~..~~~. y~~~rI,t~ ~~~m ...... .. .
..9.~m'f.\ .1:<. .~.~..~~. 9f.~" .~~'m~p.~ ...
.~.~I,A; .~~:9~tt: .~. ~~~/. ~I:t: .~9.~m .~~m4~1,A;1I}~ ... .
..r.ro~.~~..~. ~9r\~~m~m~~~~~ .I)~.!J~ ....... .
.m??4. .!<.C??J).4..~~~ .1.'\p.~.9~)I')Y.~. 1).C?~~~rt:tP
?~~~p.I,A;p.~ml? .~rJ.'l~: .~~. p.f?~~:Y.I'I .......... .... .
!1r<?~~f?J.'I~}~~~/.!<'9m9f.~ :9~~.~ .. .... ..... ..

.~. ~.I:?!-. !1~mqp.t:W. ~<?.91,A;1I}~ .~~/.'j~ .. ... .. .


.~~.9~.~..<?.9~~....... ........ .. ... ........ ..... ...

234

z4

lJ.X

sendemciI.hlml

P.93.~ . ~~~!!\ ?~~r~p.~~'YI)k. .9f.~~ .... ...... ... .


~!4.~~..1,t.~K.ffi9~1,A;1I}.I?t:tP ............... .... .. .

.~...~!1<?~3<?~~t~. mf::-~I,A,~I:t:4.~.... .. ... .. .. ..... .


.'YI).?~~~.I.'\9!.I!'!-9.:Y.l'lI?,1:<? ~~~.:Y.I'II?~... ... .. ..... ..
.~.;\.~ . ~~.I)~~'!')R':Y.'IR .~ .I).~.<?~'m~~.:Y.'II? ..
~9~~~'YI)k. r.~.f ::~.I,A,f?t:t4p.I,A;1<? K~K ~~!:9..ml? .
..9.~~.. m~~. ~. ~9~~m~ml;>..f?~.~~.. ... ...
~ r~3~!.1km4m~..fHP. 7.~~~~p~~..~f?~. :9~y~ .. .
.K9 ~~f?~~~ ~~.9f?~ ~~r~'j .. ..
~~~.'!'). ~~.I)~.!JI;>J~~4ml;>..~.~ .Y~9.~~. F:9~'m~.... .
.~~?:9. ~~9~~..9.~m~~~ .~f.~m~~ ... .. ..
.~~~"!')~~.9. ~k.~~.~: ................. .................... .

nmuu nuUR

sendemail . html

L-qp g

~ !>? ,

gab1X. reepupyeast

L-,

PP~pe.

-. ,
- L-

, HTML-.

om

sa

U5eCtn. qp.
aIOl 99

. .

t-t.e

t-t.t-t.

du slld1\di~.~i:1\~.

. 1\0z. '-h\ob!. IILl.1\

-ces9.
-

.--~
------,.--_.",.

d d..btx,

\10}ib 3 0G\1\) 1\G\1\t{O

3d..U.1\ PHP-u,u.Ui
G\..!. bt t)-.bL

I~ I

.G\. u,Ll.u.

~.Ll.1\ <fj>
I
dG\G\1\bt.\ 1\ G\..bL \10

LI.

1\ d.}. u,,
KO"l'l\opbt.u u.x odpG\ct"l'l\bt.ae"l'l\
LI. G\ uu. 0.9G\

\1.9 dU cpopbt . cepep.

~ J"l'l\G\"I'I\ odpC\do"l'l\KLl.
CPop.bt. Ll. "l'l\\i'G\1\.

bt.0.9L1."I'I\ .ob
. .7"1'1\0"1'1\ pctJ .9C\~LI.,
KO"l'l\0pbt.e dbVJu. .ece.bt.
Il \. \.yt-t.e.

sendemcil.php

~ .7"I'I\.. \iLl.CbMO, Ll.d


bL.Ll."I'I\ .u.

Ll. MeC1\e .
u.cll ..u.. .7"\IJJ( u.d.

, , , ,
(). L-

. ' ~!>.
, -
. , , ,

. , ,
, .

sticky,

1 orym
nOMU

gaHHble.

om

n5m 55

n5Ub.

, ,

,
,
?

235

actlon

<form> -

action

-,

sendemail . php
action , ,

, .

action

, ,

action. ,
, .
$_SERVER [ _SELF' ] ,
. ,

act ion,

$_SERVER [ _SELF' ]

, .
, , ,

$_SERVER [ _SELF'] - . ,

HTML-,

~Mec'Y\O 'Y\O~O "tn\bt ,,.'\ ,3ctt'\ucbl.d'Y\b KO~


u.. u,4 u.., b!. ,,.'\ coodLU,u'Y\b , '!\ bL

. bVldf 4 , U~t'\3:t ~1".d.b.~)


t'\..) $_SERVER[ _S LF .

<forrn action= n < I~llr,_jJmIL_1#,1td= "post" >

,
$_SERVER [ _SELF' ]
,
,

yn89
n\9

$J)E.I\VEl\rPP_SELF1
COXp8.gem

UA\9

cueapU9.

236

z4

echo.

-. :

u nmuu nuUR

--
. .... , ...nIO.

caMoro

6.

w nr . ..

sendemail . php,

$ t t_f orm

. action <form> ,
.

sendemail. html,
sendemail . php

- . ?

\. .M.O.o. btc"ll\

ce, 'tr\ .,
'tr\dbt cu,eMPu.u. ,3dt)u.. co.

.bt.
, , ,

\>I :

237

n8 $_ POST['subit']

: 6
, ,
.

, ,
. . , MweM ,
. ,
.

, , POST,
$_POST?
, $_POST . ,

$_POST . ,
, , $_POST?

yn89
n

$J~S nOO6OJ\ge111
npoepm.
U qp

nepegaa

Seceug

gaHHblK

, ,

, ,

$_POST . - ,

, . ,

$_POST [ , submi t ' ] . ,

, . ,

'submit' name

~ .

'th,

Ziif11bJX ~011YOCO~

'9; , '9;
,

~BOY ?

~>>?

; ,

, n ,

$_POST [ 'subj ect ' )


$_POST [ 'el vismail' ),

. ,

, ,

, -

, ,

, submi t "

$_POST [ , submi t ,] ,

, .

,
, .

238

z4

utt
S g9}\

OmnpaSKa

u nmuu nuUR

tt

<?it~{$from
f&'$~d~'
1) ~ fj3~1~t1~~lt']I-(q.u.
t}eoe""e.ou
= 'elmer@makemee l vi s.com';
'"

$subj ect = $_POST [ 'subj ect ' ] ;


$text = $_POST [' elvismail' ] ;
$ output_ f orm = f 1 se;

rt.c:tl-(q ~

#4 . ~

1-(q<:t'r!)U 1<1-{011l(I;. (\.... ,'1J1b'r!)q'r!)

t}eoe"el.lLt
... a . 01
~ VJflhq'r!),
:>..... "
I ,.\ '~A
I
~ .. ,
(ge'r!) u..u.u,tActUJ<d.

if (empty($subject) && empty($text)) {

//

'

.<r

/>';

$output_form = true;

if (empty($subject) && (!empty($text))) (


echo '
$output_form = true;

if !empty($subject)) && empty($text))

'

.<r

/>';

.<r

/>';

$output_form = true;

if (empty($subject) && empty($text)) (


//

m :td. CI(Odl(a JcU<pt:&e:m MPj)O 1I.~}

l(."YI\:tI(.} if, O"I\. 1IF,."Yl\ I)POu,eC.C.OM 3d; ucu.oC"Yl\u


O"I\ "YI\o~o. dbt.nct JU g,.< O"I\Kp,bt"Yl\a ~bLX
UJU I)epe~ t- . OdpadO"l\KU I). ~ ~.

~u.d #4 . dbl.q l)epe.9a.a . cepep .9

if

:>

($output_form) {

p~ O"I\l( 110 0.9 a .9a..btx, Q l1.9 ..


.eoox0.9 UO

0"YI\l(pbt1l'\b.

<form method="post" action="<?php echo $SERVER['PHP_SELF']; ?>">


<label for="subject">TeMa :</ll><r />
<input id="subject" name="subject" type="text" siz="" /><br />
<label fr="lvismil"> :</ll><r />
<textarea id="elvismail" name="elvismail" rows="8" cols="40" ></textarea><br /
<input type="submit" name="Submit" vlu="" />
</form>
<?~hp

239

Qum &I (nuuu)

mu. m, r()um,

Koroa cpora nepe()aemcs:l cep&if' s:l nrO&epKU ,


U&bl&ecmu r&u cooOw.eue UJf. 0 cux
nor u, m cearuu 3u &&()
us:I cpOrMbI, &():?
. n,
ntl ,

KorAa

KorAa

tl

tl ntl ntl

, _,
, ntllO .
, ,


, . ,
, ,

. ,

value HTML-Tera <input>.

value:

m ,.u. ."\'l1 Jr.:\~U-J>0r.:\. u . ce2.9~


~.Y.ge"\'l1 "\'I1Q1(U Ilpu- r.:\:90Jv\ fbtf5'O..ge cpopbt.
'+'

<ut

=" subj ect

~ .

':':,:;w><:::::"*":-:;::>.t:::::,~<N~'it , w.~~:<,

.'. ,

, .~.

.. -...

type=" text " ~11l~~~~" fJ21'lt?9~\t':! ';.>

.
PHP-. ? lI,

Tr.:\K Kr.:\K

Jobt

t),)u.u-
ct . 'Yt)bt.

echo , HTML-KO/t

. echo ,
- val , :

fWecJ1Jt.i JIid 'f

~%~:":L
eVjo.<input name="subject"
I.bt.

0 ,..t-\.bt.
"\'I10..9
U-Il.30d"\'l1 "\'I1ec.

?f*'r.

"\'I1U-l)ditdrdJobt

type="text"

~ _~~7~;:~:0;;;'0

val ~<?pJ:ip' eci!,l9i"",~s~~ctt ,, ?>"?,

..~

..9. J.u.. Ja.9 HTML-K0..9~ !.


JdKpbt.deM - 0..9 t)) "\'I1e2d . >.

<

. 1l0. o..9o.

34 J IJr...liJ(/

<form method="post" action="<?php echo $SERVERf'PHP_SELF']; ?>" >


. U-t")J. QYr)fu-dJY'1
<label for="subject "> :</ll>< 1>
yC\~e, Q btU ~
""" o:;~nput i ? = :', s~t;.;j:ct" m=" sy,~j ect" type=" text" size=" 3 "
J.u- ll e peJv\eoou
iY~u"'''<?lJ]; e,gho uj. ti ?>:4 /><br />
~iexi .:9. "\'I1e2du<label for= "elvismail" > : </
<texiC\rer.:\ >
label><br />
u- </iextdreC\>.
<
id=" elvismail" name="elvismail" rows="8" cols="40" >
~
~ ext ; ?;k /textarea><br />
<input type="submit" m="Sllmit" vlu="" />
</form>
#

240

z4

u nuu nuUR

' --
, n , n,
II en.

sendemail . php, $_POST, ,


.
, , ,
.

sendemail . php

- .
, ,
.

kx, cmopoHbI ocmaBumb


u>u nUCbMa nycmbIM, m{), Bnpwb m

.1J uOnYlJ..\y,maK / menepb 3Haem


u. m> u> BBouumb ) u,
KomopbIe OuuH ,

CO~)

Cu,e.apuu 01l\\jPdKd \.U \j'1\bt


1I\eMpb bLOjU"'l\ du. ou.tudl<e, U

OC"'l\d~U1l\ Kdkoe-ud \,,\ tyjC"'l\bI..


I-l Ol-l \joMt-.1I\ 3t-W.,u d..bu<, 'e.g e ..bu<
IIdu-lo.

241

KoziJa u u

Jl
,

, ,
. . ,
... ,

: !<<lrt@kresteesprockts.iz>
:na7

: 24 2008 (. 12:23:33 CD~


: elmer@makemeeIVl5.com

7nt 0 "Yl\ 1l 0 l(IlQ"YI\

uep!

'h!to . 1')0Q"Yl\

cna. PCm1 1'01"0. ro OJ1Yab

'.. nocna ~~ ooro"'ICI@~


nero abI . KOIJ\II y XC!t1I>

""""""'.u 1'"

epti. ~ .

..9 0, 1l 0"Yl\0Y

0.9.opeMe..o
1')0

.I({o

O.9.o~o

I(OI')Uu.

U "YI\O~O

l{"YI\..~

l')ucbQ ~.

, , ,
, , - .

, / . .,
, ?

, . ,
email_list.
. ,
UDI , .

npu UIl.3 0\.U.U


C"II'\PQ.uu,bt :.9Q.u
"l\.z. ~peCQ,

KO"ll'\0py)O #J.1t Qd"ll'\UQU akG:M~EL.V;$.co


t~.9bt:9w,u. z.Me,
eln8wec nrpooii_n ___
.3 dQ,3bt. I..t, Q
~ _ _ now:
Y"YII Q.bl. ce .3<:\IlUCU~ i ~.biz
YKQ,3Q.bL ~peCOM J
(~
"YI\.u. I')o'h!tbt., Q "ll'\
coceM . "11'\0. #J.1t

C1nr~.

~,.r.:~~~
, , ,
?

242

u nmuu nuUR

. ..11r ;,aem &, m &mu


um ;,nU cYU.\ecm&yem ur n

muum )( ()j?Yf ()j?Yfa. u n' &()um Qy )(

u()u&uQy, &r.3mm r ;,nr 'p~~ oyQym


uw u &.

--~

: , ~ .
,
, ?
, ?
: .

: , ,
,
.
: .
,

last_name?

: , ,
. ,

-
SQL-:

DELETE FROM email_list

WERE

last_name

= . '

: , , , ...
: , . ,
, - .
.

: . , WERE, ,

, .
, , .

: , , ?

email,

last_name,

first_name

WERE .

: . ,
.

: . -, .
- - . ,
, , ,

, .

: ? , .

: - . , , . , ,
,
, .
: , ? ?
: ,
identifier () , i d .
: , id , .
- , DELETE,
, .

: . , ?

8 ~

243

nu

3 6
,

/ . ,
, .
( !).

emai 1_1 i s t

. ,

. - ( !),
... !

'l 6J1 3J1 :


fir$f':'(i. '" )

@ ,

);

last':l)ome

emai :

denny@mightygumba".net

iweraliensabdudedme.com

:jYf\ u.e1\b

oU.bt u.eM, t)1\ 1\.


.d . 1\ u.1\d1\5l

d.!. bt0POM 5l ".u.5l


y.u.K Qb.1\ (.

1\.

~ u..1\g
~ d,g ..

elbert@kresleesprockets.biz

elbert@kresleesprockets.biz

"Vfl.rwu. t)1\bt

. t)~1\5l)QYr\5l,

: du.u.5l
1\<, . t)u.i'd1\
.u..1\lA..

bt .

.u.1\bt.1\, 1\
1\. 1\ gcez-,9o..

, , .

MySQL

, ,

. 1> .

'l Jl 6J1 3J1:

I /" i~' '\

firscnome

!ascnome

email

denny@mightygun1ball.net

iwer@aliensabductedme.com

elbert@kresleesprocket5.biz

elbert@kresleesprockets.biz

du.},u.5l d.bt.

2-< ..

. OI(d,bti'd}O)1J

'\. et)epb, 2-d 1\d .d lA1\

.u.Qb.bt J.u.., bt dbt"l\b

yepe.bt, "I\ d~d. .3d"u.cb u "I\du.u,

U1\u.1\. .u..

244

'"

u.5l.u.5l . .u.d..'Vl1

3d"u.ceU, "1\ 'hr\o

dl)u.d'Vl1 .
.d

iJ.

nmuu nuu

, reHuu!lbl ;,tIaewb, m u xomUM ~Hecmu uu


~ cml?)'myl'Y mu, U uum n 'Df'
lA'(;L-e UnomOM &occ0:?Uamb . u -;mOl1
nm unm!

ro : " Oll. 3Cl


yeptlHbl.

SQL

DROP TALE

ecr yro 3Cl,

ro ecr . cyecry

6n 6 -lI60 .
ALTER TALE ( ),
,
. , ALTER TABLE,
uu ll :

5t "YI\.uu,bl., C"YI\PjK"YI\jP<:\
I(t-U<U"
/ ' I(O"Yl\0POil Jl.,4 bL"YI\
/ ' l(o-m<:\'~.

l"...

TALE _

ALTER

ADD

bt-m .9 0 &:td..

U,I") .9o.~ MO t-U<U,J

ALTER TABLE , II
ll id email_list. INT id,
. ,
R ll , :

5\. -m.du.u,bt.

~o ZoU,-m Myso.L :fUu'.-m Jd..u.,

c"Yr1P)'I(-m

.. XOI'I'\U ctu.-m .oY)O coxp<:\5teM~e .9<:!... I(t-U<, d. ~9U..u.U,Y

I(o-m0pou. .. xo'tr\l,.V'.,\ ~ .I( u.MeKeM id.


lJ.,}mek.u.-m.
~
~

ALTER

TALE

email_list ADD id

ADD PRIARY ( ~d)

.
_
w.u
ct.."YI\ ct,

4....
J

. ct:90U .3o.tju.cu., I(.ct . .90dctg',-m


-mctu.u,. ~

IN

l'

NOT NULL

~::JSQ..l, "II\ ... J< JPY..D. dbt"f\b

-l(u. . l~

1(

l1epou. 1'\0

"
../

11 0 Sl. )' C"YI)pYK"YI)ype "f\ctull.. 7vY10

f..teu dY.9j)1) ,6,Jd'Yl\D u. D l 'YI\ub

COXEC\k.5(-m , u,bt

ALTER

FIRST,

'm FlRST (l1epbt.O.) ct"f\

~IO-m "\')u.tj ~ct.btx

'\10, "t\

AUTO_INCREEN

U,Jk:\.

I1.QU..u.. t1t\ctzct'Vfl p<\3MeLeJ.A.e


J<U u."YI)Uud."f\ct l'\epOu. \,0 1'10..

TABLE

. , NOT NULL

~d()dUJ,ct'}OW,u.il

( ) MySQL, id -

i~j so.L 'Y!\0i-",. t.h\o

. AUTO_INCREMENT
( ) id, ,

u . ,
v
6
SQL

.d

rct' t-U<ct
,"Yl\'
, " "-.
tjepf.)l.A. \;I\

).


'\
'\
\j~9~ooKO 00 Yr\,
~J~ct. j

.!

, PRlARY ( )
MySQJ_ , id .

ll , ...

245

06
- ,
. ,
,

. ,
,

1ri1 -

MySQL
,

s tna5AU\je,

. ,

om09 geem
nvan .nu
~;,,;;;.

8I!!,...-

, .

y':!!!!s;aAboil

, :

nlO .
.
.

nlO MOry (

NULL).

(NULL),
,

. .

nlO
n .
,

NULL,

, ,

nlO .
,
, .

, .

r nlO MOry .
,
, .

: .

J<(\ id 'YI\c:lLtU, ~
. .)/.'YI\ I')'YI\.)(XJJ,<.
.9C\.bt.x, 11\ .3l-lQl.{.u.
;;,.
d.:90 '\I')LAU, (I)U, 31-lQl-l.U.5!. )
YC11\c:lI-lQu.gq)(JV!) . ct'YI\OJ.'l411\LA.Cl

KO.~ .c:l. .3.1l') .d..11\5!.


11\d.u.~), oMt')ctK'Yl\I-lQ

LA. . LA.,J..11\.. t).!

246

1#.

id

1i1'$t_lme

fc5t_lm

emaii

6n

denny@mightygumball.net

8n

iwer@aliensabdudedme.cam

...

"

nmuu nuu

--

.

MySQL-, SQL-

phpMyAdmin,

ALTER TABLE, id,


:

ALTER TABLE email list ADD id INT NOT NULL AUTO_INCREMENT FIRST,
ADD

PRlARY

(id)

, ,
id .

INSERT ( ,
):

INSERT INTO email_list


VALUES

('',

(first_m,

'',

lst_m,

email)

'drr@strlig-r.m')

, , SELECT,


! , , SELECT:

SELECT * FROM email list

~, d.
id ''l)'

d.'I)f'I)D_~~'~~~~~~~~~
______________~:::::::::::::::::::::::8
t')03'Yr)OMy
r-:

'I)d'l)

YUl<cVD

Jc\t)u..

247

XOFUJo.lfItf?b ai) 3311 rnaOUbl un


uat>blU l1&UblU .

t<aK ~mo 110em? 3 &


fU.\e uem, &!& aUrea ~mru nombl.

: ,

: l ,

. !

: .
,
- .

.
,
,

311.:1 I<.o11l<u.

.j<:tfS'u.u.

u.l<"u,u .9 ..,."

..,.".u...,.".
JI1.c:I

u..9 ...,."u.u."..,."".

: , ,
, ?

: ...
? , .
: . , ,

SELECT, ,

: Or. ..?

$_POST?

: , , . ,

,
.

248

u nmuu nuUR

MySQL
, ,

. ,

. ,

. h -"350" alt="" style="float:right" 1>


<: rng src="blankface.jpg " widt~="161" .h:l g . t;h="229" height="32 " border="O" lt='
<;rng narne="elvislogo" src="elVlslogo.glf Wl~

<;> , , ,
;:

"

/>

</>

< forrn rnethod="post" action=" ..... . . . .... ... .. .

........ .. .. ">

<? php
$dbc = rnySQli_connect('data . rnakerneelvis . com' " , ~ 1 rn r'
or di(' MySQL- . ),
// . ~"
$query = "SELECT * FROM ernall_llst ;
$result = rnysqli_query($dbc , $query);

'theking',

'elvis_store')

while ( .... .. . . ... ...... . = rnysqli_fetch_array($result))


echo ' <input type="checkbox" value=",

. . . . .. ..... . . . .................... ...... . .. . .. ... ... .

nae="todelete(J"

/> ';

echo .... .... .. ..... . . . . . ........ . ............... ... . .. .. . . . . .... ... .


echo
echo
echo ' <br / > ;

rnysqli_close($dbc) ;
?>
<input type="subrnit"

="

"

vlu="'

/>

</ form>

> .
~
.......... ........ ........ . /

249

&MYSQL

MarHumbl u MySQL
, ,
, 3
. ,

. ,
3 .

, h -"350" alt="' style='float:right" />


/>
<img src="blankface,jpg" widt,h="161' ,b:~9~-b="229" height='32" border="O" lt=n n
<img name= "elvislogo " src=elv~slogo.g~f w~ _t

<>, , ,
. </ ~
_
> ______~
,

_.

<form method="post" act~on- ,

$ SER~R [ , _SELF ' ] ;


- ~

< ?php

-;:-\
" > _

j4). S~

btJ1c!.1\' 4 '.

<?~~c

= mysqli_connect('data.makemeelvis,com'"

kll1poebtu -,

'~ .9 0-. d!:'I;'II}b

,1\.Q. <?f*1p . (>,

,
'theking',

' ~lmer'

'elv~s_store )

or di(' MySQL-. ),

// ,.
$query = "SELECT * FROM emall_l~st ;
$result = mysqli_query($dbC, $query);
while (

$li3ro,w) = mysqli_fetch_array ($r;..:e::s.:u....l~t:). . ): '-':",,--r--r-"1r---\

".

" name="todelete[]' />';

~~~~~~*~~~~:-t-.-I"'-""'''.~~~.
' '~:tn 1\, ~ 3.\.u5i.
firBt_name
t}

\i~.D~ )d.

,.;

,~".~~1-~~~~r:-1~r' ~

'<br /> ' ;

KD\id. .3d.u.u

cpu.KCd.UjJ-U, :tn.

",d.1\ KDI'1Kd.

3.\u,

cpu.du,.U,

f'IObt.

.\i 3 0 d.1\ ,d,

~,d. ~, ~,d'1\

3d.t1.cu. \')\id1\u,

?>
<input type=nsubmit n

\i..u.. 3.\.l

'"'"
, Kd.:>!<SOU j41'1..

.3d..u.U

mysqli_close($dbc);

.t103~)1\'

="

.I

*"

l
Bubmit

vlu=n'

/>

01'1 ,,bt.
3.\ J.J..u..

1\u..
;

</form>

~ -1\ ,<l1\ 1\U KDI)Ke JQd u... ~~~

.}:1\<lU"ll} "II}, 'tr\ . ,)j(,D


cOO"ll}e"ll}c"II}o<I"II}b ..."II}.u.d."II}o,
."II}d. MCcu.d.~. POS .
b!. U"ll} I)~"ll} I)J., dbtJJct
. q: O"II}hp<t' cepep

, I1poepu. ,dbtx u.. t,.1\'

l).dbD~ u.x .}:1.u.,

250

z84

,,

nuu nuu

u ene
,

~,

L-. value < input >

, L-. ,

( [ ] )

. .

echo '<input type="checkbox" value='"

. $row['id ' ] . '" name=" t;ode l ete ( " > ';

$_POST

, value

dd.""IY\bt L KorLu,e~

u.eu .t'\L
.v~d.Lu.u

. val ~d.u,Lu. ym 3!.

codou d.""IY\).\Q""IY\L

-
, todelete

.3d.-l ~-r.""IY\d
).\Qd. tode..{ete

, .

3.d -l. L.""IY\~cpu.d""lY\d

iI&a&ii""'i'l'

todelete SQL-
, .

coo""lY\e""lY\c""lY\Y)OUJ.,eu. .3dtjLL.

~,,~~o"~r~:~~~~~

~Ms:EI..v;s.co

d..:9d.. I(H-t'\I(d. ..3dLu.u. cpu.KcdlJ.,!.Aeu.


)f.""IY\ -l L.""IY\Lcpu.d""lY\ d ,

KO""lY\0p0MY . t"\L""IY\ 90c""lY\~t'\ .3


~t)e~dbtu. ).\QL $_P"OS.-'_____.~-__

m m ul!1m u

whfLe, moro m n~um atu r


U3 atml!1 ul!1 todeLcle, u um nuu
nynmeii, eii uatmuum um
1!1

ml!1emml!1yU-\ atm ul!1. --_.4.II!!~!t!!i!.lJ!l!gl!llJl!l!l'll!!!~"IIIIIII!I"""JiiA'J'

... rn

6 ...

nn. n

whlle,
Apyroro .

60n

: n n

foreach - ,
. ,
,

, , ,

foreach

,
:

251

foreach

foreach

foreach

- .


. , ,

$customers,

\ Z!. .l{l{\
C\Jb!.\"t!\. u. .4u.\.

r.tforeaCh
-

~
($customers as

!)9.u.. J \.btU 'tY\.9.btU

.."t!\ J..\ctCClA.C\ J,J. "t!\, ."t!\\ "t!\


peMe..o G\.st"t!\. \'1.. "t!\C\I(I).M
u..e.e.

$customer) (

echo $customer;

~ \. ..:1"t!\u. u,u.I{M, b!. .'Yl\ !)ju."t!\ 'YI\j\'1


\)' ..'YI\J' .4\, u.t)' t\epeMertH.j)O,

) ;

u. rl\ U b!. rl\{0 'Yr\ .u.u..

, ,

tode1ete $_POST, foreach:

//

d.X. ..yvr1u. u,(,

~ \. ..:1"t!\u. U,U.KM,

};

b!. MoJ,erl\e )'Url\ u..3 "Yf1\u.u,bt


\\')u. ~z I)I'1C\"t!\)L
$de1ete_id

bt 1l 0\JlJ.rI\
J
rI\!) 1( I{\

u..rI\u.u.\"i!l
jj\"t!\.

u. ,.fIU."Yf1

u.. "Yf1\du.u,bt ezo Jctj..

SdeIete_id

arsM~EL.Vj$.CO

_,.......III . . .

wOopm.~_.."oooI-

amJIi"I ..

!. .3u.

"tI\"Yf1 .4u.
rl\C\I( 'Yr\dbt .

".......-re lIOf8Y .~
lIf 1ImM-... ......niIj,- ...
I!I
- ....
__
pIIo lItPII

"

O~pocIW~

t!I . . KpocIW . . . . .- ~1IiI:


!!f p:Jmep _. . . . 9 - (Yonm~

.'..u.

SJ)OSnodelete1

u...rI\u.cpu.drl\'L
\ . rl\ rl\ex

, , - foreach ,
DELETE
.

MySQL
m i 1_1 i s t.

252

\'))'f\\'VI\U. .

KOrl\0Pbtx ..t)GI
..\u.u..U
u.u,u.U

bt t.1.\rI\GI

(btdpc\.d) .

u muu uUR

rernoveerna i 1 . php ,

$dbc
or

//
//

= mysqli_connect('data.makemeelvis.com',
di('

MySQL-.

'elmer',

'theking',

'elvis_store')

');

( ,
).

if ( .. .. . . ......... .. .......................... . ) {
foreach ($_POST['todelete'] as $delete_id)

echo

//
//

'()

()

.<br />';

$query

SELECT * FROM email_list";

$result = mysqli_query($dbc, $query);


while ($row = mysqli_fetch_array($result))
echo '<input type= checkbox value='

. $row [ , id ']

. ,.

todelete [ ]. / > ' ;

echo $row['first_name'];
echo

$row['last_name'];

echo

$row['email'];

echo '<br />';

mysqli_close($dbc);
7>

<input

type="submit" name="_submit_"

vlu=""

/>

</form>

253

", QU removeemQil.php

Hooro, llwr lI

removeemail . php , ll ero

llll n ll.

$dbc = mysqli_connect('data.makemeelvis.com', 'elmer', 'theking', 'elvis-ptore')


or

di('m MySQL-.

I1 0Jb''U"ll'\

');

,9<1U'\

.3 .u.

..

1101<Y!1ct'YY\eJleu.
'YY\oJbI(O
~/
( ,

// ) .

fl

~ '\ c1lJ*1e.. f
J. Nd :1.
l1 e pe,9Qd

isset($_POS['sub"ll'\it'])
(,...........................................)

~ ;--

'\
bI.
pct"ll'\b
1l 0Jb,30ct"ll'\.
'y~eU5t

foreach ($_POST['todelete'] as $delete_id) {

d ctep ~

u.c11O

$d~ete_id nSl "II'\O~O,

J<:\':!.~.~~..~J?~I .~~~.~<:1.i.~,,"~~~~.~~~.~~.., :..$.4~~~.~=~~. !............................. .

eustl

."!':'~~.<:\!i:::<:\':':~.~~~ ~~~~:. ~~~~~~~............................................................................

... ?~.~i.7.~~~.~~~ .~~r.~~ .~..~.7.~~.':~.;........................................................ .


echo

//
//

'()

()

.<br />';

$query = "SELECT * FROM email_list";


$result = mysqli_query($dbc, $query);
while ($row = mysqli_fetch_array($result
echo '<input type="checkbox" value=" , . $row['id'] . ," name="todelete[]" 1>';
echo $row['first_name'];
echo

$row['last_name'];

echo

$row[ 'email'];

echo '<br />';

' ~eKepupy~u'U .tU,


KeJ<:tu.cu.ou u.l<ctu,u,
u.I10Jb.3,bt. 0ll'\e"ll'\l(u'

mysqli_close($dbc);

I(ctU,ct"ll'\ ',9<:I..u., 'YY\0lY\

cQbt.

?>

<input type="submit" name="_submit_"

vlu=""

1>

</forrn>

removeemail.php

254

Q8Q4

nmuu nuUR

--
, Il ll lI
ll ll .

removeemail . php ,


.
.

action <form> , .

removeemail. php , ,
removeemail. html
removeemail. php -

. ~~.
, .

MaYsM~EL.v;$.CO
81iep1ne. noanyiIc. : I18ItpOIttO .
IIIJIOIIbl8I xcmne y8J! 113 nca paccI1III.
_IIf8Q1011ty 'Ylll1lll).

8etll5matt~net
8_1!epII~aIIII

8~poIcI1II~biz
._pc/III~biz

~:-~.aIIII
'YI'\020

I(QI(

b!. lloMe'Yl'\UJlu

1l 0 l(ytlI, .9t1.u.

u .d..ctu -lOIlI< .9t1U'YI'\,


,3Qllucb ftr\020

'Yl'\d.

IlOl<ytl\ .9Q11

UJ 11QduuJ;..
NN '.

255

110m nernmu ,IO


f<)u mu nm.

~ . & v,m,em
-~er, !

-_.

~.~","I;wdnotw.

==-":':'''.~1m P8CCWfD,
-.w.rc.._

c ... ~-.

..., ......_
=-I ,,....

... 'G ;w.ep. .....

;. ,.. ..... ~<8IIJI8'.-

(- >

256

"

muu nuu


8

MySQL

HeMHoro HOBoro

if, else

MySQL

-_R
..

I1~)~ l(.1I\~I{u,u
. . ."
PH~ , l'\Slem ppU~'iJ\b

if

~~=:-:=-:-:---~~,...;;. ~;;;:;;;;,J l-., &\Ju~9,~,,#


npoepKe UC1I\~
.
'. u ~q)(
u~ bl.pd.Jt(.eJJ...

O!'to

u ~.~ ~;~,
01l\opoe !"'o).ell'l tlpU;J;.i.J\1jb ,
. UJ #'jX ~u(l: {rue.

UlI'\w,.) . fdise. (~)1


u dct ct, 01I\
"
btI'\..1I\51. lI'\o/t\ !IYd.~,
U 'j.. ~cte.r ;(
1'\~e.1I\ 3I'lc;1..ttru. " .""

'npct~ct. 'Ii1l\'jI(~;1>

'f

Ui.U(Jll.lecKct5I. .c"tl\?'jUfJ.. , 01I\pct \10.11\ O.


l1,.11\.-to I1lA1I\ 1"\0 /t\l-t1'\~ ~lct
Ul'\ ctl-. d,-U 'j.. bf.pct~!-''.
1'.ymlA 'rl). .u< b!. j,\O.,1\ 11 0'jI.lu'Yl\ j0C'i'l\'jI'\
1{1(G\:90/t\'j

~.

11 0J1l\ ~ I1PUJ-W..4l1'1,
, dJul.l~ u,9bt .foUJ.; '.
'YI\i1 .1'\~'ju.u. /t\o.>lte.lI'\ '

~Yllb .~J()O
cJ1oo e:..vs"t"i. "\.

'j.1!\ dJIb'.'iJ\U~i1 )(
I(,ct, ko-m lii1 bu)tt.1r\
1j0M 'jd., .u. 'jo.
~..eu. t\p~e11\
~~.t Jctlse.
,

O~e.f41!\Opbt ~~I-te:..

~,rfJ Ut'10q~m

.
'. 51:

:.m'judll ~ . .

bt.f..4Ui1, , KOlI\c,>p/;1!.x
f4ct)C)I. \3ubt.
3d.u.. 0IW;,ctC'i'l\
j~'j}O]rl
bt.~)f(,.
KQ..c'm""U ' ,

5 fflOO'}'h,fl g'fllflfbJMU" COXffllfGlflfbJMU, ~ pfli1,i\U

*- KorAII n" 61136' *


", rrlf

... . ,
, ,

? (,
JPEG

PDF. , ,

, , ,
? .
, , .
, 0 ,
, -n ,
.

259


, ,

u..u. U'I)ctp.bt.e
o.bt. 1'10J."Yl'1

. ,

1'1 0Jct"Yl'1

cl'l)."YI'1.

. , .9 0dct .'I) cOU 'l)u..u.


, BpeMeH~ tf ct"}U.COK pe'l)..~o.
.

.' . alOIIl1pero?
\. OPJlow, !I ! lllll" . 1"8
__ ... _ .._ ..._._._
\ .~~~.~~.80~ .-=''~I.:._._ ..._ ._ . _ - _.... __

., 127650
.: uo *

, : 2008-04-22 14:37:34

\ 98430

..-: <~------------------1~--------

!\ : 2008-04-22 21 :27.~4
! 345900

J]JlR
J.. .:
: 2008-04-23 09:06:35

! 282470
"
.:

.:~--------_ _ _ _ _ _'

\ : 2008-04-23 09:12:53

'\ 368420

>d: m IoID

I : 2008-04-23 09: 13:34

~.--~!!I!'''''
u"Yl'1ct, et)'I)u. .
..ct C "YI'1poe...bt.u.

..

U'I)ctp.bt.x o.. ,


, ,


...

260

zS

_ _ _ _ _ _~

..

, ,

II, ,

. ,

, , 110 ,
.

11

1\l't1\lJ.

? ? g w-w. 5l 110MO\JJ.,b)O
G\t-U{bi.x, I1.. 110G\3dd, '\0 lJ.

<p01\o..~~

:'UI 'd.1\ \lJ.1T\G\?\-U?1.X

11 POC1flO .V"'"
eoU.MX,

345900
: , auJJJl
: 2008-04-23 09:06:35

I?bI xomume )3,


ufj?amb
!1?-110U .

ufI

. 282470

, : cra 8.
: 2008-04_23 09: 12:53

.368420
...: Amo. .

, : 2008-04-23 09: 13:34

u.1\lJ.rt. tA1\bt

\l.tj,W1, g
Mo)\(.I-l ~tA1\5l
dG\Zd.5l
I1tAG\I-U'W~

) t3 pa)\(.eu)O,
11 'V\lSd.)O\JJ.,eMy
u.1\lJ.k.2.

261

nunUR })

JllllO 6 J6Jl
~ .
: , ,

, . ,

gui tarwars.

l.

'J
na",,60 ] 10, '"" ,1OOu... 80il pdinlr\

262

z5

ptl60m , coxpaHeHHIII"U.

7frt0'Yfl
tL9 :'lrlptctll

~ll
I")pbv.\
I(J1}O. lIctdlkA.u,e

ctlI.ctll I(

.f~ll
1(c:t.:9 0U Jctt}u.

guitarwars

wt lIct. ctll"

ctat.

( ~.), ct

SCOt'8

,.

127650

98430

345900

pellZ br.

l")epe.9clIi. t1u.noJlC.e.

2008-04-23 09:06:35

2008-04-23 09: 12:53

en lot

282470

2008-04-23 09: 13:34

AwOH n

368420

2008-04-23 14:09:50

l(

llct.bte o.bt:o.

~O.9" eu.
pe'l\.ct t:UfGct'l\5{

I{.t <t:~ll:

.obt peu-mz
I1.9 -m I1poepl{Y
Q .9 0Cl\oep.oCl\b,

8 lI",dlkA.u,e
3Ui1",rWctrs lIctKJIC.e
coxf:tH-'I! .
pelI.
c:t.:9 0 .3ct!']u.

3dl\ct ~o.9'" _<JO..btx


.9 ctl\ -g l\"'\~

3Ui1",rw",rs.

263

nmuum

,
,
. ,
.

..

<html xmls;"htt:llwww.w.g/1999/html" xml:lang; en


<head>

<titl> :
<link rel; " stylesheet

.. lang="en">

</titl>

~~t xt/css" href="style.css" 1>

type-

</head>
<body>
</h2>
<h2> .
_
I
,

~ .fvr\O"Yr\ . tte"Yr\
.du.."Yr\1.A

<> , ::: ::~~OB? ,

< hf;"dds.h">

styfe.CSS

~/> . </>.</>

6'ttoCI.A"Yr\b

<hr 1>

lA3 me h.el-5!..

<?php
11 .
,
'admin ',
$dbo ; mysqli_ connect( . www.gu1tarwars.net ,
11
$query; "SELECT * FROM guitarwars:;
$data ; mysqli_query($dbo, $query) ,

'rockit',

t)'VI\ 6'bt

' gwdb ' );

. .bt .

dt)I{I.A'VI\..

MySQL

11 ~~~ .
11

echo '<table>' ;
while ($row ; mysqli _ fetch_ array($data
11 .
"> "
' <tr><td Clas~="sco~e:nfO$ro~('score ' ] . ' </span><br />';
'<span class= score
row[ ' name ' ) . '<br /> ' i
echo '<stg>:</stg>
" $$
[ ' date ' ] . ' </td></tr> ';
echo ' <stg>:</stg>
. row

> :

echo '</table> ';


mysqli _ close($dbc) ;
?>
</body>
</html>

'. ....... J.H.H.

guitarwars

id

CIate

20080422 14:37:34

1 27650

20080422 21 :27:54

98430

nome

200804.2309:06:35

345900

2008042309: 12:53

282470

2008042309: 13:34

368420

20080423 14:09:50

64930

www.headfirstlas.com/books/hfphp

264

index.php

*' ~.

, 8

<html xmlns="http : //www . w3 . org/1999/xhtml" xml:lang="en" lang= "en">


<head>
<titl> . </titl>
<link rel="stylesheet" type="text/css" href="style . css " />
</head>
<body>
<h2> . </h2>

<?php
if (isset($_POST['submit ' ]
// $_ POST
$ = $_POST['name'];
$score = $_POST[ ' score'];
if (!emptY($name) && !emptY($score
//
$dbc = mysqli _ connect ( , www.guitarwars.net "

' admin ',

' rocki t "

' gwdb');

//
$query = "INSERT INO guitarwars VALUES (, NOW() ,
mysqli_ query ($dbc, $query);

' $ ', '$score')";

//
'<> , !</>'j
echo '<><stg>:</stg> ' . $m . '<br /> ';
echo ' <stg> :< /stg> ' . $score . ' </> ';
echo '<>< href="index . php ">&lt;&lt; </></>';
//
= ";
$score = ";
$

mysqli~close($dbc) ;

else (
echo '< lss="rrr">' , , ,

' .</>'i

?>
<hr />
<form method="post" action="<?php echo $_SERVER['PHP_ SELF ' ] ; ?>">
<label f="am"> : </ll><iut type="text" id= "name " =""
value= "<?php if (!emptY($name echo $ ; ?>" /><br />
<label f="s">:</ll><iut type="text " id= "score" name="score"
value="<?php if (!emptY($score echo $score; ?>" />
<hr />
<input type="submit" vlu="" name;"submit" />
</form>
</body>
</html>

addscore.php

265

nmuum {( )

Cn0 , II
. ,
0 0 .

,30~.u.,

1- xml:lang=-en lang =-en - >

I"I~"IY):9d.

<htm1 xmls=-htt:/!www.w) .org /1 999 / xhtm

<

<titl> .

</tit l >
- -t t/C5S. href= - style.css />

peu"lY)uz, .9 0 .

<1ink. rel=-stylesheet type-

<ody>

ro8 </h2>

l"l. &:v1b.bt

<2> ["'l' . nI't. ~! peI' . ~aJlb

raanoCn, :r.

<P>,J)J6po

r ? EcJt . npoco <

href=-addscore. php->

~cc JVIJI"\I::.

$_POS.

</> nJC. <! >


<

I"IO-'!. ,3

abt"lY)b

</

1>

<?php

<html xmlns;"http :

11 .
, admin'. ' rock:it'.
$ = mySQli_connect(www.gu1tarwars . net

<head>

11 ~ro ~ ySQL
$query = SELEC * FRO gu1.tarwars .
$data = mysqli_query($d.bc . $query).

<link rel;"stylesheet"
</head>
<body>

<titl>

11 aJi lro = .
11

<h2> .

</titl>

" text/css " href; "style.css " />

~.90~
.9 Yr\., -rr-

,Ei;" </h2>

LI.S:
($data

I a ~ .
>' .
ho ' <tr><td class= scorelnfo

'<span class= - score - >' . $row{ 'score'

~hO

Qk

~~~~~~~--~--~----~ ~dF~~

~]

ttyc"lY)Oe.

' <strng>:</strng> ' .' $row{ ' ~=e ' }


'<strong>naTa:</stronq>

$_S

' admin' ,

. $row[

' rockit '

gu Harwars VALUE

mysq ,_ury
,ury) ;
1/
/ / 8

I <>
, ! <
'<><strg> : </st rg> . $ . ' <br 1> ';
'<strg>r:</st rg>
$score . ' </p>' ;
< >< hre
.

=.'

</></>';

< l"I'~

$~~:7 ; ; ": : . ~ l)tto~ ,3<1tw..St ydUll\Gb,

gui tarwara _____

id

daIe

2008-<)4-2214:37:34

2008-04.22 21:27:54

2008-04.2309:06:35

2008-04-23 09: 12:53

2008-04-23 09: 13:34

~
.....
_"'


Heen
8II/!
lf
AwOH
...

//

.3<:\1 .u.. I"Ipou,eCCd..

' \
127650
98430

345900

_
~

($dbc) ;

~, ,3<1I)O~ebI.e /\U,

ubl..
else
echo '< class: "error"> ' ,

' ~;;;~F.~~J:si.9~~i>JbD Kp<1l1\KW>\ lI\<U<


( ~ l)uSt)01l\ ueh tw

282470
368420

"am"fr;"am"> : </ll>< i ut type;"text "


value;"<?php if (!emptY($name)) echo $name; ?>" /><br />
<l abel fr;"sr"> : </ll><iut type;"text" id;"
score"
lue;"<?php if ( ! e mpty($score)) echo $score

<input type=submit vlu=" narne="submi


</form>
</body>
</html >

266

z5

60m , coxpOHeHHblMU 8

JJ J6JR e ))
,

. ,
. ,
, ,
. ~.

n ALTER n Toro,
n n

screenshot.
-,
,
.

r
,

II r

, ,

- .

-.

--------------------...L-,

INSERT,

cin
n

( ) .

PYJaeMoro n

screenshot.


.



v

:@ ~

phizsscore.gif

. .,

,

,
,

scre ensho t

gui tarwars.
rn n~
phizsscore.gif

r ,
n , ~
n r nn .

i ndex. php .
. ,

,

267

uu (ALTER)

&
, -, II0I\

i>

gui tarwars

,
, l1, . SQL-,

ALTER o:l
, Jl Jl.

ALTER ABLE
emai 1_1 is t. II0 , II.

Ai.~jm 3 gui tarwars .illl;!;~I~_ score

robt (\ DROP \..UJYIN,{,.9d.u'"YI\

~J() Qcl))), 'J'ir}o g J~,))d'tf\


~btIl..u51. Jcll1pocC\ < 3 e
..9d.Q UJ ))Q;jU,upt.
\ Y.g 'lj 1I 0 ..Ir\)
, , ,
II0, I ,

coxpalleHHbIe

. II

ALEl\

ucnem9

gA9

ueeu

gl\. ~

).bt. \..

d"Yl\ 'tf\ )..


TA~lE, I(o'tf\o~oe YKdJbt.C\e."YI\, Yr\
u',3..u.st ym. KdCC\"YI\bc51

1\'tf\bt 'tf\\u'u,bt. ..'tf\51

~. l

'tf\\ ~Jl"l..'tf\ u',3.5l'tf\


C'tf\pyk-m ce. ddJbt \rWtx,
U,t\.3js<' 3dllpoce )bt.
\ \.. DA1AMSE, . .7"1\

ADD COLUN,

~\51 U,1\u5l.

, , KO)la

.
, IIll

ALTER.

---------------- ..-...~~~~~~--~~...-~ .
.

COLUN
( )

ADD

~R COLUN

\ ( )

\ ( , )
\ .
\ DROP COLUN.

ADD

\
\

COLUN.

~J'1~,_'~~ U i"t ~wrs


~DD qoblJN aq:e TINYINT

ALTER TABLE gUJ,t arwars


DROP
age

LtJ!

~~"". . . . . .----~L-~~M~DI~~-~-OLUN--------------~
( )

CANGE COLUN
( )

.
,

, I>I

MODIFY COLUHN.

CHANGE COLUN.

, :
(FIRST () - II

ALTER TABLE guit; C).rwars

(AFTER () ,

, ,

I;CtrANGE. COUN score hi9h....~core IN'l'


268

z5

) .
ALE;H TABLE gu i tarwars
I COLUN date DATETrE

, 8

SQL-.

gui tarwars

screenshot.

MySQL.

. SQL-.

.
.

.UU"Yl'l J.gecb
SQ.L.-J~t)poc,
J"Yl'l~"YI'I ' (:it.t)..u.. I(O"Yl'l0P--z->~..... .. .. ..... ... ..... .. ........ ..... .... ... .. ......... ............. .. ...... ..... .. .... ... .... ... ....... .. .

"Yl'l.90~.Q
.ob'~51 .~.

H~t)uUJ.u"Yl'le "YI'I0p0u.

... ...... ...... ..... ........ .. ........ .... .. ........ .... ... .... ... ...... .... ..... .... ............. ..... .. ..

.. .......... .. ....... .... ... .. ...... ...... ...... .. ..... ... .. .... ... .................. .. ....... ..... ... .... .

SQ.L-.3~t)poc.

269

~W'HU'

,.aaqU
SQL-,

guitarwars

s creenshot.

MySQL, ,
. SQL-,
,
.

..:J.....!~~~~-+~3:i---I~K KQK J(Q .o~.

oQ "Yl'\ I1YC"Yl'\bI.e
JQ .u . cex
JQl)tAceu.. KO"YI'\0pbte dbuJtA

"YI'\Qduu, Q ,,."YI'\

.90dQ.tA5t.

n3

JER

II_ ro, ..
a6n KOIIOY screenshot.

270

lS

, 8

--

screenshot

gui tarwars.

ALTER, bl

MySQL, bl u
screenshot gui tarwars.

~."YI)

bl DESCRIE, bl

OJ1d.

bl , .

"YI)~u.u,

cOJ.9o."YI)b

9uii.o.rwo.rs,

. Z JU.

3 F.3~"Yl)."YI)

11 pu.e !. 1{ 0.90.

?b<tt10..u5!.

.<l. Ilu. .u..

~t"ipoco.

u."YI)o.pbte

)ISCRI~r:~
., d.Jd.t-I.d. ...

o, u. Jo."YI)e.M
bttJu"Yl)
QL-Jo.l1

I<:...

UJ...

Uit.rw.S.S9~

~: n,

: . . ,

ALER, n

noe n?

SQL-

: ,

f:

- ,

n?

SQL-

. ,

: ALER

. ,

.: ,

~ . , ,

FIRST

AFTER,
:

TABLE guitarwars
COLUN age TINYINT AFTER

.~..:.. TER
.~.=J

.
,

. ,
ALER

screenshot

screenshot

f: n

UPDATE.

UPDATE,

. ,
,

.
,

,
...

5Creenshot ?
, .

271

06J 0?

. ?
~u ~,

FTP? ?
u

, .

u l1
cepep

..'\ 3'\ I(Df)KU

'\.9 JctZ4"Yl'\.

jdro<\-vr\5t '\,
'tr\

rpu

dUaphtu

u.,30dctu.

..4'\).

jt)fdf;'rLU. l1 '\5l_
dpdjjepj U llu,u.u
'\. dbt.. II.

_.)

..4'\UU bt.bt.d'\.

u. t)OUCKd Ud,
UIIJ. '\t

110.30ct'\ ...'\
..'\. ....t
.. U ,

6-
,
, ?


, ,

, ,
~ ~,

HTML?

HTML-Ter <input>


, :'Ia .
, ,

, ..

272

z5

, 8

% ..,A,a;as ai1 pei1muw 1\ gemas

vII <>~,
btd)6UJ,ct5lc5l
ced5l.

v~lu;2768

_.'hoO"oo"" .e,ion".?php

<label

/>

echO~ SERVER['PH~']'

?>">

fr="am">:</ll>

<input type="text" id="name"

= " "

value="<?php if (!empty($name)) echo

$;

?>" 1>

<br 1>
<label

fr="sr">:</ll>

<input type="text" id="score" name="score" value="<?php if (!ernpty($score)) echo $score; ?>" 1>
<br 1>
<label

fr="srsht"> :</ll>

<iJ1put t;,y pe=" file-

= screenshct ""

sc:reenshot 1>

<hr 1>
<input type="subrnit"

vII t'\ ct u.e.u. <:\i1.

vlu=""

name="subrnit" 1>

t\I-lO"tl\) I\~ct~.

u.ct~ Ollepd.~OOu.

< / forrn>

cu.c"tl\e.bt. KO"tl\OpbtU.

1I 0 J."tl\ \')Jd."tI\)
.d.X ou."tI\ u. ebt.u.pd."tI\b
...bt.i1 d.U u..

r,

rr

n .

8.

273

nIL6Q

68~ J6J 8 6aJV AaHHblX ~ttAa


U306p8eu9

ucnetnC9

screenshot,

.
, .

SQL-

INSERT,

guitarwars VALUES

(,

NOW() ,

~
,-/-

'$nae',

1NSEl\

n coxpaeu

gui tarwars,

sae

gax.

screenshot:

INSRT INO

'$score')

~----------....

u. J<U id '"t!\<:tu.<:t'"t!\. <:t'"t!\d'"t!\uu


J Mex<:tt-WJ AVTO _INCRE.ENT J.u.
uz.u'"t!\.. . .'11<<:tjbt<:t'"t!\. .9 I)O'"t!\OMy, 'tr!

J<:tl)poc<:t '"t!\'"t!\ WlU.u.. I<<:tKozo-u.~ J.u..

f"ySQ.\"-u, tW()
U\1JbJ1l\. ,...t-
Yl\eKYUJ,w< <:tYl\bI. u fSpeeu..

'"t!\ Mec'"t!\e.

SQL-
////,.-r/-l-FO////A;

///,"'/.4'a~?'"R??&?,.-R.4'd'd'd'd.t'C'~A'ot:"C'z~<7J<7d'<7,c

, ,
: screenshot.

INSERT:

INSBRT

INO

guitarwars VALUES

(,

NOW(),

'$nae',

'$score' ,

!'

3<;tl)ucu, 1( OYl\OPbte. dbtu YI\<:tduu,


MOMett'"t!\ <:tu.. I{U
screel)~ot, ue)(tl\ llyc't\bt.e ,3u...

\
\

10.l<. KOYr\0P OM
~ llU)(tl\.
i- Yl\U ,3t-. .

ct.., I)

I"\PU ~...u.u.
j<:tI)POC<:t UYl\<:tYl\..
'tI'\ J-tbLe .~
Yl\oM .. \1, '\
U I{U CYI\pYYI\ype
't\<:tdU$

''t\<:t't\ bI.I).u.. j<:tllp0C<:t INSERT


~
I( screel)~ot .ooo. J<:tI)UCU 't\.~
u. <:t UJdu...

274

"

R,

... 6lft II
06.
Jl screenshot.

,
,

ptl60m , 8

'.........

, ,

:;;,:~ ::::.:;.:,:.:~:: .. ..

;- _ ............

. ,

-~"'"I---"',
1j 8
..

- , ?

\.,

$_FILES,

."' .'

$_POST,

~l . $_POST,
$_FILES ,

< input type="file" name="screenshot" />

, ,
.

$_FILES['screenshot] ['name']

$_FILES[screenshot] ['type']

~
MIME 'YY\u.!) 3d.~..ct..

dild. ~.oM ~ 6If.

$_FILES[screenshot] ['size']

('

phizssc~jf

"-<\3 ~.4.
( ~a'YY\ax).


UJd...u.,
KOYl\OPbt.u

$_FILES [ screenshot.] [ tIp_name' )

10.. u..
.!".. .
~ ~Ud.. 1)0.9

Jd 4.YI\5!.

d~..5!. t))
. e..u.

KOYl\OPbt. ..

Q~ Q <f:..
$_FILES [ screenshot ] [ error' )

ynOGaAbtt
8CCU5 $_AI.E.S

nOOlAgetn

nyum

gocmyn

$_FILES, , ,
,

tpa.
.... .... ....

----------

~d. ~,,!)e.Lt.l 3d.~u. Yl\'\

..7...YI\ J4u.d 1)e.u.~e.'YY\


..u. (). '
Jd.r~3d dild .. ~.9dd .9 oUiu.Ku..

uqpuuu

,,

3d.~,J;W.
d.


SQL-

_ _ _ $screenshot

($ screenshot)

INSERT.

$_FILES [ screenshot ) [ ' ] ;

275

u,
u ~ . vaHHblX

u u U3Qet1Uf! ...

kaK Li?-

, . ll,

06 ocalOTc. , ll.,
ll3lO 6 .

, .

GIF, JPEG PNG (


) .

MySQL)

:i (,

BLOB (Binary Large Object, "


INT, CHAR, VARCHAR

>.> ),

.
,
. .

, -

AIS moga
u.a;paeus

e&<mpatnJ}'
goowno

1U

qt'1A
u.a;paeu.

.ru.
a~
276
5

, ,

HTML

. ,

HTML

, .
L-, ,
, .

~ nap.6onm

(index. php)

,
. , .

<?php
//

$dbc = mysql i_connect ( , www.guitarwars.net "

//

'admin', 'rocki t "

'gwdb');

MySQL

$query =
$data = mysqli_query ($dbc, $query) ;

/ / .
/ / HTL-Koa.
echo '<table>' ;
while ($row = mysqli_fetch_array ($data) )
//

echo '<tr><td class=" scoreinfo" >' ;


echo '<span class="score">' . $row[' score'] . '</span><br />' ;
echo

'<strg>:</strg>

echo

'<strg>:</strg>

' . $row[

. '<br />';

' . $row[ 'date'] . '</td>';

i f (is_file ( .............................. .

echo '<td><img src='"

'']

&&

filesize (
'"

) >
lt=""

/></td></tr>';

else {
echo '<td><img src="unverified. gif" alt= "

" /></td></tr>' ;

echo '</table>' ;

mysqli_close($dbc);
?>

277

8"U8 8'lU

(index. )

,
. , .

. l1ust K09d ~ . Ul1Jb. 3.9..

~.u

or die(1,

'\ btu'\ .u

u ~. u gbtr)..u ~J(UJ..W.

<?

. '\SL 1X>J,O..., bI. JdX01\u'Y\e dU'\ . I"\PU

).u ~o.o coe I1u.o.u. . ...

/ /

MoMettl'I\c::t ~ . I"\POI1YCKc::tl'l\b . - K~'Y\KOC'Y\u..

$dbc = mysql i_connect ( , www.guitarwars.net "

'admin', 'rocki t "

'gwdb');

SQ.\..-3c::t"'poc, pe3YJb'Y\c::t'Y\e bU)offieust

//

ySQL 1(000000p0Zoo ~~;I(c::t'lO'Y\. l-l.bt .

$query = ...~~.. ~. ~~~ .9.,:,-.i~~~~~~~

.,1
~ peu'Y\u...(){), (){). . UJ,e........."c""

..... '

$data = mysql i_query ($dbc, $query) ;

/ / .
/ / HTL-Koa.

. <table>' ;

while ($row = mysqli_fetch_array ($data) )


//

'<tr><td class="scoreinfo">';

'<spanclass="score">' $row[ 'score'] '</span><br />';

'<strg>:</strg>

' $row[

'<strg>:</strg>

7mc::t

'']

' $row[ 'da

'

'<br /

9.~ "'o.l'l\.

'\ l'I\.
c::tu ~o~
l-Sl

"

'</td>';

J.~~~.C~~!:~~':I.~.<?~'J) fileSiZe( ... $r~~C$.c;;r~~!'I~~~


'<td><img src="'. $rW['srr'l~t'J~lt="~;'" -/:~/~d></tr>~

i f (is_file(

&&

............................ ...

~ l'I\c::tuu, I(J( scree",~ot coxpc::t.e.o

u... ctU U30pc::t.t.st.: I1Ol'l\c::t)OW,.


l'\O~cl'l\b c::t... peu'Y\uMc::t.

'<td><img src= "unverified.gif" alt= "

rnaB

" /></td></tr>' ;

n. r.. ... ,

.. .n .
!'lO

r nn.
?>

278

'

f60 , fu.

--
r n r ,
II, ncr r.
, - ~

www.he adfirs t labs.com/ books / hfphp.


chapterO 5 6- (index. php), ~
(addscore .php) (style. ).
, ,

addscore . php,

~ ,
. ,

< form> , $screenshot -

. SQL- INSERT,
.

index. php ,
, ,
.

addscore . php .
index. php

. .

.... '"

"',<;;

"'"

368420

Ja: Arro CJom

~: 2~'!.:()4-23 09:13:34

L.. ...... - . _......

64930

Ja: I<e

: 2008-04-23 14:09:50

_"'--

":

'186580

.N.I: ~B

I: 2008-04-24 08:13:52

, , ,
,
?
,
?

279

Kvaa VJ

, , , , ,

-, - .
, . !> u
,
. ,
.

< img>
index. php, src < img >

( ) , ,
ll ,
, -.

r.dJI.
d UJ~f-lli,

110~"t\:9Q},20

~eu"t\u.z, ~I).

I<~I<-u.d .\"t\.\z
1< Mt)b )(tI')

t)30.\"t\..

........ ~

"....-

280

"t\ct cpopt-'a b!..9u-.n Sl

'!\ct"t\
t;;t\j..u.5l u,..u..
_ _- ctddscoreP"P

u,, 8

l n .. lI..
II.

.
, . -

move_uploaded_file (),

, :

~OMec1\O~
J4 .u.

~Jk:l

u.3 0d Pcl-.u,
i{}cl)OOJ,.
u. "1\...
1(\1\cl .ct

u.

u.

\. <1.cl.

,
,,

index.php
move_uploaded_file()

l(\1\ I(cl1\cl.\ mo-1\ dbt1\


u." \. }d I(cl1\cl. .ct ce.pepe

Q-. 1\(,' 1\dbt QC dbt .


.. .1\I1 .ct

3C\Ilu.cb.

'IQQJt)j!q(

'

phizsscore.gif

phizsscore.gif

281

nynwx

lfG SbJ~iiG't1I,

ZV11blX ~011rOCO~

~:
,

php.ini?

: . (php. ini)

upload_tmp_dir.

, ,

~:
? ,
3 ?

: . . ,

.
,
, .

~:
?

: .

[ , tmp_name']

$_FILES [ ' screenshot ' ]

. ,


. , ,
.

,
,
L- , 6-

-.
, ,

282

lS

, 8

mUtl. \I1ma, 3.

~~blf.~
atlbl. mo OO1cm&umtbtlO .
() C1DC
ue HU UJef nomu,

nor

( OU t'fmbCSt

KCUOMY JIJlO KaCIIIOr


,

Images.

ra -
, ,

,
,

, ,
.
.

images,

. ~ .

, .

dYI\uu. I(dYl\d. iYl\ct~eS

. )Od. .. I(dYl\d.ct,

. oh.ljo-.Yl\

..u.Jd,

IjUJ10..1.L., COdU.pct51 ce ctG.


u.3 0d ct..u.u. ..- MecYl\e.
~

283

z x u

J 6J

:1vrio

images -,
~a , - d-d.Yf\c!Jl G.
t'luJ10u,
-.
- ,

KOYf\OPOM

(.lJ.bt.

images - -,

- :

.Q u... Lte.eM
Kd.Yf\c!JlOz,d., d.J. t))'"YI\b.
$screenshot;

$target

-u,4,.

'~d..

\t'ldex.ptp.

6-

QmageS~izsscore.gif ")
I

$target ,
.

GW_UPLOADPATH,

images. ,

. ,
.


images,
, .
_~"'"."'11~-~

n -n
nlO

M8cre, Bawero
nOKanbHoro
KOMnblOTepa,

3ct.j>t.
cpctubt

UJdd..u.Ct
l\d )OYf\.

Kd.Yf\c!JlOG.

., ,
n0 n. Toro,
KaTanor Image.

bLf\d.Yf\.

\.. <iYf\> move uploaded file (

images

- n

iYf\ds, .
. .u.x .Yf\

. bLd.

Yf\ez.

UJdd..u.Ct $_FILES['screenshot](t~p_name l ,

. d...

, ,

F-.

284

, coxpaHeHHblMU 8

1h.~Jfb~ i1,l\ u,8r~GlfUt}I,


ZU~Glflf lf CGr~Gr
. aga

urpam qJe.-n.a. UOp.eUSJ.

nogmepgaero nogucm peilmura.


5.

u U063um nym.

npox.ogum s npouecce
pasom npueu9 ci'umapHbIe \l.
epmume CIIO\l
sce mn npuoeUSJ.
85S gaHHbIx..
.om.opi1 qJe.

ga\lme ma.. ga

,._"~....... . .1 e\l qJe.!

... d. '-i\-UJ.'Yf\

:'!'!\)09\

phizsscore.gif

~
phizsscore.gif

:~=blc:e:.~~tir
" ._

.~~:~..... ::~ ..

: ~~-~~,.._

..

:~

$screenshot

= $_FILES['screenshot']

INSERT INO guitarwars VALUES (, NOW(),

[''];

'$name', '$score', '$screenshot')

guitarwars
$tteenshof

phizsscore.gif

285

uUR,

11t.aJfb1h,G ~i1,. u,~~GlfL4jI,


3~Zkt~GlflfbJM H~ CC~C
.8awa aga -

urpam

cpaw.a U306p8eU9.

nogmepgaero noguocm peQmura.

cepsep. u U06p8Ulb nym.


npoxogum 6 n~
p8Otn npueug .umape lIO\l}lbl)t.
::.-_ __
epmume C1IO\l nym

arpyeoro

.omopi1

6W - Yl10 dcU1bbl.e

!! man npuoet

d/;;. 6uitC\r WC\rs

a6bI6 gax.

ga\lme ma. ga

(<<[uYl1C\pbt.e oabt.::I.

arpyen !

Ou jd\)(]'/!\ .3.9.
'II) Yl1\ .Yl1\."fI\Q

&

.........

r\oii

t1u~.)f."fI\
t1u u).

dote

4Q08.()4.23 ()9; 12:53

2()Q$.()4~$. Q9: ~,4

2!i..()4,i/

2008-04-2408; 13;52

r: n

KaTanor

n .

K<>I'e

2OGS,()4.:'2;! 09:03$

nepeMe~Ii~I~~~~~
BpeMeHHoro KaTanora

286

14:09;50

186580

-
8ll rpw nw 6, lO r,
nocrOtlHHOe , 6crw KaTanor ntl
tl n 6.
addscore . php ,
GW_UPLOADPATH .
, :
<?php
//

' images I } ' /

i f (i s set($_ POST['submit ' ) )

//

"/", !f30F~

~ne ( ' GW_ UPLOADPATH ',

$_ POST

$narne = $_ POST [ ' narne ' ) ;


$scor e = $_ POST [ ' score' ] ;

$sc r eenshot = $_ FILES( 'screenshot' ] ( ' name'] ;


i f (! empty ($arn) && !empty ($score) && !empty ($screenshot) )

/ I

$ ta rget = GW_ UPWADPATH
$screenshot;
i f (move_uploa _
$_ FILES['screenshot'] ['tmp_name'] , $target)
1/
$dbc = mysq l i _ connect ( . www . guital:wars . net ., ' admin 1 . ' rockit 1, ' gwdb');
/ /
$query = " INSERT INO gui tarwars VALUES
mysqli_ query ($dbc, $query) ;

( , NOWO,

'$arn',

'$score')";

/ /
echo '<> , ! < / > ';
ech o '<><st r g> : </strg> ' . $ . '<br /> ';
echo ' <strg >L;liil1 < '.at i! ;"
$score . '</>' ;
ech o '<img src ' . GW LO . $screenshot .
,lt=-, - I ><br 1> ' j
echo ' <>< href= - index.php>&lt;&lt; </ ></ > , ;

!)

index. php GW_UPLOADPATH,

- .

3Q..bl. . cepep
Qu u.J~...u..,

\i.9"1f\:9).

\i.9 u..."tl'\ "tl'\w{z'd,

"tI'\el)epb l,9. . .M.o


"tl'\.uu, \iu...u...

. CYf)C\pbtx 3)l
~"tI'\u..g,_9. I<O"tl'\opbtx
tpaUbL UJod-ct...u.,

\i .9"t1'\...9 d },<
11 0.9{,C"tI'\b ,

O"tl'\~)"'tI'\C"tI'\Y)Q'/l'),
bLf5o,9u"tl'\ .
UJd..u. CIJ

I').9"t1'\..l
, .

287

~;

php.ini

,
?

ph;:>. ini .
.

.
.

.
.

php. i ni.

~; ,
?


.
, ,

.
.


.
,


-
,
,

IfG SbJ~a.G1h,

Z1111bJX ~011YOCO~
l1}

; . .

index. php. HTML-Ter < img>

, .
-

.
.

HTML-KOA

. .

.
.

. .
gu i t rwar s .

,

. .
,
.
.
-

. :


,
.
,

HTML-.

<u,u 1il)eO . btt).-m

f{i).KcJ.l\oU u-. l)o '-tm o J


.
$screens r,ot;
~.u-ct.btx .9ct ..btx

"'- ctK U-~I).. pect;;bfiou L\'\. ..

' \ . .9~u.'l!1 l) t)epec.
1221634 560phizsscore . gi f
t)~ 3,Q.u-. Jct,ct .....; :
phizsscore. gi f, 1221634560
I)U .u.,u.. "OCl)o5('..o
$target

G\v_U?rlI.D?fl.TH . t ~ me ()

(
,

o,Q ..I). U-I)fiU-d

oJpctcyrIctel)!

~
..
nIO

. ~

l1}.

. ALER .
MySQL. .

MySQL HTML-Ter < inpu t >

move_uploaded_file ()
.

gaHHblX. yg UCnOAb306at11
gaHHblx g coxpaeus s
uea s qxt.U06.

gaHHble.

org g U

cogux. u u

$_FI LES
.

gaHHbJ)\ yg
xpaut11 gaHHMe.

saax

288

;
. ,
.

6-
.
. .

rn 9 s . ,

, 8

~ l(oIiC"IY\~IiYI\e

!,&um n m u

amaor () !'u ?>~bf)( cer&er

G\>'-UPLOADPATH

4>U& wum &Kocmame,

u."IY\. USI.

,()aemc &()& ronax: indC.f1hf1 u addscort.f1hf1:?

~"IY\\.~. ~..u

m n!'ou3Qooem n!'u u3l'leuu 3n1oro ueu:?

J~..btx ,Q cer.ep

~u UJf(..uu.

d.f <n. (

'''''_OP'''A'>PAII', ia
'

1'-;11

u,u5l defil'\eO ~
Ul'\ "'l'l\. "'I'I\O~o. v!\bL
.3d."'I'I\ u -tuJ.d.UJu:m

::J

' ' ) I

3u. ."'l'l\~."'I'I\

KO"'l'l\0pOe . ."'l'l\ bL"'I'I\


.Yl\~."IY\bL. UJe.e.o ... "'1'1\0
U ."'l'l\d.."'I'I\d.!

."'l'l\~."'I'I\

. KaTallOra ., .... II.'"


. . ... 6l1.

nll. l
,

index . php addscore . php

GW_UPLOADPATH .
, ,

,
.
, , .

11 , Jl

1/

"
'].mages)' ::>

~ ine ( 'GW_U1?LOADPATH',

KoIiCYl\~IiYI\~ w-.u,u.\.UJU~ ~-9bL. u 'VI'\


J.d~Yl\. Yl} 0.d U

Yl\d.

I{OIiCYl\d.Ii"'I'I\d. Jl.)/(.,Q

------ t).u.d.YI\. pctJ.bt.x MeCYl\~.

/ I ,
/ /

I/

py~aex ,

efine ('GW_ULOD ' ,


de 1.
_

'irnages/')'
8);

index. php
addscore. php?

addscore.php
~

289

J
,

,
.
,

CPat1AbI. ucn

rll 6 ll

//

C06eCInO

index.php ...

...

ecOAbu

cueapus

/ /
define ('GW_UPLOADPATH', 'imagesf');

nuema g1

5b1ffib

index.php
TorAa

gocmyn

Al

u3

gysup06aU9

ttoga.

r 6 .

Q
-
,

addscore.php

,
, .

rGW_UPW~~~~)

----;:/

~-----~

index.php

addscore.php
8 en
R, llR

?

, -,

-.

290

, 6
I I

..

,
. GW_UPLOADPATH

<tlbl
nm1A9tn

~\ , ~

\ectn

~.

UCnOAb3058.t11b

<?php
1/

//

ttog

de f ine ( 'GW_UPLQADPATH',

'images I ' ) ;

Ct,Jeau.

?>

require_once ( 'appvars. php 1) ;

oddscore.~

require_once ( 'appvars. php' ) ;

index.~
!1

JfG ubJ~itG'}1t,

)Jctu. ctppvctrs.Dh~
g.9p'~~e cu,e~pu.u. 11 6 150 -"'t\

u. u.\ict-m l")er.eMe.bte, J..

u.WJ.u,u.ctu.u.ct.
I

ctppvctrS T ..

ZVl1bJ.x ~Ol1fOCO~

~; ,
?

; . .

~
"1 .
" ,
. .
. appvars .php.

1}

",
OnbKo ?

; . -

'9; -,

,
require_once?

; (inc 1ude f i le)

- inc 1ude (),


, require_once .
, ,
require_once, ,
.

inc 1ude . ()
,

, 3 ( )

include require_once

, L-,

',

requi re_once.

1>
: .

include_once

require_once include.

require.

',

291

require . n

require _

,
.

require_once

>,> ,

, .

>'> ,
, .

, .

~----------------I

requ i

<7php

~""'I'+
// ,
..
//
define( ' GW_UPLOADPATH ',

re - once('appvars.phP');

_______--

' lmages/');

7>

-md z-dab.
l1.~. .)/)J

dbt dJ-lbt
.. 11 u.t-U..LSt,

J<o)JopbLe .u.bt

U u,

it1dex,p"p, U u,
dddscore.p"p,

require_once('connectvars.php');
<7php
// ,
// ,
//
define('DB_HOST', WWW . quitarwars.com.);
deflne( 'DB_USER', ' admin ' );
define('DB_PASSWORD' , ' rOCkit').
define( 'DB_NAE', ' gwdb');
' ~r-__
7>

~Me.C)JO )JOO 'h'r\odbt. U a)Jb


MpeMe.bte, .ubt. .
u..u.5t ddJOu. d..rWu<

~J
~" . .~~

fAiiiliillilff1
connec:rs.php

Ka~OM cu,eapuu, bt.

l')e.pertec)Ju ux gd..bt.
du. U UI"\jd"t\ COeMec"t\.o.

1eue

l\EOUU\E_ONCE g05Age1tl 6
Cn3ro Kog gpyrue CUea.PUu
292

lS

, 8

<?php

//
//

L _de.!.in~ ( ~W.,2 P~A~A!.H'...:.. '~m':2e :.C !..: _

,
.J

--------------

// ,
// ,
/ /
define('DB_HOST ', .www . quitarwars.com . );
define('DB_USER ' , ' admin ' );
define('DB_ PASSWORD', ' rockit') ;
define(
' DB_NAE
'gwdb
); _ _
L _
___
_ _ ',
__
_'_

.J

//
$dbc = mysqli_ connect(DB_ HOST , DB_ USER , DB_ PASSWORD,

DB_NAE);

// MySQL
$query = "SELECT * FROM guitarwars ORDER score DESC , date ASC ";
$data = mysqli_ query($dbc, $query);
// .
// HL- K oa .
echo '<table> ' ;
while ($row = mysqli_ fetch_ array($data))
//
echo '<tr><td class="scoreinfo"> ' ;
echo ' <span class="score " >' . $row[ ' score ' ] . ' </span><br /> ';
echo ' <strg> : </strg> ' . $row[ ' name ' ] . ' <br /> ' ;
echo ' <strg> : </strg> ' . $row['date ' ] . '</td> ';
i f (is_ file(GW_UPLOADPATH . $row[ ' screenshot']) && filesize(GW_
~PLOADPATH . $row[ ' screenshot ' ]) > ) {
echo ' <td><img src= "' . GW_ UPLOADPATH . $row['screenshot ' ] .
lt=" " /></td></tr> ';


r n.

r ~.

else {
echo '<td><img src= "' . GW_ UPLOADPATH .
alt="He ! " /></td></tr> ' ;

' unverified . gif '

'"

, 0.9UK obt.u
W\d.t)I HeI{O'\0pbt.e
J":9d U "'\I( ZI{

echo ' </table> ';

t)MupOd.W\b, t)W\

mysqli_ close($dbc) ;

index.php

dY.9bW\e cez~d. zoW\obt.


l{oppel{W\upo~d.W\b

coe.o t)U.I-W..
t-tC\ W\}

J--

nR n n. n_g r
r ,
n .
appvars . php

connectvars . php ,
require_once

index . php addscore . php ,


. -,
<l6 . 6 ,
II ,

293

ORDER

v
__


- ~ .

, .
, , ,
, .
t ...,.wc ......
'II_
............

.:f~;;~
~~~ftu'

... '-h)o ~u''1 pe.u.'Y\'\U,f{z,Q '\'\\').


'1U, .

;~

... -.......

:::1~-

-.......

CO\')rOo~"eYl\c~
.9 0 &.u. cpct~

.3"

U,).u.

'YY1 0 Z.0,

.........,...,...,.
.
............

,~
'

ftOOZ.O

u''0~'Q.lW..,

'-h)o

~eu.'YY1u.zu'

\').9'\'\r~).

bto.95!.'YY1 C 5!.

Yl\'\'\ u'\'\U,ft. ...

~ WUHCm~HOU

mao t'WmUHr U~t'aetiU,


nm&epQ1J.lU ero num,
oa~ & Iue cnuca:?

dI1 .(

.....
..
---

60<'1)0

,......",

--11\6-"'"

*"I1~II;I)~

~
, .

, ,
.
, ,

. ,
,
. ,
ORDER ( ... ),
.

294

, , 8

u MySOL

ORDER ,
SELECT,

. ,
. :

ASCending (), DESC -

ASC -

DESCending () .

295

MYSQL

u MySOL

, ORDER ,
SELECT,

. ,
. : ASC ASCending (), DESC - DESCending (6
) .

l"\~till

1"\0 4Yf\

u. 11 u.u.Yf\ Yf\ 9. 341"\u.ceu. u.btu.


.3 tu. peuYf\u..z.o. ~ 4ruJ 4 Yf\4Ku.x
J41"\u.ceu ",-Yf\. . .. I"\. Mo-'j't\ t)u.Yf\.
. 4 cl"\u.COK Yf\4.1\ Yf\4Yf\. u.

296

.3t)5!.Yf\4 .dt.t.4

.3 _5!. \J .u.5l
.u t).u..u.5l.

coxpaHeHHblMU 8

w M
,

.

, ,
", ,

; !.

,
! .an. , l~ !
pc~8 . ~n_~ T~,... . ....

3ZI< CI1U.CI<d.
peU'Yl'\u.ftZ.o

.cJ.z.

.g eMoKC'YI'\pu.pye'Yl'\
.cJ.u.btu.

peU'Yl'\u.ftZ..
I')I(d.,3btd.. u,.
1( I(O'Yl'\0POu. .9'1'1
'Yl'\.u.'YI'\.

zu.'YI'\d.p.bte Ou..bt
coe .

:; 345900
... .... _ _
:

: n. : 2008-04-23

HG ~ClG'}h,

Z'if11bJX ~011OCO~

': r r .
?

: , .
. ,

.

,

, ~

297

tu 55

((

[55


, .
,

HTML, CSS.

L-,
SS-. ,

topscoreheader,


~ ~

style. css.

c"tl) Jct.ct
b1.pctKu.cte"tl) .

v!)"tl) "!\.
. u.\10.ct. .

'~.u.. .u.u.
u.ctX u,u.u.
ct co u."!\u.z .

.error {
font-weight: bold;~------------------~~
color: #;

\')0 u,."tI).

.topscoreheader
- - - - t l 7 text-align: center;
font-size: 200%;~--------~------___---t--.L_'-. background-color:
color: #;

u."!\ "!\,

'hr\o
. ~. btgu.5l
"tI)eKc"tl)ct 3ct .(ct
. .ct\1u.cctu.u.
u.\10~i'\\. t
u.cpm .ct rt .

\10 ct.
pctJMePOM ~
i'\\ctbrt. "tI)"!\Q

.scoreinfo
vertical-align: top;
padding-right:15px;

styIe.css

v!)u. ct ctct "tl)u.


u.\10j}(\. .

<ct"tl)u.(s'ct.u.. "tI)eKC"tI)o

peu."tI)u.zo, b1.ubtx .ct


.ctu. "tl)ct.u.u,.

index. php

L-,

.
,

,
.

while

298

z5

p.ctJe~

u.Cf.:rn}ct j>u.

.score {
font-size:150%;
color: #36407;

...

, 8

i ndex . php

(55-

topscoreheader.
(: ,

HTMl-, .

//
//

HTL-Koa.

echo <table> ' ;


$i =

whilf# .!.~;-~.:'.. !1!~.~9.~~.~~~~'?h~~::::;-~~ ($data) )


//

if ( .............. .. ) {

echo '<tr><td class="scoreinfo">';


echo '<span class="score">'
echo

'<strg>:</strg>

echo

'<strg>:</strg>

$row[' score']
'

. $row[ 'name']
'

. $row['date']

' </ span><br /> ' ;


.

'<br /> ';


.

'< / td> ';

i f (is_file(GW_UPLOADPATH $row['screenshot']) &&


filesize(GW_UPLOADPATH . $row[' screenshot']) >
echo '<td><img src="'

. GW_UPLOADPATH .

lt=""

$row['scr~enshot']

/></td></tr>';

else
echo '< td>< img src= "'
alt="He

. GW_UPLOADPATH .

!"

'unverified.gif'

/></td></tr>';

.1 ........ ........ ... ..

echo '< / table>' ;

index.php

299

index . php

(55-

topscoreheader.

Vi>~

: , -

L-, .

3'lr\o t)epeMeKJ-V:\.

$i -

crtI\. U1l\41\ m1\g

.u.b. UJ.I.I<lld ~ JN>! ut)Jb~1\ _ q. :g

~(~;t.~t)~;m1\ ~e~~e u3 I-X, KcrtI\0FM~ crtl\fS'em 1\ ~1\

II

t)pb (kti'~) pe1\\'\z'


.

u&t .3.u.,

!101'I\0 Ue.o 'II'\


Mec'll'\e .eox0.9Uo .3QI'1UCQ'II'\b
HTML-I(0.9 .9. /;...9Q
'QZI(Q cl'1ucl(Q.

while ($row = mysqli_fetch_array($data))

if

{)

L-.

echo '<table>' ;
$i

$'

OZ.9Q 1 PQ , .bt 1'I\0


.3, rl !1 .9
u,uIUkt .bt PQCC,Q'II'\pucteM
l'1 epy>o }Qt'jucb \u...ct,
1(000000pou COO'll'\e'll'\c1'l\ye1'l\

(..$.i..7.7..0. ... ) (

..~.4.<?:~. tp~. ~{~9.~~p.c:'~:: ~ ;,..~ .~.~~~.~:7)9.p.~~.l?r~~~~(~ ~~~~.\:9: .p.~Q.m~: ....... .


.....$rws.r.': .<'/td>.<.6'; ....................................':...
':":-...-:''

"---

..........................._ " ) . . . . . . ..

echo '<tr><td class="scoreinfo>';

echo '<span class="score">'

topscorel-tectde.r

echo

'<strg>:< / strg>

echo

'<strg>:</strg>

$row['score']

. $row['name']
'

'</span><br 1>';
.

. $row['date']

'<br 1>';
.

l'1 ... ctu.

sty.fe.css.

'</td>';

i f (is_file(GW_UPLOADPATH . $row['screenshot']) &&


filesize(GW_UPLOADPATH . $row['screenshot']) >
echo '<td><img src="'

. GW_UPLOADPATH . $row['screenshot']

lt="

1></ td>< / tr>';

else
echo '<td><img src="'
'" alt="He

. GW_UPLOADPATH

!"

'unverified.gif'

1></td></tr>';

.1$.\t:t~ 3.u. 1'l\Q

~u.UQ'll'\. e.9u..uu,y

OXo.9O u,uI(M

echo ' </table> ' ;

z5

1(0Ku,e I(Q.g Ilct.


Yn,01'l\ 1(0.9 I(ucti...",.
1(0.9:1 $i = $i + 1;

Index.php

--
. r
w r.
index . php ,
SELECT, , .

- ,

, .

(
HdUbtcWUu.

u.l\u. l\e\1eeb
jd..l\
2-j>0l< U .

' cd}ll.oM epx~


cI"\UCKd.

, , ,
CnUCOK

menerb lV ...

l, ) u U3 u
enl?v pemuHrol?

nVV.

, r

. , ,
,
...

301

u uu

\ .
_ __--.
..:

:3':911 Xecml

.",..

---.,

.. ....

.... ,

,,

,
\

efhelshugescore.pdf

n 06gl
, ,

, , .
, , ,

(,

,,
,,
,

n nlt cnw n ,

32 ) . ,

. . ,

, - , ,
. .
.

, ,
,

addscore . php . -,
,
,

32

. - , ,

. ~: .

'

..

"'

I .

Ir

j
;

_ _-

_ _-

. I1r ktl apJI :6lDt.I.

/-'-"-,....

..... _~...

....

, JI:
:. ....
.
i : "SOOOiiO'--'-',

...

...

.....

...

I :~f~ aanllWpo
i '8 - . . . _.__... -._-_.-

, .

~o .u. u. f/ldJ\O 'h!\o ~0u."II'\;--8III!!!! !!~!!!!!!"l'1~!!'JII!!.~.~. !r


t) 3 0GI."II'\) 110 'f) "If\o~o. 'h!\o O~ Gl."ll'\
.'f)Gl.u.b. I1pU. JGl.zpYJKe coe~o peu"ll'\u.zGl..

302

l5

60

, 8

'l 6I
, ~ . ,
?

$_FILES, , ,
,
II

images .

1 Mdo.U"YI\
'"
,
OJ J; .J .3. 0I\j"YI\u. .
$_FILES [ 'screenshot' ] [' size']
~ ~~ 3~ g2 .u"YI\ (1 280 lt't-? do.U"YI\
",1 280472 ~
~t 122 ~do.UYf\ uJll.A 1250 Kdo.U."YI\).

MIME .

rtvIU. l')oe~btUlde"Yl\

I.A\') -. ct PDF, 'tI)


$_FILES [ , screenshot ' ] [ 'type ' ]

Mapp!icatiQi/J?qf

. Yf\--- 'ml.Al1d ~

UJ..u., -o.l{u. 1<0.1< GIF, JPEG

u.u.

PNG.

,
, ,

32

, .

MIME - :

$_FILES['screenshot'] ['type']

GIF
.ubL
1.A3 0 ,..u.U,

JPEG

\'):t"Yl\.:.~w<
peu."YI\I.AZu..

~.~-------------'~

~' nopa6omamb

i f,

, ,
,
, ,

GW_AXFILESIZE. ,

..~~ ..!........ .... .....~~~~.~:~~.~~~~~.~.~:.~.~.~.~~:~.~~~~.~~~~.~.~.~~~~~.~~~~~.~~~.~: ............ .. ... ..

, ~

8 nn

~ ~~
,
, ,
'"

el(o"y!)opbte

dPQYJepbt
UCt)OJJbJY)O"\}
"!)"!)

"Y!)Ut)

, , GW_AXFILESIZE. ,

$screenshot_size

$screenshot_type

~I~I .9 ..~ ~ .. !.cc.$.s~r~e.r.d!QLt~re..~.=:. :imc19~/9if:). JJ. .c$.sc.re.eJ1Sto.t~t~p.e..=:::7. \'ttId9e./jre.~,JI1.


Qt)J.ctct.u (~
...1.. ~:t
-- '.
_1
') I1 ($
..1. Lt
-- 'i
I ')) &&
UJdJXI...u ... .. .. .sc.re.eJ1:tt(). ~- ~~:-: .. \lI1d9~ pJ .9 .. .. .s.t\~Q.
. .-:-.7 . )\19 pn 9 . ..

~ptG~ftI4"Y!)~ .. .... ... ...( $.$.vr.~~n~Q~_~\~.~ ..~ ..o). ~8... ($~~x~~n~~t_~j?;~.. ~.7..G.W.J.I.F.l~f:$.1:) ).1 ...\ ... .

<?P~~

//

/1

""------

~:~::~~~~_ULOAD',

'images/');
define( 'GWJW(FILESI ZE ', 32768);

/1 32

TQI< I<QI< 0t)"!)u.bt ;'"ld.I{UJ.I.c::tb.bt.

pQJep ctil t))1) "Y!)et)epb

~ ~e' .9., ')1) cu,e.d.puu

dct co il"Y!)uz, "!) bl.


'vr\ J.ct.u l(ortc"Y!)Qrt"Y!)e.

?>

.u
Udl(

n JJ
n 60n

l')oMooQe"y!) I').."!),

I(Ql{ue u.9bt ctg


.I')"!)u..bt .

, -

JctGpYJl{u.

, ,

.
,
.

. r
"----~

. noa'I'P....IO. . . . pdtJPI[', ;&JIJIC" w ..... no6p8aaIU

+--- GIF. JPEG ... I'NG < '_ ,..,_................ 32 ............. __ ....
:

iiiiXiiii8

Pdi: ;

.... - -..

5OfJOOij'''-_ .... -

R:~~ ..............

---.........-

......

.......

.......

elhelshugescore.pdf
304

z5

jocobsscore.png

60 , COXPOHeHHWIIIIU 8 Q
~e.9u:VI'\e ~p.a1'l\u.oe

du. Udl{

1'1\0,", ~d.

u . 1'I\0~O "Y\u.I)cI. UU uee1'l\

u,", d pcI.,3ep.

i f (!empty($name) && !empty($score) && !empty($screen ot)) (


i f ($screenshot_type == ' image/gif') II ($screensho _ type == 'image/jpeg ' ) II
~
($screenshot_type == 'image/pjpeg') II ($scree shot_type == ' image/png ' )) &
($screenshot_ size> ) && ($screenshot_size
GW_AXFILESIZE))
(
i f ($_ FILES['screenshot'] [ ' error'] == ) {
//
//
$target = GW_UPLOADPATH . $screenshot ;
i f (move_ up1oaded_fi1e($_ FILES[ ' screenshot'] ['tmp_ name ' ], $target))
//
$ = mysq1i_ connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAE) ;
//
$query = "INSERT INO guitarwars VALUES
mysq1i _query($ , $query);
//

'<>

(,

NOW() ,

'$name ',

' np

' <><strg> : </strg>

' <strng> : </strng>

'

. $name .
I

'

</p> ,

' <br />';

$score . '<br /> ' ;

echo ' <img src="' . GW_UPLOADPATH . $screenshot .


" lt= ,
echo ' <>< href="index.php " >&lt ; &lt ;
//
$name = " ";
$score = ";
$screenshot =

'$screen hot')";

echo

' $score',

"

/></> ' ;

</></>' ;

mysq1i_c1ose($dbc);
e1se {
echo

' <

else {

class= "error ">

' <

.</

lss="rrr">,
'
'

(GW_AXFILESIZE

// ,
@un1ink($_FILES[ ' screenshot'][ ' tmp_ name']) ;

echo

'< lss="rrr " > ,


.

1024)

'

'

GIF, JPEG
' .

.
PNG,'

.</>' ;

< /> ' ;

addscore.php

305

- addscore.php

--
r II
, lO r, r .

addscore . php , ,

, .

- ~ ~
, (
).

'9:

MIME?

JPEG

: ,
-

IME JPEG- .
,

JPEG

'9: GW_AXFILESEZE
appvars.php,
addscore.php?

: ,

appvars . php ,
,

, ,

. 3

GW_AXFILESEZE

: ,

appvars . php ,

?
?

: - .

. ,
,

,
.

addscore . php

, .

,
.

'9:

@unlink()?

: - unl ink ( )
: cn -

,
. ,

( ) ,
,

unljnk ( ) ,

@.

-,
.

306

aaHHbIMU, 8

r . .

,
.

. I(u.U u.btcu.U U1\u..z


>,) ,
. t)1\~:9.. '-hI\ .
.
.d)) . u..

y.u.. t) 3 0 d"'tl'\.

34:5900

guitarwars
id

-' -

__

no, * t.....2 09:06:35

dote

name

$core

2008-04-22 14:37:34

127650

2008-04-22 21 :27:54

98430

2008-04-23 09:06:35

345900

2008-04-23 09:12:53

282470

2008-04-23 09:13:34

368420

2008-04-23 14:09:50

64930

2008-04-2408:13:52

186580

'.

phizsscoe . gif

, ,
:

307

6Qu

SQL

DELETE. .

Bes-nUemI9
6am

u cmpau
gocmynOM

-. ,

, . ,

SQL

gg

cmu

gocmynOM

, ,

agMUucmpamopa.

- ...

om

!
, .

gg

UCnym9
gg

' Je Jen

u
nogg.u tna.
C"W\Pd..uUP oab CO
peU"W\UK2.:O U 2...
C"W\Pd..uup fU"W\dP.btx O.:o

PdJectdO"W\dbt ~ '11\02.0,
~ m~bt I')30d"W\ 2.
3d 2.U"W\ . cepep cO
U"W\u.. U I!poca"W\pUd"W\b
CI')UCOK cex U"W\u..o.

--186580

."".:1.....

14 0t1:13:S

..... :/-': .

..'

tr
d'II\u KKOI')KU
Ke3ducu.0u.
cf>UK cdu,u.eu. U"W\
I')u~"W\ Jd..u)
coo"W\~e"W\ c"W\ts'y)OVJ, u. .<ucu..

308

, r

Toro,

r.
, r

gui tarwars

, r, .

odmin.php

removescore.php

guitarwars
id

dote

nl'

score

2008-04-22 14;37;34

127650

2008-04-22 21 ;27;54 _

98430

2008-04-2309;06;35

8-

345900

2008-04-2309;12;53

282470

2008-04-2309; 13;34

368420

2008-04-23 14;09;50

64930

2008-04-2408; 13;52

_"

186580

sc:re$hot

phizsscore _gif

309

, ,
. ,

gui tarwars

, .

.
u

. . peItr,ro
, yI ry Cl]J8IIIt)\

_ .

. _ - _ . _ ....: .. ~.~~~~~~~ cl'o ltrro.

~DIOB .:

2008-04-2309:]3 :34 368420 _ .... ~.....-

- ._._

2008-04-23 09:06:35
:_. ._
2008-04-2309:12:53
,
- 20080424 08:13:52
." ..
2
<_ 008-04-22 14:37:34
. ._ 200804-2221 :27:54
. _ ._
2008-04-23 14:09:50

6-

345900
282470
186580
127650
98430
64930

... _ ...... _ ..... _ .... -

YJ

~~~p.~ .~!\i~:~r rJ~r.~~~~!1~~"!I:I. p.~~~~..


~<?~ .I)~~J~~~~~!'.~R-. ~. ?:':4:I)~p.~~I?Y.I~~i;i........... .
~~:v!\~.~..9!.'~. ~:i~~ .<?!'1p.<?~~ .p.~.~~~~: .. .

~~!'J~r<?~I?1~~j~~ ~~"!!I ~~':,~~r~~

~~:v!\~. f.~9:"!!I~~"""" " ' " ........ ............... ..

,
.!i,!8
YJ

~ .

admin.php

.. yllCpCllw. ~O ... ci"-" xanne yjI8JI..... 3'

~~~~p.1:t9. r~~~y.~~~~r~~r. P~.~~t)~~~~~~~.


cP.<A~~~~~9~~~. ~~~~. f.~9-~~.......... .
I:tj.~~~~~~~.~~.q~ .......... .
I:tj<?~~~~! .<?!<.<:'J~:t?~~.<? ~~~ ........ .
1)?.9:'!~<?:v!I.~( .\!-. ~~.\!-:v!I..<?~C?~~~~~.... ....

trm<

.?

111

.

iill 368420 Aurro ":nII .

s~~e ."~1!!!IIOUfII~_~lI'I1o

I)?:v!l~~.~~~~. ~.\!-~~~:'!1~~"""" " "

removescore.php

guitarwars
1

2008-04-22 14:37:34

2008-04-2221 :27:54

98430

200804-2309:06:35

8a.t

345900

2008042309: 12:53

282470

200804-2314:09:50

"

64930

127650

I~

~7~~2~00~8~.0~4~-2~4~0;8:~13~:5~2~~~~=~~"~=~--4-1~8~6~58~0~--h-----f~
izsscore.gi

310

25

J ) l an

<!: ~,

:t06 <!:~, .

admin . php

lJX> .

<!: ~

J.; .
<?php
require_once('appvars.php');
require_once('connectvars.php');

II

II

admln.php

ySQL

$query = SELECT * FROM guitarwars ORDER

score DESC, date ASC";

$data = mysqli_query($dbc, $query);

II

II

HTML

echo '<table>' ;
while ($row = mysqli_fetch_arraY($data))

II

echo '<tr class="scorerow"><td><strong>,


echo '<td>'

$row['date']

echo '<td>'

$row['score'].

$row['name']

'</strong></td>';

'</td>';
'</td>';

echo '</table>';

mysqli_close($dbc);
?>

< hrfs"rvr.h?id=5&dat=200804_23%2009:13:34&n=htn%20
Sin&r=368420&rnht="

311

3HDKOMcmBO 3DnpO'OM

GET


, ~

, .
~ . :
~ ~,
?
, ,

URL href

<

...>< I >

~.

U RL

, ,

.
< href="removescore.php?

sr=8420&

A'II]pu~yYr\ href ~.3.


< (VR.L) ~'ll].
..d u,4UU

re'll]ovesc.'ore nh

v..Ji\. ;Q~:;:r: . <JF...~q~-


, .3. .

.9c:ttutGt.e peu-rrjuze,

~.U 3t:1KOCM&)
d.l)... d

~m .

. "-

'

2.Ullepc'cbtJlKe

. 1\ 01\KpbLae1\ u,4u.U . u.1\


U1\u....

).'.0

1\, 01\l').h..1\ ....bt,


u,4 , u..

bt.jbLae.MOMY

.3al')pOCQ .

GE.T.

2008-04-23 09:13 :34 36~~; .... -;;;;;;;:;: .._...._ .. _...._..:


2008-04-23 09:06:35 345900
.
2008-04-2309:12:53 282470 ~
.ip 2008-04-2408 :13:52 186580 ~
....... 2008-04-22 14:37:34 127650 ;;;
j . 2008-04-22 2) :27:54 98430 ~
! 2008-04-2314:09:50 64930 ~

.l')U MbtuJ.u 4 1\U

Y..9cV1e o

0"Y11.9

gaHHbIMU 5 5uge

~
! .

_..... _ ...... _ ... _.~...~""~~o w " l

KO'll]of>bL .9 -. dbt'll]b keodxoal.Abte

~e.t:1 d"Yf\

g.st \

,. < Auo
II.yJl 1j'
nRRI d'ra ..,.

-'l'!l!I.!,,"""-

~.II.I!I!""
I}.~
~ gu I)dpbt:

ucn.305

screenshot=

. 6111

"i

id=5&
dt=2008-04-2%2009:1:4&
name=%dO%90%dl%88%dl%82%dO%be%dO%bd%20
%d0%al%dO%b8%dO%bc%dO%bf%dl%81%dO%be%dO%bd%oa&

QI-U-Ibt

Ul\L cueau

URL,

? ,

URL,

$_GET,
$_POST.

URL

, GET -.
L- GET ,

URL. ,
GET URL.

...

t')

"

...

t')

POS n
, BpeII GE

URL.

-,

action

~.


.,

POST.

, ~

URL.

~.

, ,
URL.
GET, ,
.

GET ,

URL

POST, ,

ro , $_GET $_POST.

.
ro

yll ry

8 ..m

_ ....._._ . . _.._. ~ ~.""~.~.".~.". ~,':1I1

, .
CBo~pe~~~:. .

,;~:.- -.\~

~~ ._.---;

: ~---...,
\ lII<RR: ~aiJJ ~, """"" .'

'1

u ., 200804.2309:13:34 368420 --; ..~-;~


20080423 09:06:35 345900 ~

2
8Jl

0080423 09: 12:53 282470 ,1


i 2008042408 :13:52 186580 ~!l'
! . 2008 0422 14:37:34 127650
." 2008042221 :27:54 98430 ~
_ .
2008-04-23 14:09:50 64930 ~

. 11lro
...._ ..... _ ..... -

i . . _. . ._ . . . _. . _ . . _ . . _ . . _ . . '8
l1 dd
dbtx g VR\..
~Ul,"!\."!\
.3 !'\

GYT: g "!\

d dru-t.bLe
Pd.5l)O'/f\ .

~~~~~:$~aJb~
~G.

313

GET POST

' 05

GET POST

URL.

. GET

muna

es-an.

Cl.T

, . U ros. ynm
, POST
, Cn
~,~ .
g1U gy

POST

cueapus.u

GET

r; -

, .
GET POST



.
,
- act~on.
POST


GET .

~;ZHb GET,
,
URL. POST

, GET
, .

_<'

.,

lfG iJt1G1h.

"

Z11'\1blX /10'\1/1

'9: -,

GET.

: GET, POST ,

- . GET

,

. , ,

-. -

method ,

, , ,

SQL-

action

POST ,

, :

SQL-

<form method= "post " act i on=" addscore. php">

DELETE.

I NSERT

SQL- .

POST ,
GET, URL,
POST,
GET

addscor e. php,
$_ POST.
<f orm>,
,

$_GET:

<form method=" get " act i on=" addscore .php">

'9: ! , ,
,

GET S?

: . , .

GET

314

l5

'9:

URL?

GET

: URL,

GET, , POST
GET

. ,

, ,

- ,
SQL-

INSERT ,

DELETE ,

- ,

URL.

60 , 8

GET

GET:

, , ,
, - ,
. ?

. :
, ,
-.

, ,

,
.
, .

, ,


, ,
,

,
l

URL.

, .

, ,

. . -

, ,

?
COMHe~c.

? ,


, .

. , ,
, ,

, ,
.

, ,
.

.
...

l ~

315

removescore.php

POST

, !>
aJI!> !>,

!>. ,
aJJ\ URL. , ,

GET

aJl . ,
... . !>

, " ?

1\ 1\. 'hr\o~bt
.

~~~J3Q1\

.. : ... ... cr.1t J.0'[1I"I'C yn&ll1Ifi :tO peJl11lRr

... : Dl1 .....

: 2008-04-23 09:13:34
l'elll8r: 368420

U1\t. u.J ~b!.


3 ct .btx, 1\QlUp.
JctliPOCct t)31\.u51.
.9 ct .1\ t)/Jt,J\1\}

'J .1\

li1\u.1\ 1\ctl{

~)

:Q.u..

' , ,
, !> .

!> !> .
!> .

GET POST, !>


GET, .

POST, . ,

(removescore . php) POST

. .

II .. ll w rII VIl"

cs
.OC1t1h

. VIl" l',

Oll G ll. r. U g8)


VIl" l' lllt ll.
r, rllll .. . $_ G,
" .. .
.Van.. l' . ..",

POST,

lllt.ll, w Vann.

VIl .. r ll. r .

Toro,

-. ll.. TalOe II .,

.lOr r.

316

z5

.egycs

.om

89 ogO.y

cueau
ornem
:

u POS.

aaHHblMU, 8
,


...

.
~~e CIl8COl: PeitnIIIr08 Dp8JIOII8I pwt .....11

__ ._~~'.:~~..~~ ~ o.u""; ean&ID pcIIro8.


AarrOII ...... 2008-04-23 09:13:34 368420 y~. _
. . _ . . ia.--"'~

........

2008-04-23 09:06:35
2008-04-2309:12:53
. . . lpcoll
2008-04-2408:13:52
... - 2008-04-22 14:37:34
.... 80U8CO. 2008-04-22 21 :27:54
...
2008-04-23 14:09:50
lie. .

345900 ~
282470 ~
186580 ~
127650 ~
98430
64930 ~

~ ...
$_

POS

$_GET

1) .
~ __ yjUIJI...... 3'nJI' p"Irn<Kr1

a~e t-U<u. scree!'\sI!o"t

1hIy.cpc8.., ....... ~

. 'Vr\. peu'Vr\uza
o'Vr\C ymc'Vr\~)(t!\.
0.u.. u. 'Vr\0'Vr\ .
cu,el-ld.pu.u d..u.'Vr\

)aI\P OC
~ I\ .3~e'Vr\ -. .
ytl\~CKd. u,u.
:.: d.u.'Vr\ peu'Vr\u.z
(OI\5I.'Vr\b!) u. ":d.u.

,. /

<

.~ peu'Vr\u.z e ,

removescore.php

KO'Vr\Pbt.i1

I\O-'.3.<>

.3d.u.cu.oc'Vr\u.
o'Vr\ 'Vr\0oo, I\u.
. .3d.I1p'0 c
u.u. POS.

..u.
jd.u.'Vr\.

----~

368420 urro CHNJlCOHa " .

< :$ I:~~!~.mro.)t

removescore.php

317

GET POST

.&!rJ..G')1t,

64t'l1bJX ffi o'l1focoffi


~; GE,

POSr?

; , .
.

URL. URL,

GET.
-,

GET

action <form>

. ,

, .

URL

( , ),
GET.

POST,
$_POST.

~; , ,
, ?

; ! ,
URL GET, ,

, - .
,

$_GET,

POST, , .

$_ POST

SQL-

DELETE FROM,

.
,
,

-.

318


,
,

.
, .
, SQL- DELETE FROM
. , .
WERE
DELETE FROM. , ,
:

DBLTB FR guitarwars WR

~ Pe.JYJJb"lr)d"lr)e. btt).U51.
""Ii\ Jdt)POCd d."lr)
.9d.4 Jdt)Ltcb, "lr)o
I(J(d }d"lr). oee"lr)

J4.u.. ALIl'II1oK Cot)COK:O.

' .'

)Qbt. DELETE

f\..

~----------_ _ FROM .90. .90dYf\

u.st Yf\du.u,bt, \bt. bt.


Je.CYf\KO, u.J Yf\Lt.

guitarwars

. .9dYf\ .9a..bt.e..

t)J"lr).
} ..."lr) l{ dJaU5l.,
I{l{ ."lr).

dbt.Yf\b .9d...bt..

. ,

t).JQ.u.. 4 .u.

Yf\Lt.d .9 0 }..u.

, ,

1{

, :
DBLBTB FR guitarwars WR

e..u. Y"IrI...Yf\

ll... "lr).
.9d .u...

' ' AND

. ollepdYf\op AND
2

2008042221 :27:54

98430

2008042309:06:35

""

345900

2008042309: 12:53

282470

20080423 09: 13:34

36842()

20080423 14:09:50

Jl

o4YJO

2008042408:13:52

186580

Il,.9 "lr), \ Jdllucb dY.g e"lr)


O"Ir)d"lr) "lr)d.u..

bt..u.. JdllpOCd "lr)oZ.9a, I(.9.1

Ik'
phizs.score.gif

., .U"Ir). cooYf\e"lr)c"Ir)Y)Q"Ir)

dbt . .u..,

e.lleeb, l(.d u. u.st, u. Yf\. .9 0 ..bt.

cooYf\eYf\cYf\~odYf\b d..btJv\ J4.u...


.Yf\Yf\ .. .9d.u..
.9. JallUcu. Yf\.. u.a.
8 ~

319

LIMIT DELETE

x

LIMIT

score

... .


. ' ,
.
llO

():

LIMI T

DELETE FROM guitarwars WERE = ' ' AND score = '368420'


,

LIMIT

( ) . ,
. , ~

. , ,
.

guitarwars
..

.x/'id

-....

"' . ~,'

+'

),

">;

'

<:;:;'

M'~

name

5Core

2008-04-22 14:37:34

127650

2008-04-2221 :27:54

98430

2008-04-23 09:06:35

345900

2008-04-23 09:12:53

282470

2008-04-2309:13:34

368420

Lvvo-v.. - L.J ''':V''' :JV

r<..

C>4Y.JU

2008-04-2408:13:52

186580

rs2 3

2008-11 -04 1 : : :l I

$CI'8nshot J

Q "y!)UZQ
u

U 3 <.J Uu

"!)l ZQ )OYl)5,
id

phizsscore.gif

..

I-\ L

-Q.

Jc>84:lU

bt.l

lAe.o,..'\u

shtss . jg

DELETE.

3 Qi POCQ

, ,

DELETE.

, ?

320

, 8

~UJe u U1:;&am u.muuaml'

t'wmuf && &I'aet1uu WH~~ 3f11'03


'P~~ fOM~ m or &oOl'emeuu
y&ef'eH<Xmu &, m u. Uet1HO rwmur,

mol' u u, ma u~

, lO .
nw n.. r n.
n

-
. id gui tarwars
,

.
WERE SQL- DELETE FROM -
, , .
SQL-,

DELETE FROM

id :

guitarwars

WERE

QJ1.u. ~bI.x,

dJtA::I).

id

d llptA.

, ,

I(),1l 0J.'Vr\
ll obLctA'Vr\b 'Vr\.'Vr\
ll.u ,3QlltACtA,
11 J::\,3d .

.

?

LIMIT.

::IQJ1.u.

: SQL-,
,
.

DLETE

FROM

guitarwars

WERE

id

= 5

..

...

SQL-,

~r..f \,l/1\
111'\~du.~11'\
~ .. u. 11'\0,
m rJ11'\~11'\

bt.t).fSI. .3~l')rOCd
. .11'\ dbL11'\b QJ1.
. .3~I')u.cu..

LIMIT

DELETE.
.

321

u reovescore.php

u MySOL

rernovescore php

. ' MarH~T~1 ::~:~:~~ :~

,.

<htrnl xrnlns="http : //www.w3 .0rg /1999/xhtrnl " xrnl:lang="ru' lang="ru'>


<head>
http-quiv="tt-"

<rneta

<titl>

content="text/htrnl; charset=utf-S" 1>

</titl>

<link rel="stylesheet" type="text/css" href="style.css" 1>


</head>
<body>
<h2>

</h2>

<?php
. .... . ....... . . .. . . ........ ~ 'appvars.php');

... . .. ... ....... ... .. ...... ! ' connectvars.php');


if (isset($_GET[ ' id']) && isset($_GET['date']) && isset($_GET['narne']) &&
isset ($_GET [ , score' ]) && isset ($_GET
II
$id = $_GET['id'];

................. J ))

$_ GET

$date = $_GET['date ' ];


$narne = $_GET['narne'];
$score = $_GET['score'];
..................... = $_GET[.................... ];
else if (isset($_POST['id']) && isset($_POST['narne']) && isset($_POST['score']))
II

$_

.................. . = $_POSTl ............... .J;


$arn = $_['arn'];
$score = $_POST['score'];
else {
'< lss="rrr">,

echo

i f (isset
if

($_

($_[

[ , subrni t ' ] ))

'confirrn'] == ................ )

II

II

@unlink(GW_UPLOADPATH . $screenshot);
II

$dbc = rnysqli_connect(DB_HOST, DB_USER, DB_PASSWORD,

322

zs5

DB_NAE);

</p> , ;

, 8

//

$query = ' . ........ . . . . .... .. . ..... 9ui tarwars


mysqli_query ($dbc , $query);

wERE

.. .... .... . . ........ LIMIT .. .. . . .. ' ;

mysqli_close($dbc);
//

'<>
$am

'

' . $score

.</>';

else

'<

class='error'>

.</>';

else i f (isset (. ...... .) && isset (. ... . ... ... .) && isset (. ......... J &&
isset($score) && isset($sreenshot)) {

'<> ,

' <><strg> :

'<br

?</>,

</strong> , .

/><strg>:

'<br

/><strg>:

</strong> , . $score .

</strong>,

'<form method='post' action=' removescore.php'>, ;

'<input type='radio' name='confirm'

'<input type='radio' name='confirm' value='HeT' checked='checked' />

'<input type='submit'

'<input type='hidden' name='id' value=' , . $id .

'<input type='hidden' name= .............value="


. .............. . . . .
/>';
'<input type='hidden' name='score' value="
. $score . , . />';

'</form>';

'<><

vlu=''

vlu=''

href= ... . .. . . .. . .. ... .... .. ;>&lt;&lt;

/>

. $date .

'</>';

';

<br />';

name='submit ' />';

"

/> ' ;

</></>';

?>
</body>
</html>

323

Q removescore.php

MySOL

removescore

. ~ MaH~~:1 ;:~:~:;~ :~
~ .
.

<html

xmls="htt://www.w . rg/1999/html"

<head>
<meta

http-quiv="tt-"

<titl>

xml:lang="ru" lang="ru">

content="text/html; charset=utf-8" />

</titl>

<link rel="stylesheet" type="text/css" href="style.css" />

}.u. ~U

</head>
<body>
<h2>

</h2>

cu,ef-td.pu.e du.u.
3d...bi.u.. 11 . -)1)

u.t).)1)5t bLd..u.

<? h

re9u.ire_ot)ce.

....

require_once

~1I"",,"

~,connectvars.PhP');

i f (isset ($_ GET [ , id' ]) && isset ($_GET [ 'daf't.:.


e_'...........::.:::....;::.::;,:;=..:..:::.

isset ($_ GET [ , score ' ]) && isset ($_GET [ screenshot


/ /
. .
$date = $_GET [ ' date' ] ;

$ = $_GET [ '' ] ;

_ _!I!!8I'J/If!I!!!II
l

' $_GET'

cu,ef-td.pu.u. bLt)}O)Yj5t pd.J.bte cpp'd.~MeK)1)bL


3!. .3d.u.cu.oc)1)u. 0)1) )1)0~0. pe.3>~Jib)1)d.)1)e

$id = $_GET [ 'id'] ;

'score']
$_ GET <..

Kd.KO~O .3d.t'1POCd. (GI u.u. S) . dbI. btJd.o

screenshot

if (isset($_POST['id']) && isset($_POST['name']) && isset($_POST[ ' score']

// 1J
.. t:.~. ~
.
: $_POST
.... $id
. . .. = $_ POSTl ... ~ . .J;
PHP-LA\')LAd. @, 110.9d.5{}\5{
$ . ''" _POST [ ' ' ] ;
u.. 7n)0 .eoxo.9u.o 11 LA 'b!.J

bL0
d
g ~ .LA5t
110'Y)OMy \')0 #!. ~o. .LI,LAu. UI1~il1k(),
.Yr1g~},. .....
~i1o. 12j) ___~OMee
.9L~ .9d.LA5t
't"-<
"1
".\ #ht .

$score = $_POST [ ' score' ] ;


else (
echo

xo'Y)!JJv\, \')0 bt 110Jd.') u..9 .7'\')0 .u.


'< lss="rrr" >

i f (is et ($_POST [ , submi t ' ] ) ~

$_POST [ 'confirm'] ==" . '

if

..

.} (

.</>';

Cu,ef-td.pu.u )1) dbL11)b


u.t)30~. 5t 3d. .u.5t
}~~ peu.)1)~d., t)-11)

. . J 1.U UJ\.u.5t, e~o

@unlink(GW_UPLOADPATH.$screenshot);

t).9)1):9d./~, . !;

11)\ ~d.u

'"

u. :w..30
~ "1

o"l\

1\d.id.

\_"I\ . r,pou,eccC\ \!Qd..u.5t

/ /
peU11)u.~d..,}J
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAE};

324

z5

J,

jld:JIMIT

mysqli_close($dbc) ;

//

echo

'<>
$

. '

'

. $score . '

.</>';

else
echo

'<

class=~error">

. </>,

else

&&

echo

' <> ,

echo

'<><strg>:

' <br

?</>';

</strong> , .

/><strg> :

</strong> ,

' <br

/><strg>:

$score.

</s trong> , . $date .

' </> ';

echo ' <form method="post"


echo '<input type="radio"

nae="confirm"

echo ' <input type="radio"

nae="confirm"

/>

<br /> ';

echo ' <input type="submit"


echo ' <input type= "hidden"

= "r-""'--.><.a""t:~

echo ' <input type="hidden"

echo ' <input type="hidden"

nae= .",.lIrl

/> '

echo '</form>';

echo

' <><

?>

1:'

href=. < "admin php" :- >&


' . Ii ; 17

; &lt;

pej~T>OO'OB

< / >< /> ' ;

</body>
</html>

ru.t1bt.l(d \ C'Y!)pqul.ftj

. .Yq'!)

Jpqu

1(

removescore.php

..---- CIO)bi..'mb1:.x
rtu

. rt.u. .bt.x
('1

, id '

d.'!)

POS.

\ . u..'!)
d...u.'Y!)o '!)d
..u.rtJd~

Jdrtpoca

C'Y!)Pd.u.up Jdllpoca

Il.9.'!):9.u..

~0.9u.'!). '!)
'!) d, .u.
ce 'YI)u. rtepeebte
u.e.)O'YI) .I11\bt.
,3\tst.

325

- n J>

--
r)) )) lO

r )), ll II r.
:

removescore. php admin. php,

, .

admin . php

<i>.'> , ,

<i >.'>.
, , ,
. .
<i[ >.'>

(index. php)

, .

d. ~u,a

::::.:.... . ---,
. .- . .----.

v:--

~::::

...

__ "-<=-_

=-":"..::.. . ''iIIII""_~---~;' ''' :~i~:'r.

:-:"3::....::..::-..:-:.:-=

\,.--

~d.

Kd.K

' d...u..

Hd. z..u. c"Y\j'd...u.u,e

t)~d.~

.l"\~~ ::..btx
u.~~..

~ . l"\~

t)~..~ u.~d.p.bte

Ou..bt "y\et1epb ~~ "\


lI~.:9:.bt

....---

~-

ct..bt z.u"Y\o.p.bte
ropw. _ ..... .. """"".
OlA.bt 1:it: o.u~=-~~"='!~~~""'..::r-

g~.~ 't\el1epb 't\


peu'l!~

i\~:9..bI.e
~o "\ ~e, 'Lfy.nr")I~I.J(

o~cJ'Ic~Y)<JYr\ ctu.bt

~.306....u.u., i\"\.:9d.)UX
~"\. Ci~u..z.u, "Y\et)ep'b d..bt
~J ~.bt.

z5

t10~:9..u.

~~oz.o.

"y\~..~.

t"i O~'I!ee ...bte

326

t"\~d.'!\

J..~

u.~u...d., ~d.K

C~Pd...u.u,a.

d..~

u'!\~..()

1I1111111111~....,....z.

~~d.~~4
z.~t)bt~

d.~~

aaHHblMU, 8

POCC50pg

u MySQL

? , -

, ?

rop"SOHTan ..

1.
type <input>,
.

4. 6-

_ _ _ __

$---7.
SQL-,

8.

SQL-,

.

10.

12.
_ _ _ __

.

"n ..

2.

SQL-

3.

S.

SQL-,

.

7.

SQL-

9.
,

______

11.

327

60

328

u MySQL.

MySQL


r,

HeMHoro HOBoro

MySQL: ,
r

329

6 ~~u,11t,~ ~~\Ue6o l1fu,l\oJJelfu,j{

.,,,,,,

.,,0 "

Cl",n"tn'WII

*-

"" ena60erllM"

DbIcmpebKO l?;,
Ha~epx, nlOu

-+

etp npo~o()o~, u
3u ()l.U

nepecmaHem nOHUMamb,
npoucxo()um.

:
. , , . , ,
, , ,
. , ,

. , -,
, - . ,
,
! , , ,

, , .

, v

MVJblKa

, , -
, ,

~ ., , -

. -
, ~
. .

. .

~;~:~~~~=~::;::';=~.
--_...... ...... ....._....._ .. ~~!:~;~;':~~ ~~ B.~~o.~.

__

3mo r1wu!

~G\~u. ci'\ea.u.u,e
.ei'\ peui'\u.~oK
l"\oi'\oMY '-hI\ .. bV1u.

.9G\bt UJ G\3bt.

.9 ..\.!

mrY()Ufl ()fl .

m cmamb wu
rumarHbIM 10, eU MOU
reUmuHf uf3.

332

nR

:)qIiPOC SELfC

Mbi , ,
, ? SELECT

l')ol(d.3bt~e"t\, Yr\

"t\~Uu,a ~uit~r'W~rs

\"VI::Ic;v\J,J."-V'-V l')yc"t\~: ce

Wi~iW~;;~~;;;;;;;;::::::::=======-----------------~~~

uJ

- ,
113

guitarwars

. ,

- ,

? !

, ,

,

, .
s r


r:

SHaeT

(!) r .

(!), r.

lP- ,'

lOr

r)),

TaKoro

r.

M (l).

~'U' 38a8'lU ,.,"., . ".,,", ., , .,.

,
, .

~ce ctu.ct.lI'\bt. lI'\ctK u.u.

:
,

(Bbll),

~ peUJ.d.)OVr\ t).
lI'\ 0.9u
U,3.t)bt..

.~~1'I~ .1).C:\f.9.~~ .~)!'\~~ . . . ... ... ... . . . .

~11~.~m~.~I:~. r~~1I)~9~~ . :-:: .......

r~"'J

.~.<? ~?f.~~~ r~~~~, .I)~~~~ ....... ....... . .


.~C? .9~ .~..~fll;9.~. ~~.<?~.I!o. .~mr~

....

jQ~ll'\ cctUll'\.

(BaMI)

.~? ~!.'!l:~.~~ .r.~~~.~~,. ~. ~~.~ ................


r~~~r~~.~:v.r!"!!I~"!!I~~~~~ .. ..

IP- ,

!\~~p.~~ .~..~9.~~.~~~9: ....... ... .. .


.~R.9~P.~~.': . ~r~1'I~p.~. <?.~~ ... .. .

.~r~~~~~~~ .~~~~. ~~i;i.~~!.....................

(!)

.l'r~~r.~~. ~~~p~~. ~~~~. ~~.~.~~~r.<:\..9ctell'\


.r~3::i~~~"!'): .~..9~~~~ .~f.~~~~~ ........
.~~!l:~~.~ .~~~.~. ~r.~~. ~ .?t:t: .~~~~
. UJ.ull'\. ( lI'\OM u. 1)0

'~'~~~~ .~. ;;'~~~~6" ';m .~~ ~~~).

.!l.-~~~.~Q.. ~~~~.~m~.~~:Y!'Ib
r~9:~~1!o. .p~~~~..<?!~J !1p.<?~-!!~~, ....... ... .

..~,..~~~ .~~.~.C?~m~:.~.9~~~~ .~~~~cll'\b

~m~. f.~~"!!I~~ .~. ~p.~.9~~~.~..~~~~! 'hrIobt


:1!I.Y~~.~. :YJ\~~~~~~ .t:I.<?.99~r~:1. ~.~:YJ\ct.

34

nnR

3 w 6 3J10YMbIWJleHHnOB
.
. -

. .

, Cn :UJUtnb1 ctnpau'1

, , , ,

UCnA05aUe .

-,
,

.
. . .

el)epb

t))1J<:I1\

u.

1\<:lJ.A.u,

.9~"II').Pu.{u
u1\UZff.o

)(.9 U1\ I<

httr-<:Iynl.1\U

u.I<<:Iu,uu.

k:-----/

1\. 1<<:11< 1\iUU,CI

.9~J.A."II').Pu..u).
u1\u...ff.o 1\cI.J1C\

3<:1~~,JCI~~~
'Yl)\u. 1\dl(

~e .9<:1!.

2Q08.Q5-0120:36:07

_-

200a-0.s-0120:36,AS

-6'-

3897..0

2008.Q5-0120:37:02

-"""-

2008-05-0120:37;23

....'0
.27_

17

"

2Q08.D5-0120:37:AO

10

2O()6.O.S.0120:38:23

gu1tarwar8

..
;1

1s

.....

20()8..0.S-0120:381

.....

-. . n-_
-"""""'"
-.-

282"70

u.

1\u...u.

-~

-~
"""-"'l
--.~
_

. ~

.86500

....30

........-.~

2..3360

~.~

335

unonltu HTTP-mmUUQUU

3  q
Jll (e )
- .
, -,
. ., ,
.

p<tJJ

~d J1.CVJb~. t)et:\.

Ut):)j "Yr1

"Yr1dl{oe I{
Jdt)poCd eu

<:~u"Yr1 u. t)JJbJd"Yr1 .,
W.. . .9Ud.d

dy-."Yr1 UudLl,Ltu.

t)Joct"Yr1.

u I1d, I1pe~e
I1"Yr1dU"Yr1
.....:
Jdu..i1
n.c-.: [ .
C"Yr1p<tuu,e.
~ -wn.,,;...,....~noponoilj8~

"Yr1!1

. !1u..
t)dPOJb l1~"Yr1.

(- ) ~

.jdUd..

u .

md !1.&vbd9.
l1epeMetUWt C0.g ep')fW.l!\
I1dP0 .rb, .bLi1
.9UdOtd dy-l!\u.cpu.dLyJ.U

,
, .

$_SERVER,
, ($_POST,

$_FILES . .). -
, ,


,
. , . .
.. . . ,

. .

336

l{G 8bJ~itGTh.

Z1t11blX ffio11roco~

'9; -?

; , . ,

. 1%- . ,
,

, .

, .
, ,
,

, .

'9; 30, /
?

; .
, .

,
, , .

, ,
.

'9; - ,
? , ?

; , .
,

;: _SERVER [ , _AUTH_PW' ] . , ,

...

'9;

-? -?

; , . -
- -.
- .
-

,
- -.

- .

HTTP-Zn8

HTTP- 6 HTTP-n8
, -,

, ,

.
-,

bes-cmUUbl
nepegamcs

1 1P-6.

6-

~'Yl1l-d
-J..

Od~clJye'Yl1 J..~C

&

- 'Yl1.u

w
,

-rn,


. . . ....
HnP-ron,

~ ~-=-_

"-_ _",, ( cn
nr

nn

cn wR .

Tpe6yeMoro
n R
.

&
-rn
,

KOTOPYIO

338

l6

ero n)

nnR

amI HITP-6
- ,

-.
- ~/~,

, , - (.

-, .
-, ,
, .

u.1'l\ -Jct.
UJ I)ctp
"USI./J.ct.u.~, , J.ct.u.

p1
HT'rP-J<tI(
, '1:'ll'1d'll'1

coc1'I\O.5{1'I\

"ll'\.9.5{1'l\.5{ 0"rrI ~'


oe1'l\o ueIII.

GET / index. h

7mO"rrlHTTP-Jd.
t).5{:m Od.~,

User-Agent: Mozilla / 5.0 ...


Accept-Charset: 180-1 ...
Cache-Control:
Accept - Language: de, ; q=O. 7 ..

u.il

jd.I"\POC .

~y /jt:l.u..
j<.\'1poc
C'll'1pd.u.LI,bt .
JffjO

~P/1.1

200

0;->

~
Th
01 ~y 2008 11:22:09 GMT
Date:
,
Server: / 2 . 0.54 ...
x-powered-y: / 5 . 2 . 5
psfer

Epcoi ng' J;)d

~tent-ype :

text / htffi!

.7mO"ll1 HTTP-ct.OI( zoopU"'ll'\

ct. Yr\ <:t.u.


l).l. u.. L-. ct ,
lO"rrlu.I)..."'ll'\,
ct..e, I)POC"'II'\oy

"'II'\eKc1'l\Y,

-ro ~ ~
,

,
, . ,
- , -.

-z

-J: JJl
:

?
oppecnoe ead

Rrst:

-ro: .

) ,

, , II

- .

bI?

peaIC ead

Rrst: .

bl ,

-rooo: , , .

. ,

-bl.
, ) bl :

-ro: . ,

bl ,
.

11 ) ,

, .

1lbl .

ead

, , .

First:

ead

First:

bl

-ro: bI , ,

- - bl
bl

-ro: Bo- bl ,

type).

(Content

, , ,

ead

First: !

r bl, . .

-ro: , ,

ead

, bI

Rrst:

,
. bI

fP.CJroI1OIIOIC: II ,

, .

bl,
L-, PDF-bl GIF ,

ead

J PEG ...

First:

-ro: -

URL
bl -,
GET .
,

. ,
bl ,

, bl , . .
ead

First:

ead First: ,
, blbl
-. ?
-ro: ,
, ,

blbl , :

, bl ,
.

.

, .

ead

-ro: . ) ,

)
?

First:

-rooo: .

- , bl

bI , , ,

ead
, .

Rrst: ,

ead

Rrst: !

-ro: J'.1. bI.

340

nnR

60 H1TP-J8

, ,
, , ,

-.

header ( )

~lO -
.

~l.JU9

headerO

nmAgeI11

[lIlIIIi<'content-: text/html');
header () -

" ,
. .

cmga58.tnb

U otnnpaIWJmb
HI 1P-aro5U
113 ~

" -,
.
L- -:

text/ht.ml } ;

<html xmlns=''http://www . w3 . 0rg!l999(,xhtml'' xml:lang="en" lang="en" >

</html>

"' mu r3f&r !10 !10&


111-3f&& uHmerecHbl,

U!103Q&m

ux 3LJ.\um mru !10LJ.\


mmuuu:f

l ~

341

-u u

0 - -
~ ~,

-,
u - (

), ,


. - -

/l.l 401 unauthorized


WWW_Authenticate:
_

Basic rlm=

"

OCJYl1' ',,", c:rpao, ... "''''

:"ci:.;.:=;;:r .lI3p>te _.

~:,===::",H 8sop

-_...

.,---

~-------~

( . ...

[ ] I10

::

na &IIe ",,"

,g gab1i\.
eosx.OgUMblX. gg

ymemuuauuu
mpesymcs ga
cneuua.

,
-, :

. ~ 7t)01l1 HTTP-,}::I..I(
.9de1l1 dpaYJepy t)1l1, '-hjo
.----------:-:--.
.9 d .rtoMy t)Jd1l1 )
/1.1 401 unauthorized
~ t).901l1d.5I.1l1.51. .9 0C1l1Yt)

1 1-aro.
~11-3d.I<

IiGU.11 f.d
r)llbt1l1d1l1 .

dj'lY\ eI-l1l1u.cpu.u,u.cl.1I1
\icl.11..

\i.u . 11u.
u... u. tld.

342

z6

1< JdLWJ,.rt 1l1 u,.


WWW-Authenticate: Basic

rlm="lDl !DI"

cl.3d ~sic red)1I1 3u..l-l!-ld.51.

cl.1l1) ce.o u. u1l1


u..g e I-l1l1 u.u. 0.111 .7111 u. 1{ OfU( pe1l1 !-lO u.
~I-l1l1u.cpu.l<du,u.u. u. t).5I.1l1.

~ l{. .9u..1. 1.j'IY\.1I1u.cpu.I<1.u,u.u..

20 nnR

-
, '

.
...

R. .
....-.. CIIIICOI: PatrIaU1I8 . . . . . - IrraPU.e ........

~~~,~~~~~~~~:

~,


~
,

,
.

~, ,

.
,


/ . ,

.. .pJ 6111'" OI88118 . . -


........\.- 8,II8.
..
..

....'

.u 1:
. l1<:tlb1: u..
110J<:t'Yl!

...:

, , ,

=:'====:~-

ILLI
;:;;;

.~

anoII,,"' napom.' ~ J1>OJ18I1tta ..

@"?) E~' j

u. l1<:tpOJJb,
. Ud.<:t

<:tyYI\.'YI!u..<:tJ.u.

~e1j bt D

. ,

--............
11
'--../.

~ :~illi:iW;;~~ii._.&iifiiiiiii;.,
" 31lJt. llU . JIwe " OJlaaeJ1l
1 .. wr J: m.

.. ,

,
. .

.

-

admin . php,

-.

1 IDLl...u. 1jd.. u.ee"ll\ .."ll\~


u..5!.
it('<h2>

</ h2 > ,

1\wu.'YI! ~bu10..u.. cu,eMp


U. btec"ll\u. "ll\t-tD l-W..

' .
' ,

t'\u.u.~ "ll\...u..5t

.');

3<:tllpoc<:t

.90C1Y\:/Ile.

c1Y\p<:t.u.u,e, .u. t)30<:I"II\. Il<:l'Yl!LI.


.1"'."II\u.~I(<:tu,,

343

, HTTP-.

, -

: .
<?php
11
....... ..... ......... .. = ' rock' ;
.................... .. . ='roll

';

if ( ! issetC .................................. .... ) 11


! isset( ....................................... ............ . ) 11
( $_ SERVER [ , _AUTH_ USER ' ] ! = .................... J 1 1
($_ SERVER [ , _ AUTH_ PW'] ! = ................................. ) )

//

/ ? - ,

I/

................... (' /1

. 1

.
,
401 Unauthorl.zed ) ;

( ' WWW-Authenticate : Basic realrn=........ ....... ... ...........' ) ,.


' ,).
_
( , <h2> h2> ,
,
.. ... ... ... .... ......' , .
?>
<htrnlxrnlns=''http : //www . w3 . org / 1999/xhtrnl" xrnl : lang=" ru" lang= "ru " >
</htrnl>

'-

.~.r..

admin-Pt1>

" "

$password
password

44

z6

nnR

-rIl II

II AII .

-aro,
.

n
header ( )
pu 1l 0uu /~, , , :

.711')02.0

JQ.Q

dPQy~ep

header ( ..' LQ
......"_
-...!;:.....Q...n_'.............._ _ _,..___......._ _...................

t) u 11')
ct 11')

pal1.uu,y

Qbout,p':p
( CQti11')e),

?>

ro -aro ltio header (-aro


)

about, php ~.

-aro,

Q~
t) u 11')

ct C"'i\

header ( . Refresh: 5,url....ht~,j(www.9uit.r'$ . !'!f)il~.\:; );

PQl-W.u,y

Qbout.~p

echo

. php 5 :

'

';

?>

refresh header (-

), .
, -

, .

-rIl

II

content type

header (- ),

, .

PHP-ll.

,
-

<?Ph P

echo


-
header(),

00

'

~Og:J::;C~~~h~~~~~ry3epy

header ( 'tQntent.-~!>.t)(tlli1.in~ ) ;

,
-

HTML,
header ( ) :

'

<strong>TeKCT</strong>

'

';

?>

, , ,
L-. ,
L-, ,

L-, , .

345

, -.

, -

: .

ll .cU1 ll Q $_SERVIR
Il"}CI"}"}I) 1< e.u 1l0.!lb.CI)t.. u .

.--_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ IlCl ,

.ht. /(. .UC\.CI ~.)tPUI<Qu,u.u.


- - - . . ' rock ' ;

= 'roll';

~
1l 0JQ'YI']
u. . . . IlQPO.!lb
~. coxpClfie.bt,
l)epeMe..bt.x

.u. e.u
u Il Q ., . bt
1l 0$JQ)t,
CI.uQ'm.

C<toM cU1 , u..

.,

PHP_AUH_USER~.

) 11

J~Q.h!.u
3 lJ..u..

'Yl1d.'YI1

.7'Y111J.X

:i"JX bt3oo

hl:i1r() qd. tl-J1Z-0d. t'\el.~dbte

UJ'II,..... ""..-. .

q:>~J(u,u.u. ~ d'Yl1 1.-'YI1 0 , ~Y'Yl1

'Yl1t1bl. ~r,

//

/ -,

//

,
header . ( '/1.1 401 UnauthorlZed );

..

t'Guitarwa~8nt);

. rea1m-.uj
( 'WWW-Authenticate: l
JJ31 . . . .
( , <2 >

2> ,

.,
''''.~:..:.''
''' , .

,).
,

?>

<htm1 xmlns=''http://www.w3 .org/199

" xml: lang="ru" lang="ru">

</html>

J<u,u.st ii bt.u.")

.u. "}..u.
J<:IllpoCCI

"}l<bt"}

C'Yl']P-Cl.uu,bt ~ I).~fCIQ)t

W: }u. .9.u

wtctu, ~ Cl,
Q,}'"YI1efi'YI']u.cpu.KQu,u.st

u.

.Q.u."}. .Q..

346

'!'/1.1 401 Unauthorized

WWW-Ut~"tit:
Basic

., \

rlnt='e - . ~

..

..

nnR

--
-lO
r.

admin . php ,

. -
. / ,

ru.1\drLbt.e. o.bt 1\ll

, .

.:.l-tbt 1\, Yr\


JlUJ",,,,"r,,",,'"

JI"\GI.I-lO

JdLU,u.LU,..

JiG 8bJ~itG1h.

Z111tblX ~01tfOCO~
~; exit()
/ ,
.

; exi t () -

~; II -

, ,

-?

header ( ) ,

:
~.~ader

()

m -

basic realm ( ll)

; . ,
.

. ,

-o:.:i t (), ,

, .

- ,

. ,

exi t ( )

basic realm

~ ,

<

if

false,

3 , .

true ,

basic realm

347

u! , u

cmpaHUY YVu peumuHroB))

3u cBoero ", 3,
- nounpaBuB ,

0fj?OMHbIU

Uk

. .
DODJIONn, wll l JICIar
llpO.ii .. ?
r peJlDpo

. CII , IIpOcro .ou~ l pelr CDCOI<.

! Il:

tAJ

Il.

u"tI1C\p.bte obt::o
removescore.
php?id= 10&name=Jacob%20
Scorcherson&
date=2008-05-0 1%20
20:3:45&s=389740&

uJU peu"Yl\u.zu..

.., f.~:~u~
:::: -"~!!!!~~~~~!!~~~~~~~~Ii
IlPOC"YI\O, . 1l0)

UR.\..

C"YI\Pdl.l.u,b1. re"Yl\ovescore,f*'r
. odOU"YI\U .3u"YI\

C'II\Pd.uu,bt ad"Yl\ill.i*'p.

, , n_
<e ) J?
10, J u ,

I\Ol(jLllO.~uU.
4 4.U

1U1T\dp.bt.e

o.bt, 4. ct)ocod
U:U .3dU'II\j
4.. I).:...

.
, ,
,

. ,
<! . ,

<! ~

...

, , ,

:

348

QQ Q nnR

: . , -
. .

: . , ,

, - ,

. ., , ?
: , . ,
. ,

, ?
?

. ,

. - ,
.
: ! ,

$username $password

(include)
, ?

appvars . php.

: ,

roc . ,
.

//

$username = 'rock ' ;


$password = 'roll' ;
i f (!isset($_SERVER[ 'PHP_AUTH_USER' ]) 11
! isset ($_SERVER[' PHP_AUTH_PW']) 11
($_SERVER [ , _AUTH_ USER '] ! = $rnarn) 1 1
($_SERVER [ , _AUTH_PW'] ! = $password)) (
/ / / -
//

header( 'HTTP/l.1401 Unauthorized');


heade: ('WWW-Authenticate: Basic rlm=" "');
eX~,t ( <h2> h2> , ' .
, . ' ) ;
?>

<html

: . , , -

Hero ,

$username $password.

: , ,
-.

: l ,

ero ,

-ro .

349

authorize.php

[ )
,

Mbt lAg 1\1\

lA3 c.u,eM?u5\. d.d1\ i ll.f*' . ~


hP ) T 1\ , , "hY\odbt \')1\u.~ e,i'-"
a~ln .php ~~ (authorl z e ' P
reqUlre_once.
, 1\g.~ ~.

. ~ :, ~ , ~

cu,eMpu5\. d.u."i:horizef*'f
1/

$username
$password
if

' rock' i
'roll';

(!isset($_SERVER['PHP_AUTH_USER')) II !isset($_SERVER['PHP PW'))


($_SERVER['PHP_AUTH_USER') != $username) II
($_SERVER[' PHP_AUTH_PW') != $password)) (

//

/ -

II

header('H'I"I'P/l.l 401 Unauthorized')j


,
he~der( 'WWW -Authenticate : Basic rlm=- ');
eX1t( ' <h2> h2> , ' .
, , . ' ) ;

350

l6

nnR

G\K

<?php
/ /
$username = 'rock' ;
$password = 'roll' ;

KG\K

cu,et-u. :~u.u.G\u,u.

u.t) I\.~.}
tS'.l\.~tS'\J

u,~u.u., bL l\ bLl\b ytS'epebL,


"rr\ ~ CI\PG\.u.u,(;1l. ~~y Ilu..:9 G\I\
~~~ 3G\u... Mcl\u.. )j 03t-G\l\,

if (1 isset ($ SERVER [ ' _AUTH_USER' ]) I I


! is'set ($_SRVER [ 'PHP_AUTH_PW' ]) I I
.u. u.t] }O'Yr) . u. "YI'\Y
($_SERVER [ , _AUTH_USER'] ! = $username) I I
u. IltS'G\l\/t]G\.
($_SERVER [ , _AUTH_PW'] ! = $pa:sword { -,
/ / /
/ / ~D ,
header ( 'HTTP/l.1 401 unauthor~zed );
_ ",).
header ( 'WWW-Authent icate: Basic realm=" ~ ' .
h2
exit ( '<h2>
>

' . ' ) ;
' ,

t]G\PY
I

"

?>

_otS'MeC"Yl'\D u.t].bLu. u,u.u.

AjG\."I\. tS' cG\oM d..

<?php
require_once('authorize.php');
?>

: J,u.., "I\aK . bt.Jb!ael'l\

JJj.u,u.u. ~e.

derO.

<html>

<?php
require_once('authorize.php');
?>
<html>

~- -

,
.

$_SERVER.

- header ()
-,

Basic realm ( )
- -
,

-
header ( ) ,

exi t ( )

, .


-, ,

351

D 3D nR

If ~.G11

ZV11bJX ~011OCO~

: , l . ?
: , ,
(<< ),

(<< . ).

, . , ,

URL,
S_GET.

URL ,

. .

: ,
URL

: ,
. ,

. ,
.

URL
URL

.

.

: ,
. ,

URL ?

- n.

: . , .
. >, ,

URL,

: . 3 . ,
?

: .

Huorga

egeuatim

. , .

.

,

, . ,
,
.

352

CnOC06OCtnU ogen

nogxoge

1\

<<m1p.

MUIUA\

UCnJ\bO.U 1

ux .1

cqeapus

nnR

.--
<<. nlO

ero

ll ra, " .

authorize. php
adrnin . php
~ .
require_once removescore. php,
.

-.

- II
~ !>. ,

, -.
,
.

http://www.guitarwars.net/ removescore.php?
id-l0&
nae-J%20Srhrson&

date-2008-0S-01%2020:36:4S&
score-389740&
screnshot_jacobsscore.gif

PeJtn. 314340 ' ... -_........


~J.luaalc'Rt~IG.~

, ~

353

). 330 11:

' Jl

, <\ ~ ,
,
. ,
<\ ~
. ?

..an rw1t ! l J)CIIW. 11lal



ro \" IWro"1cn .... fu> lr~~j~n~~~.
..._

389740

1bIJI: ... CJI!oO'lClICOB


an: 2008-05-01

1 20:36:45

belitasscore.gif

389740

jacobsscore.g if

23

2008-05-01 20:37:02

98430

nevilsscore.gif

24

2008-05-01 20:37:23

127650

pacosscore.gif

25

2008-05-01 20:37:40

186580

phizsscore .gif

26

2008-05-01 20:38:00

64930

kennysscore.gif

27

2008-05-01 20:38:23

243260

308710

28

354

282470

nnll


, ,
, .
. ,

~ ...

, m . .. l1I'U3 &<.> &. ~ce, m


nl'UUJ m, -- 3mO mnl'&um
nmf'U'U I'wmUHr&Mecme era

nUnl'& U3Ql'u. -, m emSl


ObImb UJu 11.Iml' &<'>!

-m t\ o5LJlcl..

'-hr\

...1l\ .1l\U

.o..!.. ~.f6

.:U11\dP./It o.a.,
t\POC1l\O

011\~d~

t\.btu. u.11\U..

.ec11\e .l(d

01l\ d 't'l\U ..bI.


U.3 0 ...u..

, ,
, m

. . :

355

rumapHWM

&J

Tpe6reT

, ,

, , .
,

ageue
n.U9.u

- , .

pU

om.Ut\

, -,
.

gocmoepocmb

gaHHblX.


500000
389740
354190
322710

Cn6 n06cm

nocmyna1.UUX

/ ll1l!

om

n.Ab06affie.eii

rn >,

nOnl?ooyurne BrnucHyrnb
HUOYVb vvu VOKYMern ...
3-3-3... reCirnUHr. r50rn
rntarn UUJu reVKO.

,
n1\ .90&..u. .oo.o
U1\LU{GQ . .3 4Q1\,

'hI10 .

cpQ.3Y .91\
bt1\Q. 4 o0.3pe.u.e

u.U I)du..

~ ~

, .

, , -
,

.
,

. ,
-
.

356

Q 1\Q..bt

~du.1\ u.1\QbLx

6"oUIt:I> ... 1\ 1\Q.


U1\u..,Q, 1\

!. . 1)0.1\)
.90 epM.

3QuQ nunUR


J , , >.> - ,
.

;
; ,

.JallllbIX;

.::l SQL-

ALTER I1
approved

() .
u , aro
, ,
.


r,

( approved).
,

>.>

"',-----_._ _ ..._
E;;.~,.,."

approved.
M._~ ~ C _ ~._.-.

---, ~--..~

r, r

I1 r

SQL-,

r r.

KOToporo n
, r

<! ,

r.

~ >,>,
~ >.>;

, ,
.

,
...

Ik_.
.... )\ut

""'.".
MIiI ... a ua
.... 1'-- .1aIo_c

"....11_.'1'.

~~

1Wu.:. ualk",
~ _......

19740

WI)&0's-412 1 : I7

S4J90

'1OOI.Q$. 20:)6:2'

::zoo3..m.o2 10:Jl ;' .c 1

O& OS-41 :!1:14.$6


1OOI-j .. 20;36:(17
1OOII-O'011O:J1:1'
2OOI-OS~ 1 :!O:J7.40
aoot.oS.{)1 : :.t,

; ~-;::,"".:J~~=~~~~a.~~._~.~ :

8i!i!i.

.\

')I~"x-...
ZOUf{.(IS-021 4 :Cn:,,,
-"(-WP<_~J...O II(\ :16:4 '

"tJJ6orll bi~..

; . ro.

110
:\<40

2111470

24J2
IW80
I~16j(1

1OOIi- .. I1 .3 'J : 914) 0

:oQtQS..OI ZO:JI:(J() ?

j89740
:.~~~~

.~~

XiW~~ ~

~
~ .n.

YA'!'~-~

h!,''''''

:.\54190
: ~ 'hIo(.,... l"~
i "',.:XIII~121 :)~1'1

357

approved guitarwars

SQL-Janpoca ALTER

gui tarwars approved,


SQL- ALTER TABLE,

ALTER TALE guitarwars


~
ADD COLUN approved TINYIN

. Yl\u.M ct..btx

MySQ.L ~OOL ..Yl\.


Q}1bYl\epaYl\u.bt. u.e..eM (lI o..u. )

. Yl\u.t)ct.-9ct..btx nN'1lt, u. b!. Yl\


u.t)'0~ctYl\ )Q60 u3 r.x.

TINYINT, , ,

()

1 .

nlt

, ,
, .

ALTER . .
n approved
()
n.

um, ~, m &bl em
nrocmo uooa&umb &mu ot:;J

uu ru <<&&u reiimuf)'.

f'& SQI.--;.f1r INS~~ u &m


u u & ~

: .n II ll ,

INSERT . n r II"''''
... ... II_ .
, -

, :
, , -, L-

SS - . approv ed
gu i t arwars SQL- INSERT

~ : ~o ce.x .ob d4.btx .3ctt)u..

358

INSERT

INO gui tarwars

VALUES

(, NOW(),

CiYl\u.... ju. I(u. ctpproved


YI\w.u.ctYl\. pctbt ..)Q... ~

ctu,u.u.ct.!

'$name', '$score','$screenshot',

1h1

,
, .
,

<?php

URL.

?>

<?php
require_once('appvars . php ' ) ;
require_once('connectvars.php') ;

if (isset($_POST['submit']))
if ( ..... ...... ... ... .... ............ .. .. .... ..... ..... ... .... . . . .
II

II

II

approved

guitarwars

$query = "UPDATE guitarwars SET ..... . .... .......... . ............................................ . ... ";
mysqli_query($dbc, $query);
mysqli_close($dbc) ;

II

echo

else
echo

echo

'<><

href="

">&lt;&lt;

&qut;&qut;</></>,

?>

359

, .
,
,

<7 php

... .... .. . .. .

~~~~~~~7:"~~.~~~. ~~~~.~~~.~.i~P.?

.. ;

, 'h\0 .d~u., 'h\0 bL 3du."1\u."1\~.I~)1)~~~

<l:dJ(u,u.r~dr i1"1\u...d l')oMO""" ) \J'\

~ 1I0d)1)5t u. e~o I')d., . .7)1)0.90..

7>

URL.

~}l)Or Lt. A~eH:mu.cf:)UKdu,ust - .f'n\O

dbL)1)b

d.

cdJ/I.oM Q, "IdK KdK cu,eMpu.i1 <l:itym.)1)u.u.r.1u,ust

1I0.d.)1)5t -3d~u..

<7php

require_ once( 'appvars php');


require_ once( ' connectvars.php ' );

r,


r (

if (isset( $_ POST [' submit' ]))


if ( ..........

7>

360

~7:-~~~~~~.f.i~~.'.J..~~..''!.~.~: ............ )

approved).

.u lz nun_"

8'iG11t,

Zi)f11blX ~011OCO~

'9;

; . MySQL-bl ENU,

, ?

umtd (),
.

. ,
,

1,

ENU yes

approved.

() (), :

'9;

approved

TINYIN,

ALTER TALE guitarwars


ADD COLUN approved ENlJ('yes ',

approved .

'' )

, ,

,

.
.

//

//

HTL

echo '<table>' ;
echo

' <tr><th></th><th></th><th></th><th>e</th></tr> ' ;

whi l e ($row = mysqli_ fetch_ array($data))


//

echo '<tr class="scorerow "><td><strong>,


echo ' <td>'

$row[ ' date']

echo ' <td>'

$row [ ' score']

screenshot='

'</strong></td> ';

,</td> ' ;
$row [ , id ' ] . ' & ; date= ' , $row [ , date ' ]

, &; = , . $row [ , ' ]


' & ;

' ']

. '</td> ' ;

echo ' <td><a href= "removescore .php?id= '

if

. $row[

'&ap ; score='

. $row[ ' screenshot ' ] .

. $row[ ' score ']

' '' ><!> ';

.. .... ..... .. .. . ... ..... ... .. .. .. ... . .... ............ ) {


echo........ ............. ......................... ............. ............... ... .............. .. .................... ........ .....

echo ' </td></tr> ';


echo '</table>' ;

Coe"Y!\: .u.t\bl.Q

(Q!1.IJ,U.f4"!\ JDl(,.6. 6bt"y!\b


"!\ ~ .Q!1.u,u.f.btx
U"!\u....
.

361

n m

, ,

,

.
.

//

//

HTL

echo '<table>';
echo

'<tr><th>< / th >< th> </th><th> < / th><th>e</th></tr>';

while ($row = mysqli_fetch_array( $data ) )


//

echo '<tr class="scorerow"><td><strong>,


echo '<td>'

$row['date']

echo ' <td>'

$row['score']

$row['nae']

. '< /td> ';


.

'< /td> ';

echo ' <td><a href= "rernovescore.php?id='


, &; = ' . $row [ '']

. $row[ ' id']


.

'</strong></td>';

~ da.)) zullepccbtJlKY
"4u,u.ou.o<\)), IIUJqu:m. IIpoe
\u/.u.6a.ct JYr\<\ .3'\lI /k..\. e'vn.

'& ;

score='

'&ap;date='

. $row['date']

. $row [ , score ' ]

echo
echo '< /table> ';

.....

""'"

:.h'1I8 ...,.
2008.,,.I :02 :54
t.Wrwpc_ 2OOI..Q$..ol 20:36:4$

.-}!Inn.,.":

,.

.. ........

.... .....

2OOI-4i..11-1,'1"')
2OOI.os.QJ 20:33:00 '-4930

. .. __ ___

.
~

",~

~,

.'

___

"

2008.(..120:18:23 243%60
2OOI-4J1..OJ '1-;40 J IO
1OOI.(tS.(I11O".J7:23 12:16$0

. . . U .lI8tac
. . .t,:!'IJ

~~1;'~/~-':~l> 1

2001,,0,-0121 :14:.56 3Ot1JO


~110:36:Cn 111410

5u,.,.....

2001.,0,..0121
:1' : 17
2OOI-0421:36:2
2001.05.0220"..32:5<4

.......

..., ..

,....,...T~..
Jha ...

____'___

~
r,
rn

!r
r.

362

nnR

~ . ,

,
.

SQL- SELECT ,
II

1. .

approved,

Cnytt~_~J\..05

WEl\E
gA9 .
u gaHHMe.

COOtnetn15ue
onpeg.

~"C.l0BHOO WERE.

SELECT FROM guitarwars


~' 4:gp:t'"Qy.ed ';'- 1~ 40:4!::----_ _ _
---.
ORDER score DESC, date ASC

tt-uso
u

-----------------

.l WERE

il ,
5 .

ttA tu( approved u.ee.:n


-, 3.D.l-ttA. I-t . 1. U"Vl\-lZ

. "!\ -,l-t tAi.J.btU


t !,\~tAU f'\.

~ ,
;L111 ().

28

screenshot

2008-05-01 21 : 14:56
leddysscore.gif

-.

32

2008-05-0220:36:38

SQL-",
~.

- ~-epb "!\(o
:.

::~J{ u,uo.u.poa..bt.e

; ~ iJ."y!\tA!1.ZtA

~:"g."VI\.
-~ .ct.U
: ~ )4.u.u,e.

8"lt
..."ll. KOToporo
6... 38111O.
..., 06...
rlla.HYIO
.....lllt TOIlItKO
.

r.

- approvescore.php

-
r

n n)l(. r , n0
: .

MySQL, SQL- ALTER,

gui tarwars approved. INSERT

addscore . php , approved


~.

approvedscore. php

~. admin. php ,
~ , . ,

SQL- SELECT index. php ,


.

~ . ,
. ~,

.~ ,
. ,
, .

w. .
:-_ CII8CO peIIoaoo.

_ _ 1InPre"""'"

.....~~."'!~:..~.~H~~~~~.~":".~.
.

322710
314340

~ "

'

389740
3S419O

T~ .IIOP

-.
.

l'el8.r .,..

Tdoya

JlI'AII

2008-05-0214:02:S4

.ll C....vpco. 2008-0S-01 20:36:4'

. ..
.. ...
.
....,.,
_.

...

2008-OS-0121:IS:17
2008-0S-0220:36:28
2oo8-0S-0220:32:S4
2008-0S-0121:14:S6
2008-0S-0120:36:07
2008-OS-01 20:38:23
2OO8-OS-01 20:37:40

308710

282470
243260

186S8O
2008-OS-0120:37:23 1276SO
2oo8-0S-01 20:37:02 98430

2008-05-01 20:38:00 64930

V8JU I IIII!IUIRpO

~ rr~;~;;;;;~.

V~
~
~
.....

~=

___-,:!",,"---QSl i'-tAt)btd

(u,u.r.dYr\
.:\ GYr\ .tu,

~tAr.~tA.~tA
peu.Yr\tA~O~

1"1 Yr\.511\

Yr\~t) 1\r.u,

.u,u.r.g.r.
UYr\UI-\.24 , ~
.3. peuYr\tA~
}l\oJl<,eYr\ ~btYr\b
co.t-tJ< u,u.r..t-L

364

nnlf

. l n, ~lIlt.
Btotypct'101. '1'10 .~1ICI ~wrc ,*,~un. 'JO 'J'd1Or1
...: J10

.n' 21108-OS-02 20:36:28


~..... r:322710

:; 'law crpuo. """"nactpJIpOI8It pe.Inp:pt.!

Q l1.u.'Yl\
I1'Yl\.u..
l1 'YI\eM
'Yl\ btt)..
oe.t)oc 'Yl\..

ca~~O.u.poa.u.e

reu.'YI\u.t-IZd.

365

3en


. .
, ,
. ,
- ,

. ,
. .

. . .

~~~r~~':~i~~~:~~
~~n::;o~~~~~~~~
C~~~
..
.......
...... _ ........
.......-

__

Apdu:mp
co.eust

'Vl)1. !.
'VI) O'YI\ btcweu
c'Vl)el"je.u.

J<J<u.
peu'Vl)u..z ...
. .

389740

. .3!

m . ."tl\

d."tI\., "tI\bt

. I"jJd9"tl\~"tI\

1'10 \ "tI\, "tI\


ol'15t"tl\b ,9'V

J"tI\ cu.c'YI\eMy.

366

um nunUII

J ?
,

, , ,
, ,
approved, . ,
. . approved
.JO ,
!>lbI SQL-

?\"IY\? \\A"IY\d?bu<
goo.l-\.. I-\..e .,"lY\
110t-t."IY\b. 'v\
.~u...

. - !

282470

belitasscore.gif

22

2008-05-01 20:36:45

389740

jacobsscore.gif

23

2008-05-01 20:37:02

98430

nevilsscore.gif

24

2008-05-01 20:37:23

127650

25

2008-05-01 20:37:40

26

2008-05-01 20:38:00

64930

kennysscore.gif

27

2008-05-01 20:38:23

243260

jeanpaulsscore.gif

28

2008-05-01 21 :14:56

308710

leddysscore.gif

29

2008-05-0121 :15:17

354190

tbonesscore.gif

31

2008-05-0220:32:54

314340

biffsscore.gif

186580

7mo'Yl\ ?eo.'YI\\A1-lZ- I-\..e

bt .d~u,u..u.?~dl-\..
d?d\A'YI\?OM 'YI\eM
I-\..e Mel-lee. l-ll{d
dprroved . jd\l\

uJ..'."IY\ 3.d.I-\..\. 1,

, ,

~ ~'Yl\d'Yl\. .

01-\..

~\A.9e.1-\.. u? 00.

\l~d\.
~

367

3n

,
.
.
,
.

. , ?

.3ddYl\ "' ",


1'10 u. <!_-

1000000',

....

.
:
: --:------:;i---"

: ( )

.7tno 'l\ dbl,:Yf\b }u. <f>d:


UJd.u.. ''fI\ GIF u. JPE6
\3 - 3 2 KddU"II'j.

368

'\

'ethelsscore2.gif', 1) -_

etheIsscore2.gif

nnR

Jl ?

,,

Toro ,

, ,

;;'"

. .

: .

i~

m eM
co peU'll'\t..tZ...

.;
41
.

I .

u I<dI<Otl -'II'\

C'II'\~..btu

.!

$score

= $_POST['score'];

$_POST['screenshot')

.!.. 3..
t)ot <> Score
d.stl'l\.

,",. $score
u

t)e.pel-tu'll'\.

INSRT INO

VALUS

(,

guitarwars
, '$name',

()

'liliiii',

'$screenshot' , )

.. . .

, ,

1 000 000, ,

I-tet)oc .9"'II\l-tl-t

jdt)poc INSIRT

, . .

SQL-

$ score,
INSERT.

, ?
-, ?

. .
SQL- .

. .
. . . .

369

mQKOe QmQKQ SQL-

~Ul
, ,
SQL- .

, .
, , , .

;,;.W~.:.w.L........,,~~v.:::.:\t.::Q:.:.'r:~.w~Q~rs::..:..;.;... ':, :, :":, :, :",:, :,";,;,":. :. :"':, :, :",:, :,";,;,":. :.;"':, :, :":, :, :"",:, :,:..:.;'":":":":":":"';';' ';';' ':..:..:''.~.........~
.. .... ........... ... ....... .. ....... .... ..

v 6) AaHHblX
, ,

SQL-. , ,

~ecb 'YI\eKc)J
t') u.cl.

SQL-
.

.lI')"USl. (--)

.90

, .
/

v" ..

INSERT INTO guitarwars


VALUES

(,

NOW() ,

' '

'1000000',

'ethe1sscore2.gif', 1) --

K0..Ll,<:t ClI')POKU,

U,.U,ll').
u,KlI')epllpell')"lI')0poM

SQ.L.

'~

8," ? ", ' \

SQL-,

~ pe3~Jb"tY\""tY\e

......
vu

,.

.u..

_.

. , 3~POC", ~0.9.9eiWc;.
7ti, u'Yl\u'. bL
".u,u..u.dl-L
rd

370

date
2008-05-05 14:58:59

z6

$C~

screenshot;

...

I 1000000 I

ethelsscore2.gif

I Qj)proved

um nunUR

(6 ) 6a
( SQL-)

AS1 stg
gaHHblK qp.1

. SQL-.

95.S1t11CS CA85bI.

,
.

, ,
, ,

u peu9
--
nUA.

SQL-.

nom- ou

.8 SQL-. . .
~ (

~l ) , SQL-

npegoctna59m

.I ( ,

n.

approval,

-oct11b

).

550QUtn
i

gaHHble.

1000000' ,

ethelsscore2.gi

INSERT INO guitarwars


VALUES (, NOW(), '$name',

'1,1111',

'$screenshot', )

IfG 8bl~itG"th,

gl}t11bJX ~011fOCO~

~.

-.. SQLr

d).

-.. r SQL-,

IIpO (-)?

cn

: .

INSERT

(#).

(- -), (#)
SQL. SQL

approved ocn

: , .

. ,

/ * /.

approved

screenshot.
.

371

nmQu 5QL-I>

3 SQL-)
, ", SQL-i.>,
lI lI .

, I\ SQL-.

, , , , .
.
-

trim ():

, ,

SQL-.

J<u,u.

''''<1\'
$ = !S!( $_POST [ '' ] ) ;
$score =

ct-"'tl')

Ildbt g .ct U g KoKu,e

~~( $_POST [ , score ' ] ) ;

tr\"'tI')()

..7"'t1')W< cJ.~ bt.

$screenshot = J~~~ ($_FILES[ 'screenshot'] ['']);

Arnaa <<egpeue
~fl~a
51nb

npegott15

, .

nJ

, ,

, ... llO

npa5UAbHoti

05pasomU

- mysql i_real_escape_s tr ing ( ) ,

SQL-.
:
.

trim()

mysqli_real_escape_string ()

f-"

'${_

.,

_.

still() cJ.t-"\ ot)ctCKbte

Ufi\bt, "YI\0 e.c"YI\b "ct,3\


u.x g "\. U, KO"Yl\0'p oM o.u
. ctd."\u.~ct)OYl\.

\u,u.abt. u.bt.

!J!l1iLqli+:.,re~~escape_string: ( $,
tf . ' : "'.

.u,u. "Y\ys~~i_rM~_escctpe_

SQ\"-utt"YI\""Yl\d."\0 KctK

", SQL-.

gaHHblx

trim($_POST[

'']));

. . .

$score = ~sii:!.;i,..;'J'~<;il=escape_string: ($, tr im ($_POST [ , score' ] ) ) ;


$screenshot

1'"

= 1vsqli_rl_s_strig ( $d,

'.~ ~.

trim($_FILES['screenshot']

~ J<u,u "'~$q~,_red~_


", i.> trim ( )
mysqli_real_escape_string ()
", SQL-.

. ,
. . .

372

z6

['']));

sct_st\ I1 () 5l."\.

.u,u.U ct,3bt ctkbtx


U ""\\J uct"\
J

.;;

ct"\

"ep020
ctp2\JMett"y\ct
~.l;1t.
" I
.)

_
.u.-.u G ct,30U
ct .1""'U< ct.u.. "y\oM\I,
() J ()KctK
"\ "u.U"YI\ "L ~bt.30~e
.u,uu. bt"-iw.. 3ctl"\POGct,

nnR

& 6( (

INSERT

( (0 )

SQL- ,

,;;;p roved
,,:::reenshot . ,
INSERT ,
5dTt:'M

approved. ,

-- , .

I-I. id ~
OI-l.U.

Mozyvn IIpoC'II\O

'$score' , '$screenshot',

66apame.

npu

om

5m9.
Kaue 8.eu

.1tn9

1l0ct'll\ r.. 110 .ctl-l.U.).

INSERT INTO guitarwars


VALUES (, NOW(), '$',

15

~ u.. . l-I."l\ l-I.du.."I\U

3a.9 ctgct'll\b r..


u. ctpproved, 'Y',ctK KctK

INSEI\

KaUX .

r\or,la INSERT,
:'t: , .
VALUE screenshot :
,,3 .

id approved,

:i ' id , approved
:; .

~ex , . id
;~

,;pproved

\Ibl

AUTO_INCREMENT

INSERT, .

i ,
~ .

approved,

:~().l . INSERT , ,
., " .

[td;e; , B~eJC,.,~M~~~:~hQt; YI

INSERT INTO guitarwars


VALUES (NOW(), '$',

'$score',

id ..."l\ dbt'll\b
u.) UJ CIlU.CKct, tjO'll\OMy

'$screenshot')

J<ct

'YI'\

~ J<j ctpproved
I-I.e 'll\ .3ctl!ucctl-l.
I-I.U.., 'll\ctK
g CIlU.CKctX 3d.llpocct.

.')

ctg'll\OUKJ<pe.mel-l.'II\..
,

: , ) ,
:' , ,
.::t HHbIe

, ,

: :'

: -:- .
'-d INSERT
. -:- H.1CM

,: ", . ,
~ .

'373 '

80 80

DEFAULT

11000Qum Q.

~er&ble w mOM, m & mu MySQI.- nrum u .

l\eUm&um u CYLUeCm&yem m &3Qm:?

n" , " .

rAe

..

n . nlO,

n" .

DEFAULT

.
,

INSERT,

.
approved gu i tarwars. ,
, - gui tarwars
,

approved ,

(), .

TctK KctK J<ct ~pprovecl "", "


Jctllpoce ALTER TA~'E ~ .90..!. u.IlJct"

btctfW. MODIFY COLUi\\N " ADD COLUft\N.

~ALTER TALE

guitarwars
MODIFY COLUN approved
DEFAULT

TINYIN

~ .9 0!. ctJct" "u.t)

.9 ct .bt.x i<J<u., 'ffl\Odbt


.9 ct" I)OI-lSt", 'ffl\o " u.e..o
"ct J<ct, "o) b!.

l)ct<v1b J.9ctctu..

approved ,

INSERT
.
,

,
. ,
,

374

approved

nR

x

6
~ SQL-~

, ~ ~,
. ,

, , , ,
, .

i f (! empty

($)

t;:z ($score)

&&!

""",,,,~*<ffii

&&

! empty ($screenshot})

7rnC\ t)dJJ5t~\

, ,

J{.))I<u,

, , , .

if

t))), ce

, ,

t) bt

. -

Jdt).bt.

true,

is_numeric ()

, ,

r u.u. fd~se

, false, .

.1c\c"'I\ o"'l\ "'I\0-o,

, ,

f:. \l3 0\"'I\.

u, u.u.

.e"'l\

is_numri(4S730)

\.

is_numeric('one million!')

True!~

l fd~se.

\l 0.9d

U",OII. )

is_numeric($score)

is_numeric(O)

eg. . acmauae.
U ..
1

ux.

nwuaem.

if is_numeric () ,

, .

375

-8 H08WO

addscore.php

if

is_numeric ()

.1.. .................................. .. ........................... .. ...............................

--

6n r.

~ ~ ,
,

trim () mysqli_real_escape_string (), ~~

. INSERT , ,
,

id

approved.

i f, , ,
.
,

MySQL, ALTER TABLE ,


approved , .

~ ~ -,

~ SQL-~ .

lQ .9Qrtx bi.
4 .90c"tl)o~ep.oc"tl)b

. ~Q.uUQ"tl).
~CtU dQ,3bt .9 Q ..bI.x.

rMQ 10

PQCcQ"tI)pu~e"tl)

"tl) ,4U"tl).

376

110.9podKee...

nR

.,wl
,

,
11

<l SQL-,).

, .

W==~~~~~
:

~ YC~OKoe~
"YrIe~, 'tr10 "YrIer,epb
peu'l!1u.zu. 3\Ubt
0'l!1 r,gr.W!.
u g.,:
r, Ulk:\ rtogbt.u

46573

! u
u. , UtU

, Korva
u UfJ?amb u
rumape~..

m,u.z, 'l!10bt.
'l!1 ..
~g'l!1U,

UU;\U. bt.), 'ffl\O


l,uu..u'l).

d'I), l4'1)
.ec'l). lct..u ,.

JQ .u., ~ ~"Yrl, 'I)~

4'I)IIU pesi. u. C'I)Q'I)D


,'l)Q bt OU.rtOM,

377

& MYSQL

MySQL


r.

~c11 t1S1.

PtI -)'J<up.st,

U; t'1 08'd51. . t'1poefl<u,


Sl.1\. u. t'1epemel-O-l.Q,
t).94d ~' ~,Kd~ec1Y\e
d.' .11d, u,~U

Yn. )'u,u.Sl. 110JJd.


Ilpoepl<u, i111U1}.

u. u,u.bte t').
bL .bL u,ebt.
Ud.

378

exitO

nR

379

cO~r1HU,G 11Gfr1J\u,u,f~r1g

.ffiG-11fu,J\~GJfI4fl

-*

*-

,,,, MeHII nr?~

-.-

HanOMHume, , ~aUJe U5I.l1r~u, .


- ~aUJeU reflJCmrauuu, MUCmer

. - ~erebI, <fru fr
uulO aMerY:? , nOHUalO: ~ 3~OHume nr

u3 aMerbI. HanOMHume, , ~aUJe u.

KorAa

-.

,
.
,

. ,
, . -
. ,
( ,

MySQL?), -

n -n, nn.

381

,
: .

. , .
,

.
~.

mis-match. net.

~.

,
.

, ~. .
-, .
. ,

... !

u.u. )UYl\

;:'---'--'-

YI\ uu ..bt.

eQUYl\U -,

u.oGy.

I 1981-11-03

U . .Yl\.

I ,

. dYl\u
.Yl\Yl\YI\u.

.... ....

....

00
ll

be6-ll .

6ollbwoe II" II"


, ll0ll
II

nepCOHallbHOM .

~._---

---

I
I
i 1984-07-19

.d.. )du.YI\
1'1 cu...)

, Yl\5le)
dYl\Yl\(, cl'1d

u ..u.' :9Yl\,
1( .d l<YI\o-.u.d
OYI\'eYl\uYl\ .
~.
.
, ,

( , ),

~ .

382

uuz 6-R

, , 
, .>
.

,
7mo d.,3d .9o.ttbtx
.
"'II\iS"'II\o.t.ch.
mismatch_user mismatch ~

.. .

1\.uu,

"'II\iS"'II\d-t~_usr

dcIJbt .9drtbtx

1\is"'ll\.t.~ .5t1\.

t).bt

. bt

l)j.1\.

I...,t--~

11

1(0.>1<:90(1

.t\uu "'II\.uu,bt
"'II\is"'II\o.t.ch_user
."'ll\.

t\..bt..
.f.u{bt. .-

l) 30ct"'ll\...
llecwrat. .'

... ----,
-=

....

-:

UCOY

,_."

.... -..er'T....... A _

....

epcoll&8lo_. IIRp>WV<I---------,

---,

:~.

........: ;-

...:~

.......:~~4
ar. ,

...... .

~o..uu,o. pOCMO"'ll\ 1) UJ1.


' . ..1\u..u t) U..
.e.OXO~u.o 31-lo.1\, 1( t)pocpw1)O 1(0.1(0&0
, l)J1b~.'Yr\. t)ct1\ .90C1Y\)lI1.
..-

..........., @y-. .)(:101dnoW*

~,

1984-07-19
,

.10

.
;>.1 .

, bl

3 , ,

:l .

. - ,

l<bl

:l.l

::.

383

u nuu

J 6
,

.

uuun og


, .

n0350AgeIn

, , II "
(ll) ll
()

, . , ,

, ,
.
r

lI ".

, , ,
.

es-nueu

uogettcmoam
nOJ\305ameJ\9U

nepcoaAbHOM

, .

.
,
.

, .

(), CBoii
( ).

******

\
********,
"'-. C"YI\pd.u.u,e
ld "Yl\.\Yl\.
.. 1l0d"fl\.u. btl..O <.d.I("YI\Ltd.u.
"-., 1( Lt)Lt"Yl\.
"Yl\."YI\ l3 dJKe Lt u,Lt?
IlLt.~ "YI\ellepb
~"Yl\Lt"Yl\.' d d...bt.x
Lt btLt"d)'I\. dLtl
tl.Lt
Lt . -. bt"Yl\ l~Ll.bI.
!')30~d."fI\.Lt.

IIllLt"Yl\.

u .u. "fI\OM, Yl\


1l0.J'beJb ou.te.
"

tlLt-.u .

o t)Lt-.u.Lt, )d..

~d.Jj d..bt.x;

n CUj')l.~

~ .

******

8JI
t)Jd."i}.
Lt e~o - . "/'j

ce, 'fI\ .Lt

IlrLtu}, Yl\bt
t').."f) , .
Ltee"i} .

384

.:

nuu 6-nR

60
0
~ ,Z

, ,

, ,
. , ,
,

, .


. -

, , , , ~

, .
, .

~. SQL- ALTER TABLE,


. ,
username ( )
password ().

username

.~
_Cj!k

password.

: ~:~ v

ero

, v

... -_.._
. _
.
--. __
--....- . -...
::.., ~

p~_. _ _. "';'

L~") ~

.
~ ~

,!!..~~:'I;'::::=;:=...............

_,=uL , . .-,;::;=-.- -:: . : - .-.,


==- : : : ...
' '::::
I
L
. _ . . .__ :. . .1I
......

,
~ ::=~~

.
,
:.:_,
,
'
:.7.:,
\ ~...::::;:;..
wr....-...c.w ........... .:....- .......,.,....,~~ rt! ~..
,
-_'. .
, ,

, .

~"";:""" '-'

- _._ .~,

"

385

uu __

l'CIItCtl ll, . Ctl

ll . ll, Il

n , .
~.

www.headfirstlabs.com/books/hfphp. ,
. sql, -. . sql SQL-
, . . ,
, MySQL-,
, .
,

index. php ,

. , . . .
. ,
, .

...

r.:t. 1\'.uup I)I-.

ecoo1\e1\1\u. \1\ a
...1\ u 1\ ue.:t
u '?1\\u.u 1l0.ux .
31\\, . . 30 1\o~o
3 Il:9l-. Ilp0u,e.9ypbL xo,9C\
g Il ...u.

..., 9880DOJI08IIQC. aOAIIC:8.

"cm> upoau
.~ ........ upo'"

. ...

....

..

7u

~ul)epccbull(u
'JYfl

.ii. ._
-.-.'I!J!"~
'.
.

ll t::lAJuoa)'} 031\

386

' ". :

. ~U

I),.I-..

www .headfirstlabs.com/books/hfphp

........... .......................................................... .
~

nuu 6-nnR

6aJbI

J
\~u'u, Yr\iSYr\d:t.ci) u,ser

, . mismatch_user

.eo~xoobt. I<';U,

, ,

.J

.9 . D\,.u..
I

, .

tAe.u. t)J6'\Yr\~.

u,~ e~o Il\D.,


\.f'vrjoobt
I
t)U,"t\ I1pou,e.9-YD-Y
6'.9\ 6' t)u..u.~

mismatch_user

tfG 8bJ~ClG'th,

[ ==-L__J.---i---.L--L ---1-.-J'----'-----

~011OCO~
'9; gV11bJX
n0

n0n?

11

password,

username

userjd username n n

; n .

mismatch_user,

MySQL VARCHAR.

user _id

(NULL).

,
, ,

n
-n .

, ,

di.rdre

11 .


!
SQL-

username
password, , .
d. KYr\0 Jcl.XYr\
username 32 ,
1'10t)btYr\\"II'\. JC\t)o.u."II'\b ~ password - 1 ,

I'1\..9~~u'U
16 u. J50'

387

Dmum KDPDHiJDW

~8U8 ,u
SQL-

usernarne
password, , .
usernarne 2 ,
password - 16 ,

SD.L-.3dt1poc ALTER ~LE

Ul).3'!\

du .~t .

~ ,'!\)!.u. '!\dduu,.

.A\"TERJA ~\..E :\SJJ\!.t~_us.r.DD. us.e.rnc!.lII~. RCt( 2). t. NU \"k Af.'ER. use.r.jd........

.ADD..OdSS.WQI'l:f. ~ARCHAR(1.6), NOT NULL AF..tR. use.rl1d"tl\e ..~ Ko~o~a.

..:J

I .

~} AFER t').9 '!\ .'!\


'!\'!\ '!\ddULt, ... '!\ ,.'!\

t).... .d ,l{d

usert')d'Y!\e

d.... t')"rt\,

btd .. . .3
t'). .9 0 t')yc'Y!\u..ct.

'.J

~ MecYn,o C'Y!\pYKYn,ype Yn,dduu,. .. I('!\


1,....----~Lf~.."':_I'. ._:_--l ...9 U'!\. 'd. . ...u. . Uee'Y!\,
n:;~"'~.~Ir,#
. OpZdttu.jdu,u.O..oU. Yn,U .u.
ALTER TABLE,

t).d'!\ t') u ..u d.bl. (.3 .9d .btx.

n n

usemame ( n0n)
password (n).
6, m 3 )(rm nar
&3- ())( &&u()e nrocmoro ~ca...

f&. ()t\ nrw&rum


)UJUr&m :?

n w.
~j)

.

,
,
. .

,
mismatch_user.
, ,

388

Jl

...

u nuuz 6-nunUR

3 n
n0n nJ

,
.

Umepcpettc g.sa

t'l

1 Jd.u, 1l0"I'I\ t'lu."I'I\d."I'I\


(

&ga~eu

-----__4..:e~~o~c d .J.
Q

nUAeue

eooogu

l u.e"l'l\m

Moga

n~me.sa

na.sa.

1
1

[l3oU"fr!IA.

--u. U.5t u. cOO"ll\e"l'l\c"I'I\Y)O"t\


Jdrw... u.)OUJ,U dd.Je
qattbu<. t'lJa"l'l\. ."I'I\

-g t'lu.u..

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1,

lfG 8bl~.G'}}.,

ZV'\1blX ~o'\1foco~

'; n

.~1\Cb

~~"

3, ?

; .

,
- n,
.
, .

...

.
,
,
,
.

389

qUII SHA()

SHA()

. MySQL

1'1Y~UU9

SHA ( ) , , rou SA() UI\1l1JhVetn


SHA. , ,
,..J
40 , ctnpoy tne.crna.
. -,

n~~

. , SA () "'---"'-J -

......'\

6 yua.tlD1

40- , .

4O-cut1

ttog.

SHA () MySQL, ,
SQL-, . ,
misma tch_user,
SHA ( ) :
.

INSERT INTO rnisrnatch_user


(username, password, join_date) VALUES

(' ', ~('tatlo~r'),

nytleM Ilu.u. ct.'tA"'I\Jv\d :du5t~ \


SHA cpy.U5l SHA() Ilpeodpct.3ye"'l\
Ild C"'I\POKY. COC"'I\o5t~)O UJ

'-

."'I\.d:9\"'I\tA.btx u,u..

SHAO

NOW())

~o u."'I\tA"'I\bt.u.
t]dPOJ1b. "'I\0 eC"tI'\b "'I\0"tl'\.
/(O"tl'\0pbtu. lM .

~ t] d t]d

- ,

, , .

.u,u.st SHA() '"'peodPct.3ye"Y"


8-tA.btu. t"ldpo.ib
3dWtAdt-U-l)

.. "... "

C"'I\POKy, COC"'l\o5tIy)O

tA3

40 w"'I\.d.9\"'I\tAW

u,u..

(
__JCI

08447 ...

10

2d ...

11

" ... G11dD~


nu UHemJ13

390

z7

nuuz 6-nR

.QWlllllI
- ,

'U9 SAO

, ,

. SHA ()
-

ucnetn

, .

, - og.npasor
, .
UlUqJpOa.U9.
, ? R.

,
; , ,
SA () 40-
,

. ,

u1 em.e

geuqJpOa.ffib

3UlU<PJ58.

gaHHbJe.

, 40- ,
password mismatch_user .
SQL-,
, .

* FROM misma~,p,...user
WERE password = Ib~( 'tatlover')

SELECT

~o ll\ , KO't\ODbtu

1l0'0~\'t\ .~cI

O't\ Ilu.;..u.~u.u

s1

1ft

ubJ~a.t""

ZJ\v l1blX ~Ol1POCO~

d}
V
1
~
:
~{lJ.,I.l SHA() btbt61\5t . -moo0'g'1'0 bt e.u.e ..",HfRE
SHA()?
j6I..1AJ.61\ 1\6' u. l\.9d1\ . btfd

~ u.qe ~-u..gfW. .96 .

, password

: SHA - Secure Hash


Algorithm (
) . - ,

-' mismatch_user

, - tat lover .

. ,

( )

SHA ( ) ,

, SA ( ) ,

SHA,

, 40 ,

, .

6Jl JW Jl

().

SA

()
06 , ,
~l 40

~ l , password (16 ).

1?:
?

. MySQL ,

,
SHA ( ) ,
, SQL- ALTER TALE. MD5 ( ),
. SHA

NOT NULL

:>OJMep .u.

pC\ssword

UJMeKeK

::0 40, 'l\ 1l0,3u.'t\ \..'t\


~ .3\u.cf:>\.t-t u. .

,
SHA ( ) .

(shal () md5 ( )) ,

-, SQL-.

391

uuUR

mismatch .user

-
n

username

password

mismatch_user

MySQL, ,

mismatch_user u username password.

ALTER TABLE mismatch_user username VARCHAR(32) NOT NULL AFTER user_id,


password VARCHAR(16) NOT NULL AFTER username

password

40 ,

ALTER TABLE ,

ALTER TABLE mismatch_user


CANGE password password VARCHAR (40) NOT NULL
, u u, III\I INSERT
.

INSERT INTO mismatch_user


(username, password, join_date ) VALlIES

('',

SHA ( 'heyjoe'), NOW())

,
u , II

SELECT

SELECT password FROM mismatch_user WHERE username =

''

, ,
u

SELECT SHA ( )
WHERE.

SELECT username FROM mismatch_user WHERE pass\'iord

'heyjoe')

51 YCt)eLUJ-WZ

gd. \')oa"Yr\.~

t1Ll.u. ~')'<

.. bt"Yr\ "l''"
. KO"Yr\0pt'-

I\ 3o. r;~

<i..u.u. d..-t,: .

3d t\U.Cu..
392

l7

nuuz _6-nnll

m, mwert' na!'
33UJ!'&, 1'10 t1 t1WOXoQUMO co3<)amb
cro!' & & "rutlU. U "!'ocmo
U"3Q&m 'll'mettmuu, &Wb OtI m>
mreOyem && UMettU "&m U "r
uocmyna mUUitl cmraua~

()

HnP-. n

cwrpalt n
nn. n.

, ~ ~ ,

, -

.
~~
,

~ / ~,

~ ~
. ~
-,

I!. I1pOQr 00ii """"'_ .... 8O~r


~e c~88'Ct8R ..8 WWW.j.-.tch~ne:t.

aw I\8paI1b er

n_ .

"":'UOpo _.

~:b: ~r~:::~~~==:~::~
i

arrr 118P<1/1b -~epe aponail

'lf\d.9 ct 1\. .
-ctf"\1\u.cpu.ctu,t
..

K01\OPOZO jctg'u.u-1\ 01\

dpctyjepct, .,,1\ dbt.1I\b


u. I1 0jct. ct1l\
I1POC1l\OZO U-1I\uct
11 0jct1l\.U

I1u.,,...

393

HTTP-QmmuUQUR nuuu <,mmmu

v J

. .,
-, .
,
. .

. .

rl-w 80U

mu. . Jd.~. ..bt. dbt"'fl'\b t)OCJ1d..bt.


"'fI'\Ooo, 'l!\~bt ..t-u."'fI'\ "'fI'\~t) C"'fI'\pa.t-u,

u.t)Jb.t- -d~fol"'fI'\u.q:>udu,u.u..
-

header ( )

header('HTTP/1.1 401 Unauthorized');


header('WWW-uthtit: Basic

394

QQ7

nul 6-nnlf

(login. php),

- . .

-m

cu,eMpuu o:~xo.9

t)u.u..

--

---8.A.~

.&-

.8.-

- ....----

..........

IWL.........,.....

........

I~t:~-=-\
. 1
!~

,..""

....: -

._.:. ...~

lIIi_tch_u r

r11

rrTIE'"
~

395

(login. php),

- . .

....

-... .-......-_-

login-Pt1>
~ct t\ 3oct"Yl\J1b u"Yl\

t\~.u., e~o u.st u t\ctp'0J1b


t\ci)O"l\'\ .ct cOO"Yl\e"Yl\c"YI\ue
3.ct~

1(0"Yl\0pbte coxpct.ebl.

oJe~.

1l: ......, ,...... ""'.."' ...

IfG ~iG't1I,

.."""'"

.~~~.: ~~~I~~~~

; -

"',, ''',",

'6 '."." ..." ""


'",'

t:f}
,

- ;
-?

.
,

- ,
- ,

; :
MySQL SA ( )

, :

'9

0 . , .

, ,

, ,

-.

n?

; . ,

, ,

, ,

. , ,

396

Qu nuu 6-nunUR

0
0 HTTP-

(log in. php)

-,

$_SERVER ,

mismatch_user, .

u. u.

!l 1't!)

<?php

~~u.u. !l\

require_once ( , connect vars . php , ) ;


if

t>t>e.g e bt. iie!l pctUJ1biiO

(!isset($_SERVER['PHP_AUTH_USER' ] ) I I !isset($_SERVER['PHP_AUTH_PW']))
// / ,

~.. . .

_,

""4 f.

it('<h></h>,

'

3ct u.

. / ctytr\:Y!luu.j(~.

.'..'. '. . /1

."'-";~---'

't!);r\~

.9 Ijo~mopiiozo
< 3C\!lpocd.

' . ' ;

n'l.u Uft\e.u

1l 0.3 0d'!\.

3C\llpocC\ .9

. t)d..

//
$
mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAE);

'

l'"l.t).u

t))"-Iu

\Il U

t)d't!).

.9C\.l.1L
lA..e.eM

u.

t)C\ ,

t.1 '!\\d
lA..'!\.

if

(mysqli_num_rows($data)

1/

//

== 1)

Iu. .3.t)u. rU:9 tv::l '!\

! ,

i11w~ ~ r~~:p~~t~~~el~~euo

_""".""4"',' ._~......~,

Jtv::l.5!. t)~i-\J-tl-v.',

~u.ser _.id

else
//
//

'

u.

~u.sert)C\'t!)e.

'.

it('<h> <i h ~ , I' ,


'

//

'

';

R~~'.~1I:m~~~:mifi}[ 7t. l[! " rtp.WiJii~~.,: K~a


?>

}'Yf)OMy ..'Yf) ce

1'10, t)o}'Yf)OMy glJl' lA'Yf)51


1'1 0'Yf)::9.I-UJ. t')w.,
~ ' I'1u...u..

11"".~' n
nltn

ero

n.

397

- nuu mmmu

--
" lUllO. ero
.". "..

login. php

www.headfirstlabs.com/books/hfphp).
viewprofile .php editprofile .php -,

-
.. . .

. . .,
. , ,
.

:1mU ~Ullbt.1(U Y!l ,34u.l:.e

C"lY\pC\.u.up.., l(o"lY\0pbte btJ&t.C\}O"IY\ u,u

<.<~ llJ>u...u.:, u 1l0"\"I\


. ~ ..

(j

_.

YOl\ f'\\ "\u<:~l\.


f'\) <:p~I'U<up.u SHA()

U I'\l\. ,34u<: C\~


....
,1l\' ~C\,3e ct~' mbt
~M:c~e :II .
eluu"I!\b, \,3. ~ f'\~ .
.

398

arr

u nuu 6-nuUR

<t~tl:>.8'r8. >1' ".</titl>

</h:~~~k

.....,

on

....

lIn

~,

t:z"t.t/8 hrf=stl.s.

1>

IOn

rel"' stylesheet "

. . . . . . .:

19I1-ll~

-"'_:~..Jppu

r"""'re_"nce' ' login.


<html>

<:~~:l>Ji. lt'l"1O npo</titl>


t"' " t.t/s

href=. "style , css />

Iu. .bt
11jk\ub.bt
u I1~, 11030~1\
u1\ I1u....u.
u ~~,'j~1\.
1\cthb4 ~C1Y\b
1\jk\.u.Lt.

<t:9!. t)30~1\

t),'jct1\ 1\,'jt) CO

u. .bI. .1\1\"!I'
~bt.. KO"!Iopb!.e . .."!I
~"!I~"!I.

rn AJii&II'II."'.I~W
n
cw

8' ~

399

nunu II

u<'>&<'>m&ue &<.>UJ

&nj?u<.>~u u m&S1m
c&<.>u nj?<.>U, M<.>f'j
n<.>S1m, CQ3Uamb em
3nu & 3!1t<.>M nj?U<'>uu!

n0e.n n
] 3 n]

nA 6.
. ~
.., -,

. ,

.
, - .
..
. .,
,
.

IeJl?

400

nQ 6-nR

J
J
~ ~ 7 ,

... - ?
, , ,


,
. , ,

(, ).
, ~ ~
, , ,

mismatch_user.

t-tcl.4i'!\ust
.\ Co.3~i'!\b u...

t)..30~i'!\. u .

t)~ Jffl ~bt

3.3 ~bu<
t) u.u...

d8aO 1 1...

eSlld7 ...

, ,

,
. , ,

T~K K~K Il~


.3~w.ucppo~tt, !.
aeJoIi<:3,c.oci'!\u, ~ u
10-U ,uu.i'!\ I-.bt.

d<:IJe.

. ~, ,

, ,
- ,

mismatch_user.
~

401

ll8 llR signup.php

MySUL



. ,
. ,
,

,

.

<?php
require_once('appvars.php') ;
require_once('connectvars.php');
//

$dbc = mysqli_connect (DB_HOST, DB_USER, DB_ PASSWORD ,

DB_NAE)

i f (isset ($_POST [' submit'])) {

//

$_POST

...................... = mysqli_real_escape_string ($dbc, trim ($_POST [ '..................... .' ] ) ) ;


....................... 7' mysqli_real_escape_string($dbc, trim($_POST[ '.................... . :]));
....................... 7' mysqli_real_ escape_string ($dbc, trim( $_POST [ ' .... .. ........ .. .. ... :] ) ) ;

i f (! empty ($username)

&& ! empty

($passwordl)

&& ! empty

($password2)

&&

(..... ..... ........... == ... . ................ .J) {


//

, ,

//

$query = "SELECT * FROM mismatch_user WERE username = '$username' " ;


$data = mysqli_query ($dbc , $query) ;
if (mysqli_ num_rows ($data) ==
//

, , ,

$query = "INSERT INTOmismatch_ user (username , password, join_date) VALUES '


( : ..................... ' , SA ( .' ..................... :) , NOW () ) " ;
mysqli_query ($dbc, $query) ;
//

echo

'<> .

' <

href="editprofile . php" >

l'
mysqli_close ($dbc) ;
exit () ;

"

</> . </>'

Jctdb!.ctuYf\e, \fl)o u. ctu cYf\p0l(e

.ctu.u. o,9u.c.tp.b!.u. ctbtQu. '


Il .u.Yf\. qt)OCYf\poep, b!. .9 0Jl.bt
'
JQQCKU.p?ctYf\b . t)} .QDu.

Yf\bt (\ ).

402

Zll87

'

u nuuz be6-nuUR
else {
//

echo ' < class=" error" >


;

. , ,

. </ >,

= " .. ;

else {
echo

'<

. </>'

class="error">Bbl
;

}
}

mysqli_ close($dbc);
?>
<> , ,
&qut ; &qut;\.< / >

<form method="post" action="<?php echo $_ SERVER [ 'PHP_ SELF ' ] ; ?>" >
<fieldset>

<lgd>

</ legend>

<l abel for= "username" >ii : </ label >


<input type="text" id=" .... . . . . . .. .. . ."
.. .. .......... ;.:?>" /><br />

nae=" . . .. . ... . ....... ~

value="<?php if

(!

empty

............... ) ) echo

<label for= " ........... . .... ." > : </ label >
<input type=" .. . .. .. ...... . . . " id=" ............ . ..."
<label

=" ..... . ..

. ... ... . " /><br />

fr=" ... . . .... ... .. . . ."> :</ll>

<input type=" . .. ....... . ... .. " id=" .. . ......... . ..."

="

. . .. ........... ." /><br />

</ fieldset>
<iutt="sumit"vlu="" ="

submit " />

</ form>

403

Q8", (QU signup.php

Marutnbl u

MvsnL
z.

~o D\
.3.9 d 1.

0
"ll'lD
. ,
Jdt)u.cu.~.
. ,
~~~ i1:Ii""Ii
, w

, 0
.., . c.w. )"IeI'8 _.

'f'

=41

B _ o......Yka.

~~:::~:~~~~:.

~=-:..7..'_::..._~_:a_.O_~_~._._.H_ccoonccr.....

..------------------------10L--i
.::~[~~.:
... . . ~. : : J 1I
<?php

~--_._----_

require_once('appvars.php');
require_once('connectvars . php');
//

$dbc = mysql i_connect (DB_HOST. DB_USER. DB_PASSWORD,

i f (isset($_POST['submit'])

DB_NAE)

.,

$_POST

$useru&lll8_ mysqli_real_escape_string ($dbc. trim($_POSTI\-..;;.;;===::...... ] ) ;


$paBBwordl

mysqli_real_escape_string($dbc. trim($_POST[

:]));

$paBBword2

i:mysqli_real_escape_string($dbc. trim($_POST[

]);

if

$;..

(i;~;i~;,;~~e';.!)~&~&",,':iIIIIoo~"'""'ti!.~swordl)

/1/..

:fl.}=.

8jWo.

$password2

. {

.el(c:t, ce u.

:::::::::

&& ! empty ($password2) &&

FROM

mismatch_us~r WERE username i $urnae

$data - mysqll._query ($dbc. $query) .

i f (mysqli_num_rows($data) ==
//

,j

~..:~~

) {

, . .

11

join_date) VALUES

NOW ( ) ) " ;

' - u.

'YI\c:lI<. t)jd.Yrj.

.eYrj, /: Mo)f(.e, &Yrj

r;SER~: u.r)J J<:\I1POC

echo

'<> m

'<

href="editprofile . h">

< / > . < /> ' ;

mySqli_ClOSe($dbC);~

~eCb 'Yl\ Ur),30CI'YI\. UJ

exit () ;

t)p01{ep/(y

I3bt.oq r).30dYrj)

~ t)~Yrj~:9f5(
t).

1II
.........~~~...~ ',9<
. ..

Yrjli.O J<:\t)ucu.
u

404

. bulo~1r
,

. .. . ~ t)Jb~e.st 'YI\dI<u

Lf""i~~i.li:.l..s;,sswrd,

//

6'bt U 0&

u. t1c:t oUl<bte.

':::l .

/ / ,
$query_ = "SELECT

C:I

Q8Q

J<:\epwete

u,e.c:tu..

eqe.b\.x t)<:\, Yrjc:tl< 1<<:\1< I1u.


.c:t Yrj:9Yrj..Yrj.

....J

u nuu be6-nuUR

else {

/ / ,
_
echo '< class=" error" > . , ,

d.u t)epeMe.ou

$username

"~ $usert)Q"'f\e, "'f\o.o !)dbt.


}
t). . t)J1bJQ"'f\.

. t).30:m.

u.t)"'f\., t)"'f\
bt.u."'f\. u
.

dblJio t1yC"'f\bt.

else {
.

echo '< class=" error" >

. </>' ;

. u.u. .J(J( t)

'

'--.I1"'f\bt., t)"'f\ btu."f\.

u .

}
mysqli_cl ose($dbc) ;
?>

<>, ,
&qut ; &qut; \ .</>

<forrnmethod="post tt action=11 <?php echo $_SERVER[ I PHP_SELF 1] ; ?>">

<fieldset>

<lgd> </ legend>

L </label>
J:~~ :~ ~~;;::.:
us ername

<label for="username" .... ..


us ername ,_
.
= "text" id
$username
><
>
.
~ .. 2t1.

' lue="<?php if (!empty

t;.

...

~_

$username

cho

<br />

</fieldset>
<input type='submit" vlu="" name=" submit, / >
< / form>

'9: OJl

tml'UIIO ?

: .

-,

OCO~

, . >

n "" ?

: . , , ,

lO

. ,
-
na,

.. .

. lK

.
n., , ,

n ,

n, . n

. ,

.
. , .

405

otu un ({u nu

J BOJMOJHOCTb

COJAaTb

~ .,
? , .
~ .

~ . ,
, .
~ .
~Bxo .
, , ~ .

~ . , ~Bxo .
. , ,

, , , ~OTMeHa., .

~ . , ,
~Bxo . ,

signup . php.

~Bxo . :

it(' < h > < / h > ,

' .' ;

'

7nl01'l\ 1(0.9 >1'l\0 coo&.upe1'l\

~
o~ olt!A.~l(e ,3 1(~l(-./1I..J
' - 1'0u..u. 1'1\0).\ K~I(


~Bxo .: /
.

~ .
. ,
.

406

.. '.9~1'I\ j1'l\t-t:

~t)\J.cb t)IJJlt-t\J.\J.
01'l\1'l\C1'I\\J..

u nuu 6-nuUR

-
lO n. .

signup. php

( www.hdfirstls.m/ks / hfh).

, ,

login. php

. .

- . ~ .
.

, , . . ~
. , .
. . ~,

. ,
,
.

k::'---... 'YI)ozo Y'YrjOdbt .

.......
..........

.....

......~~. . . ~ ..JfIIW. .

..,.,~

..,.-~

.,.~.--.,.......,...,..

-~

-......

.....

~.. _.-.-,~":~

"

MOJk:\ 'Yl)u.

Il .u.

u.llJJb,-

~fi.-u.UQu,,
dQJu.I<)t
.Q u..#(:tu,u

-fi. 3Qtu..

J1w8C8h'.~-"""
HeeoonteYC1'8ll8. I'tA8I<8POU ...........

r
--,-

\~=f.J_.~
b~")"

~uen! ory
~oumu ~ nruoaiu
m~emm~u
u m nrocaml"u~aml
nrcfuu ~( n;,&m
u r,wamUrO~amb

coOcm~aiHbIU.

407

nunu n

n) nm I?Mecme ()\? cl?ouu

WU . m, m HUX
()yn nr<fU I? nruuu
ml?emml?u''>, HWoxo()uMa I?)m
I?bIxo()a U) cucmebI!
- II_ IIlI1t
IlIt0en. Clt ll_.,

CII coaeCHoro IlIt0.


ero

oAHoro
nOIlHoro

lllt0ll en

OIIlt r.

, ,

HTTP-. ,
-
,

. ,
<1 !>

, -,

, , -
- .
(, Firefox) ,
(Safari).

JJW -

... 1tpI/JIo:JJI/e llI< CIIl

. }

'I'cIOt!t~~.tn:JiCJ*'l'. "'COItIII("'"

r ,IWI'~1IU au

88&I ..poI./I1f&wr~"CI",,""

R_: iCowoo
. - . - : [,:::'""- - ":~IJ

. - : !'i'9in;'7.;';;19---

"'peII: rr...".
: iIA';poaoa
:::'=----

.~oCfNt.DlOOi.lCi_lcabt~

fr

"_Illl-

"'I\

O-.,.n.......

-_naponeiI . . -

.......: ..~[!: lidne:n>ic.J. . . .1!!!!IJ!II

b!. Lt
t)Lt.l-,
b!. oc"'I\ael\ecb"
., .90 "'I\ex
IIO, t)OKd
. 3d"'l\.

d .

llpou,e.9~pd ~0.9

UJ I1j>U.I-\JJ..:
t)03~Lt"'l\ CLt.91-

."'I\Ltgd"'l\
.90Cl\~t) 1( .9a.btJ.\

t)..

<1i>,

t)cpu..

. ,
, ,
.

408

uu 6-nR

Pa.3~e ,
(lO n.30~, .~

efo ~ nUuu ~?- u


~c.ero u 6:;uu
f'P-poMaHK?-

409

, ,

. mame
li1lV-ymemuqroauuu

-
:
, .

gae nb3068.tneiW

pen0tnC9

nocm11

~1>


$_SERVER. , ,
,

-, ,
.

:7:'::::=":=::"""-...-~~$_SERVER [
_ _ _ _ .. -.~

"'"

<>. ,

5btmb yg Korga
5 ' 5CX3Uem
eosogu.ocm.

_AUH_USER

\.ct"r\.

I ]

: ; v. t'1ct ct5t}O"r\.

$_ SERVER [ I PHP_ AUTH_ PW I

\.ctb.

~. $_SERVER
.ct t'10"r\...u. oc.oe.

,
-,

~ !!II!I!! -
yU n9)tll l38.J\\
.
nA~'" ~UUl...IP

,,-._ ...... ~_OA_

ueIl\C

'o.notnepe

, ,

noctnaJO'tt 06.

, . .
, I' ,
,

18 mo ou Maytn

nepeum tt
ceapun.

, .

. u sm

6-

ygae1 58.UJe\

au!
n

.
-,
,

&

. ,
~1> .

,
,

410

.
, .

uu _e6-unUR

?

. ,
, , , .
, .

, -.

,
, .

~-"
.

3ll
, .

___

ZVl1blX ~Ol1rOCO~

If J~iih,

,
.

~:

? ,


: , . ,

,
, ,

,
?

: ,

(,

, ,

) .

. .
,

,
.

MoMeK'fr\ u.c'fr\e
..cp0l<ct i1'fr\U
KYKU. 'fr\ct..
, .9 ct ,
"hIIo 'fr\ .

1"10C'fr\O.Sl.~

MoMeK'fr\ u.'fr\.u..SI.
cpoKct U.'fr\u..SI. K::JKU.
. ::J'fr\ct.o.. \<.::JKU.
::J'fr\ ::Jd.. I1pU.
3ctKPbt.'fr\U.u. ct::J ct.

, ~~
,

$_SERVER
:


,
.

. ,
,

,
, ,
,

, ,

,
-, .

411

U setcookie()

II30I

setcookie ()

$_COOKIE. setcookie ( )
() .

$_COOKIE

'username',

1l.pt "G..j
t")epe.9ctctebtu.

'');

r3w1

J<u,LA\.

sei:cookie. (), -

"\ u.. \.(..

.......

""",

.90kl dbtYl\b

COX~I-le..o K~K\.A,
l')..ctYl\

~l-lJ<u.f stl::i
1\opbt. ctpz.~I-lYl\

('< class="login">bl OIIDI pJIOt JtaJt

'

$_ COOKIE ['usexna,me']

' ,</>');

\. \.t)1\. KctK---"

btct 4 . 34l-lt.A

llctb. .ct
$_.

.ll ,
,

,
,
.

,
,

),

.lI .

setcooki. ('us.r_id '

<J>y\lU9
setcookie()
noooAget11

.91

6KYU

3d.USI. pct..5t)O"tl\. \.
..ct \.A.ge Yl\e.K CYI\ct, \")"\~,
Yl\ \.I-lYl\\.cpu.ctYl\ I').3 0 ctYl\.
.Yl\. u,bt \., bt coxpct..5teM

. KctK Yl\eKCYI\

'1'.

setcookie () ,

, .
.
, ,

412

gaHHble

u uuz 6-nunUR

~I.,.6_

,
. , ,

-.
, , ,
, .

<?ph p
require_ once( ' connectvars . php');
if ( ! isset($_ SERVER( ' PHP_ AUTH_ USER ' J) II !isset($_ SERVER[ 'PHP_ AUTH_PW' J
/ /. / ,
// .
hdr( ' /1 . 1 401 Unauthorized ' );
header('WWW-uthtit: Basic rlm="" ' ) ;

it('<h></h> ,

' . ' ;
' , < h r ef= " signup.
h " >< / >.' ;
}

//
$dbc = mysqli_ connect(DB_ HOST , DB_ USER, DB_PASSWORD , DB_NAE);
//
$user_ username
mysqli_ real_escape_string($dbc , trim($_ SERVER['PHP_AUTH_ USER'] ;
$user-password = mysqli_ real_ escape_ string($dbc, trim($_ SERVER[ ' PHP_ AUTH_ PW ' ];
//
$query = "SELECT user_ id , username FROM mismatch_ user
$data = mysqli_ query($dbc, $query) ;
if (mysq1i_ num_ rows($data) == 1) (
// ,
//
$row = mysqli_ fetch_ array($data) ;
$user_ id = $row[ ' user_ id'] ;
$username
$row [ ' username' ] ;
else (

/ / / ,
// .
header('HTTP / 1.1 401 Unauthorized ' );
header( ' WWW-uthtit : Basic rlm= " " ' );

it('<h>< /h> , ,

' . ' ;
' , < href="signup.
h" > </ >. ' ;
}

?>

/ /
echo(' <p class="login" >Bbl '

. $username .

'.</>'

413

u u

3 . ,

~, -

, 0

-.

d). . u... Ilpo ~~

, , , ,

bt 0 . ~MeC1l\o 1I\. m~bI. UJd1l\ U.SI.


'y.3.d"t\b, ~w 1l0Jb.30~d"t\
t).ct1l\Sl u. . . UJ ~ ol(l'it1o&t

"t\ ~ a.u.e

KYKU., n

~ Ilu....u. u.u. .

dyn\.1I\v.t.U<du,u.u., ~ eo~x0.9u.o u.t).


031..~ .sFPM:-J ~ t)o~u.~ qctbLe

<?php

.&vb&Ul MCCtt \> _10S.

header('WWW-uthtit:

<

>

Basic real ="

</h>,

"')

na ,

'

' np .';
'

<

href="signup.

h"></>.';

//
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD,

DB_NAE);

// aYTeHT~~~~__________----__~
$user_username
mysqli_real_escape_string($dbc, tri S_SERVER['PHP_AUTH_USER'])
$user-password = mysqli_real_escape_string($dbc, tri ($_SERVER['PHP_AUTH_PW']));
//
$query = "SELECT user_id, username FROM mismatch_user "
He1l'\ tdl(U
$data = mysqli_query ($dbc, $query);
~ ..u.o1l'\u.
== 1) (
// np ,
//
~~"""'-I'-I"~~"':.I:I,.a.J;;.j~~$dt);

lAJ1l'\ Jdt'\poc!

i f (mysqli_num_rows ($data)

np

3:9 ~..eC'W\0

~u.tSt d~
Ilepe)o\e~ .9 0J1Jl(.bL

username

cO,3,9d"tl\b IldP~ 1(~1(..

else (

//

/ ,

hdr('/1.1
ader('WWW-uth

401 Unauthorized');
ticate: Basic rlm="" ,

it('<h></h>,
'

'
h"></> . '

np

na ,

<

.';

href="signup.

// np
echo(' <p class="login">Bbl np '

414

. $username .

'.</>')

nQUU8Q s6-nnR

npOeAVpbl JR
-

.. , .
, , ?


, -,

Q' cpop..ct
. o~ u.eJJ,

, ,

\1Q' .3c1.u.ae1Y\

.1\ . u.c1~1

\1030'Q"YI\. u. e~o

~:ft''\ett'V\fw<QUf.UJ..
~.T",~",I".U

..",.~!

.!

.~ .--- ~--------------~----------------~
..-"'--

~:

G:u.9.

n~poJb

tu.

r) 3 0 1"1\Jb
{

~ \1 u..u.,

.le.a ..obtx
--..
:; :)Q.'V\~

,'V\.

?~e

":poc~o~o
"'I!\e.C1'l\d..

xo,9Q

1'1 u..u.

IJ.e. .bt.x

.. 1'l\1
'V\1..1'I\,

Index.php

Gu.r,bl.c1u. .

I'1pOCM01'l\pc1 u.x I'1u..l1.


8

415

login.php -

---IiIiiiI,,,,,

Jl JlJI ,
. .,

, Beceoneea. -.. ...........


,

. n p u _ ~_ _ _ _ _ _ _~_-,

...:

;'::_=---~,

. , ~~~_
:........._
:~I;~.~~..~"';:-=-=;;;;;:...:...:.....:.....:..O\t~_ _ __

(110m)

< ?P~~quire_OnCe( 'conne ctvars.php ' ); ~d.u. o~ 0U!J.~!Se "II\el)e~ pc.5l.."II\.

'

< \'

lOgIrq

"

l)e.peM~Ou u Ei'Ws'u"ll\.: I(~d "II\ "II\.~'."II\.

1)0 'j rlbtt)...u.. u,eOU5l..


~____----'

{<

'

'd

_
~~d.

1'.)

~~ ~xoa
-J
1) uo.u.. .

llpoe.pKd .3u. KjKIJ. US~C\ "'1


0,",1 !.u., 110o1Sc:m1

g 1'1

~F.. u.u. .e1f\. ~c1kA. I)3od"ll\, ..


I)UO.u.e, I)o~I.L"II\.

//
l)e,oepl(d:
$dbc = mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAE);
.. ~ct)Yrl ~ e.~o ~kbte
/ /

d
.
$user_username = mysqli_real_escape_string{$dbc, trim
));
$u ser-password = mysqli_real_escape_string($dbc, trim (
));
i f (!empty($user_username) && !empty($user-password)) (
~XO~
. bl.e ~ I'\Jb3od'll\est 'll\et'\~
/ /
noc
u.J. I(dK d.1. .bl., d ~
$query = 'SELECT user_id, username FROM mismatch_user . -d~'II\~~d~
'WHERE username = '$user_username' AND password = SHA('$user-sswrd')';
$data = mysqli_query($dbc, $query);
i f (mysqli_num_rows($data) == 1) {
/ / np ,

t)..,d."II1.. I1I.LO...u. l1'j"111e, Od...u..

K'jKI.L l.Leu I.L u.ek'Yl\l.Lu.d'Yl\~,


(60 60 24

));

//

' .

30

.';
}

I.L I1l.LO.u.

'tr\0-'1\9 .. J1c:\ql.L'YI\t.

"II\dEi'.'!\3t cooW,e.u.e

?>
<html>
<head>

OtLtudKe,

<titl>.

. </ titl>

<link rel='stylesheet' type='text / css' href='style.css'


</head >
<body>
< h3 >.

np. < /h3 >

t1 .u.

C"II\ pct.u.u,e .. ,

416

z7

d 'j)u

nuu 8e6-nnR

< ?php
//

u. \').30d:'1l\ "Yf\~
."Yf\ ce .
t'1u...t, bt.u."Yf\.

< f o rm method = "post" action="<?php echo $_SERVER['PHP_SELF']; ?>">


<fie ldset>

dt u.d.

~~~__~____~~__________~________.-___;$__~~d_O~
___[~'_u~s~
~,~_am
___'_
J ____' ._~_t_p~>_~,~
i~ ~
u. \')30d"Yf\ "Yf\

."Yf\ li Iir0u,~9Ypy d

t'1u..u., bt.gou."Yf\.5(

'.u. "Yf\.

lfG 8bJ~iiG11I,

ZV1tblX ~01trOCO~

~ ~

MOry

3 ?

, ,

~ 0,

; . ,

>l.Q
~0

mismatch,

5 0 3
~epeMeHHX

~.

user_id

; (
)
':'.i1 ,
':J

mismatch_user

"W . ,

_' -=:-_i d

-:

- :,

.:..-~
~~ ,

-:;

= ~.

~;

if.

HTML-
-,

. ,

napon ?

- ?>,

0,

- <?php,

, -

, .

, -
. ,

, ,
,

.

~; ,
n

.
L-

if

i f,

else

. -

echo.
~

417

uuu nunUR 88

8 J
~Bxo .
~.,

(index. php).

. ~ . ,
,

. , ,

u "Yl'\"Yl'\ .
usert\ct"Yl'\e, ~.9u."YI'\

.ctlJ.Z4l.A,Uo.oe ..)

.9. . COC"Yl'\ctct.

-m ..)

5I."Yl'\, ..9ct
l')oJJb.30ct"Yl'\eJJb
.
'-...

I1...u.,

..9ctgct.
~.}.."Yl'\
U oU"Yl'\u. u.

.3ct"Yl'\ :;"Yl'\.:;)

Jctt\ucb.

Cu,e.ctp,u.u.
i l1 dex.fI1p .3.cte1l'),

1I') . .90.

bt.0.9U1l')b
.~.u...
-


$_COOKIE username ,

index. php.

user_id,

( ) ,

418

username.

.ct'u..ctu,u.o..oe
.), .ct
. . .ctxu.1I')
:;.

userl')ct"Yl'\e.

nuu 6-nuUR

useCid
. u,t\Jb"'l!'\5l

Mu'AUJ..WtWM .),
. do 5l
t)u....u.5l u,..

HctU,Mup.o..oe
Mett)O .9;!l5l

t1 0Jb30ct"'l!'\5l,
w.
t1u....t.

//
i f ( isset {~mKrEfKtUjr"r"'!@
i.am
"'e
''!it
<m (;
echo '&#10084; < hrf="viwprfi1.h">
echo '&#10084; < hrf="ditrfi1.h">~~*~~"'1
echo '&#10084; < hrf="1og0ut.hp"> ('

')</>'

{
echo
echo

419

.", u nun

l1ru&em, nOMHume :f
& eu..\e -
&bIumu u nrut.u.
.ll .
llll. .

....

ll

~
,

~,
( ),

.
, I)f-
,

.

.,

......

__

,"""-

1oI.IIiII

..

........ ..

..--(~)

Cu..9t{!J. ce

:9'Vl'\, I(O~9~

,'Vl'\ g-bt.u.'VI'\u.
U.J I')u..u.."

Cu,eMpu.u. ~o.9
u..3 IIu...u..
.'Vl'\ KYKU.

x 0.bt.u.. .9d .l:.u.


l')J1b.3 0d'Vl'\.
u. l').btd'Vl'\

dPdy.3ep .. ~d!-l)

C'VI'\Pd.u.~.

420

Qu nQuuQZ 6-nunUR

3 Jll 0 iJl
(
).

setcookie ( )

MIA.JI'Ibt

",
stki('usrn',

ceK'J"P-

"".

L~
f3~\tl\ l\.

'Jt' , ...........................--.(...
6()
...
. _"*_ 6...0.... * 8 ~

'----------V~ct~u
~ ~l\ct.ctu.ctl\


8 . ,

8 .

MoMe..l\ e.eMeu
.ct
ct~ \i ,..

,
u

. , ,
(, )
.

l\eK\JIllei?

A. .an

J-'

~ - m1

ygautnb KYU
YCl1a06ume

npocII10
5

ucm.eeu .

gemsU9.
. ,

<?php

//

if

//
//

//

kOMeHTa

//
$home_url

'http://'

header( ' Location:

'

$_SERVER['rP_HOST ' ]

. dirname($_SERVER['PHP_SELF'])

,;

. $home_url);

?>

421

wwii

logout.php

. ,

<?php

//
if

( !??~~(~~.~9~:r. :~?~.~...,.!{]) )

.-.;-=

/ / ,
/ / .

//
t

k ('

' .1' ' ' .

()

~I(~.'y.e., )/(.."!) ~"Y!). ... .

YC"Yf\~.otll(~ MoMeK"Yf\~

/ /
header( 'Location :

'

y..9~

. $_SRVER['_S']

KO"Y!)opbtu ~ IJ.UJl..~.u..

.~.~ ..~9.. !\;~~.~.! , .. ;,.~I:m~ ",(~ ,' ,Q. ;~~"Yf\.u.. CPOK~


.~.~~<?~?~~~ ..~~.~.~!1~~~ ! .. .'. ~~~~ ....~ ...~qO~~~:o~~~: d~U
e~ cuc"Yf\eMoU.

$home_url = 'http: // '

~"!)"!1 t)J~"!).

26)

nct.9'~u,u.

z-g'le) c,~.u.u,'y

: ::;~::~~~
~)O"Yl).z- URL.

. dirname($_SERVER['PHP_SELF'])

.,).

'

.!.i.t)~~: ~p.

. $home_url); t)'. ?-.3~ MeC"Yf\~ pctt)...u..


" - - aoc~tiOt)

?>

~edder) , u,u t)epe.ct.9p ecye"Y!)

p~y.3ep M.y)O C"Yf\p~.u.~.

--
n III nIII n III
.

.~ ,
(

www.headfirstlabs.com/books/hfphp).
index . php, login . php, logout .php, editprofile .php
v i ewpro f i 1 . php.
, $user_id $username

$_COOKIE.
-
.~

(index. php) . ,

, . ~.

, .

. ~,
.

422

.. :.:

CJu nCJuu 6-nunUR

cr.

Hero

rynlO.

YBU()UMCfI!

llOn

~---"

-.

--.
. . . .....-.:

J~ 19

'n' ...~e...

K::JKU. bL.bt,
"'I\bt Jddbtl\b

1I030dl\,

KOl\Opbtu bw.l

u.j IIU.u..

........

_Lu..U..v. ~
l\ , "'I\

bt.ul\u.
u.,3 I"\u.u..

-----~~'" u. al\b y..u,

.
8bJ~ittJ1l,

Zvl1

ffiOl1 P ocoffi

U
1
d).
~.p 3, n, ?

~O IIcpu

l\l\l\v.
. ~::Jl\

u.,.. r\.U.KeM

Ol\c:1l\cl\u.e.

: .

. ( ),
.

f: n
? ?

: . , .

(3600 ) -

, ,

, .

423

, m

Cefee? 1\!?LYf\d.eYf\c5t
fd.I-W.Yf\
v. t-lYf\v.~V.Kd.Yf\ ?

t")d."\5t

v. l.).)St v.
t-ld. oMl\b )O"I\

l\ d."\.51.
I<LJro mm nr
&w? f'" n()()r> KYKU
" uum"?

, -n n
n n nn.
,

. ,
,
. , ,
, .

JI , I(
: .

424

uu~ 6-nUR

J
, , , ,
. ,
? ,

Ceccuu n5J\9tn
coxp.mm esouroe

?
, ,
, , .

qJparMeHtnbl gaHHblx

CeJ)6eJ?e

easuCWt\

om .uema.

d.YJ . t1u..~))

))u. u. )) .
. (\)(Ji'rj cO.

~ cepepe.

.t).9 ))J-t.

y<-Ic:t'Yr)u5t Coxp(\.e.u.
.9c:t.bt;( ceccu.u., 'Yr)c:tK
(\ o.u. (\)(Ji'rj.

cepepe.

&

gaH1-1 ceccuu

. , ,
, .

,
,

. , ,

,
.

.1Stn9
.
UU,Je

g. gaH1-1.

.1

.
-
~
-
.
?

.
,

, ,

. ,
,

KYU

10Jc:t)) . ))

.)Q .9c:tu.)) .9(\..!. ceccu.u.

u.t)J)I51. co dpC\YJee, wt

)) C\j(\'Yr). t)
(\ u.t)Jc:t.u.5{ KYKU..

' l1er,eMe.L"V< u.. .

'Yr)'J'Yf\ MoMefot'Yf\(\ u.'Yf\JJ5l


'\ u.'Yl\u.,. 'Yf\d.K Kd.K o.u.
(\~'YI\~'YI\u.u. .9d.'iOi1\, IlpU.
.d..u.u. ceccu.u..

425

session... start(} session_.destroy()

.
. , ,

,
" - .
, ,

PP~UU9
~on_starto
ompae

u gaem

ceccu

, .

mOCtnb

, ,
- sssi_strt

( ).

COXpa1mb g

5
sssi_strt

()

nepeMeIOIbV\.

. .
,

- .

7mo"t\ jtw.l<<V1bfo\btu.

&

6- u."t\UCPUct"t\
ce.CCUU

..u~"t\.

ct"t\ct"t\u.u I'"\PU
. O"t\KpbL"t\~

,
,
sssi_dstr

().

, ,

, .

426

Du nUU8DZ 6-nuUR

J
, .

session_start ( ) ,

bt.

!> ( ), $_SESSION.

/ " ceccu.u. 3d.)))5(

.Jt';~

'"

i)

u.

.. "'''"IJQl::l>e.

~ 3u ,",..

,",. ceccu.u. u. I1 0,3Yr\ ceccu.u., d....


Kd.K u.. zd.. ft\c:\ccu.e ~l1zd.. MCCu.e

$_SESSION,
echo(

l1

$_SESSION.

'< class="login">bl :ODUI : pn :

, </>') ;

'

Yr\ozo ))dbL 110u.Yr\

$_SESSION,

jl1 .d... MCCu.d.


~_SfSSION u..I( u.eu

.
?

session_destroy ()

, (

II !).

$_SESSION

~ ~ .3Yr\d.Yr\ !.110..u..

$_SESSION

= array();

Yr\I1 1( l1 . ceccu.u.,
u. I1 0 ,3UYr\ .7.Yr\

.7Yr\ozo d. ce l1epeMe..bte
Yr\l( ceccu.u. 'd.)O'/j.,

,",...

~ ygaA9tn9
uu

npu

uu

u. ceccu.5l u.t) 1l\

. .

KjKU. 5!-

-,

u. .1I\u.u.d1l\d

, ,

ceccuu

COXPd.h.et-5l

u..1I\u.u.d.1I\0d,
. , 11\0 .u. .711\0.

,
. ,

setcookie ()

.J . , ,
,

time() - 3600);

~..d. .u.
tlpoepu.Yr\b,

session_name ().

if (isset(
setcookie

('>

"---

g .

u..!.

Yr\Yr\

u. . u.e.eM

u..yr\ u.cp( d.Yr\ . cu.u..

L" "",,~eM "9,,"<f'W<~"'~"


ceccu.u. 1.1l\. YC1l\d..oKOIJ.
epeMeu u.1l\.u.. .
'V\u.. lip OLUJ1O f.

427

nunu u

06 l ()
0
I1 .
,

. _ ,

, :

, .

session_start();

'\

~ru<u,u.. sessiot)_sta.rt()

u.1\ u'1\u., 01\bt...

ceccu.)(),

u. .,. }Q
t)J<. KYKU., cepep
.3. 1\ . coxpa..e.u5!.
~.1\u.u.J<.1\. ceccu.u.

t1P 0'Yl1U..oM .

serssion_destroy (),.

~ .3:J1't\.1\
bt.gct ~ru<u,u.u.

sess io t1_destroyO
u.

.1\u.u..'YI10 ceccu.u.
~
.~
01
J 'Yl1 t)Gl.~.'YI1 J<GI.-?:9 0
C1't\pa.Ku.u,e coc'Yl1a.e URL.

u. ...u..
ceccu.u.
bt .3ct. J<'yJ<u., .
~geK1't\ucpu.Ka.'YI10Pct

:J.1\

3ctK bt.ct1't\.,

t)1't\ctct
1Y\a.Ku. octPd.3 0M
u.l\ct.u.

F~u.u.
c1't\ pa..u.u,a.u.
ct ,.!., K01't\0pbLe

bt.

..

coxPa..e.bt..
I
ctl-<t

ceccu.u.
,. /o1'f\ ..u.

~t)~d..~ ::\u..
~__ SESSION.

428

.bt. ...bt
ct..bt. d..
ceccu.u., . . ,..

..........

~HB~"
.....~..~...~u

tlu n'tluu be6-nunUIl

J l J
.

~ . -m 'VI)..

,
. ,

,3dm b , u.t),30~.
u. KjKU. . l;Q....

u..mu.(f>u.I(Qm Q ceccu.u.

, .

ll " .

~ .3 mQI(OU IIpO pKu..

. q

- ero ll.
.

J-.U 1)Qt) .
iQG\1) u.\Yr\

I{(.\I(

t)~J-.1)JJbbtu, 1) Dbt.u,

~ .5l., 5I.Yr\t51.
.d5l.,3ct1)bt h u.

.6
rll .

01_..

"r

~ t)JJb,301)

,3 t)u..u.., . ecbG\
t)!J.bt.

,
. ,

,
, ,

<7 php
//

, ,

//

session_start();
if C............. .............. .... ... J..! .. .
/ /

//

, ,

//

//

(36 0 0

$_SESSION

i f ( isset ($_COOKIE [sssi _arn ( ) ] )) ( ...... .. ............... . ....... . . ... .. ... .. .. . .................. .

//

//

$home_ url

= 'http : // '

. $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/index . php';

header ( 'Lti : ' . $home_url);


7>

'

429

uuuu /ogout.php

,
. ,
,
, .

(j) dl- l1epee.bLx ceccu.u..


(i) llpoepKQ "t\.. . u.:YI\u.u.Q"t\'

ceccu.u.. ru. "t\QKoe . "t\"t\ - . dl-.

@ 3QKpbL"t\u.e ceccu.u..

Q lleped:9pecQu,u.st ~~Ye~ 4 .l-t) "t\~I-u,y.

i:;

<?php
/ /
//

Q., I1. bLxo tJ.3 I1u.,..u.. b!. 0JDt(.bl. O"tl\KpbL"tI\b


,9Sl "tI\, YrI~bL 110u."tI\ "tl\I1 l1 e pe,ebt..

, ,

el1epb #J.: ', u.I10jq'!'1 l1 ,. )

~ss\~~--:t{
$~SSIot-{['u.s ~
~f <. ......... . .~ ................... r~. ..
//

ceccu.u.

,ec'Y!'1o KYu. I1poepK. "t\su2

110jQ'!'15L

I:I

..$~$~$~N.::rr:~.;. ~

$_SESSION

st O~l-ty~~~ l1epeMe~$c~~~~ION

l"l.o<v,' .aCCu.~J / / , , 1"1 u.dQu.Qe"tl\cst j4l- I"I"tl\.


/ /

.accu.~Q.
~ / (3600 ) ~aHee
..

~f (~sset($_COOIE[sess~on_name()]

//

(i)
2

~. ?~~~.<?~~.i~(~~~?i.<?n_"!I}~,... ,Jjm~..::-..~.9.00)~

$home_url = 'http: // ' . $_SERVER['HTTP_HOST'] . dirname ($_SERVER [ , _SELF' ]) .


header( 'Location: ' . $hOme_url IJ~

?>

430

ru. KY/(U., 4u.U


u.l-t'!'1u.u./(Q"t\ CeCCu.u., "t\"t\,
dst' ., "t\tQu.Qst MOMel-t"t\
u."t\l-st Cp0/(Q . U'!'1u..
Q Q ~l-tee '!'1/(. pe'e.u..

u nuu ee6-nuUR


. .

.. .

,
.

,
, ,
.
sssi_strt

()

$_COOKIE

$_SESSIONS.

,
, ,

.
sssi_strt

()

$_COOKIE
,

$_SESSIONS.

---

.. - . - - ___ .... I':~

---::.,~-::::;_:

,..~ ~~~. . . .:

431

~Bxo .
~. .

,
~--

, ,
.

1ogIn.php

session_start ( )

$_COOKIE

..__.__-

-..

$_SESSIONS .

,
-.10-1'-"-

, ,

session_start ( )

06 $_COOKIE
,

$_SESSIONS.

Index.php

432

nUU8l 6-nnR

' " nIO


, ,

( ),

, ,

tfG ~itG1h.

'; sssi_strt()
,

Zlif11blX fc> o11focoffi


,

, ,
, .

; .

=~s5 ion_s tar t

()

, .
,
=~s si o n_ s tar t

( ),

,
,
.

';
, ,

. ,

, ,

. ,

; .

c;ssion_st art ()

~eCTO .

~;

, .

: .

URL

GET.

- ,

php.

:~ ,

3 ,
we,
: .

3 ,
' ~
:':~He, .

ini

sess i on. use_cookies,


session.use_only _cookies
sssi . us t r ans si d

'; ,~:

. ,
,
,

URL, .

433

3w Jl
..,
, ,

<1php
session_start () ;

1>

. -,

session_start ()

. ,

$_COOKIE

$_SESSION,

~e lA,e4UU,

Ut)JbJ)u
uu,4u4~

bl.JOct J<,

SeSSiOt)_stctrtO, m~bI.

1/ ?..-- ...... ................. ~ nPJl.


i f (! isset (~GESSION(' user_id' J}J> {
if (isset ($_t'USTl' suom~c j J J {
/ / aIOIX
= sqlinnt (DB_HOST , DB_USER, DB_PASSWORD,

DBYIIE)

$dbc

/ I ~.;
, ) }} .
_
5 li real escape string($dbc, tr~m($_POST[ username
,
$user_username - q . -.
($dbc trim($ POST[ 'password' J;
$user......password = mysql~_real_escape_str~ng
,
if (!empty($user_username) && !empty($user....Password
{
11
$query = SELECT user_id, username FRO mismatc1Luser WERE username
password

'$user_username

AND

SA ( '$user""password' ) ;

$data = ysqli_query($dbc, $query);


i f (ysqli_nU!1Lrows($data) == 1) (
np J<a ero
1/ . .

1/ 1iof. ( )
~rnw

= mvRn1;

~arch_array($data);

~ ~F.SSION { 'usr.J: ] = $row [ user_id ' ] i


$ SESSIONt ' uSernam~ = $row['us~rname'~;
I

setCOOKle \ . U!:it::!L_.!.U,

$row (

'user_~d' ]. t~me ()

+ (60'* 60" 24" 30;

setcookie( 'rn'. $row{ 'username'], time()

+ (60 .. 60 .. 24 .. ;

1/

1/

30 '
. dirname ($_ SERVER(' PHP_SELF' J)
$home_url = 'http://' . $_SRVR('~S'J
header ( 'Location:

'

. '/index.php';

. $home_url);

else {

11 / ,

$error~g

.';

44

', ,

QunQuuQz.~nuUR

11 .v"-..",=,,..,====_
if (isseG

~;~.~T~;;;'.~:~

echo '&110084; < h~) ,


echo '&*10084.
VlewprOflle.Php- >
;.-----__~~~~~::' < href~editProfile,Php.>p
nPO </ a><br / >':
/ >' ;

~~~~~~~~~~ <a, ) <href=-logut.h->


1

nPO

. $_

(.

</ a><br / >'i

r. Cll1PC1UI.A,c:\

echo '10084;

echo

'&*10084;

< hrf::::logi.h->

1\ll1ll1u,:D

,ll11l1 1( ,bt.
.91.1. t'IOJO1l11

< hrf=.SigU,h.>~~1l< /><r

/ >';
an< / >';

-g I1pou,ecce J,91u'

11 Jl "
/ / aDc

echo '<h4>HoBble

HL

gu.4J.OJ-tO. .)

u.cI10JJ~ell1 Mec"'l'l\O
ll.~D.
c:\CCu.~ $_:
.11.~.bW c:\CCu.

'

echo '<table>'.
: < / h4> ';
whi1e ($row - '
l'
- mysq ,_fetch_array $data) )
if

~_SISSlON u. ~e
~~btx peWQell1,
,&tgjJ'lI1 .)

. $row['user_id'J . '.>' .
else {
echo '<td>' . $

row(' first_am' J ' </ td></ tr> ':

ou.l1epCCWlK~ l1.uu.

echo . < / tale> ' ;

110,1-WX I')J1"'1'1\u
u.u. -ell\.

/ /

Dvt;:~.

, ..,

....... ..... _ ~

"'

i f (! issc " I $_SESSION 'user_id '] )


echo ' < !ss=logi > I1 ..... _ ..... J '.
'

<

href=-logi.h->

Jl

usern~.

< / >'

.</ > ';

exit () ;
else (
echo ( '

<

class=-login >
'.

<

np

GJ>

SESSION [

href=-10g0ut.h > nP)l </ > . </ >

1,

i f (!emptY($firscname) && !empty($lascname) && !empty($gender) &&

!empty($birthdate) && !empty($city) && !emptY($state))


/ /

if

(!ernt($w-itur

$query

{
UPDATE mismatch_user SET first_name

-gender
'pic ture

else
$query

'$gender'. birthdate

' $state' ,

= '$new-!,icture' WERE

UPDATE misrnat c h_user


-gender

'$state'

'WERE

SE

first_name

' $gender', birthdate

user_id = ,.

'$first_name'. last,Jlame

'$last_name'

'$birthdate'. city = '$city'. state


user_ id

= ,

'$first-am ' ,

$ _SESSION [ 'usecidJ), " ' ;

last_name

'$birthdate', city

= '$last_name'.

'$city', state

,~SION[ 'user_~ ,

435

xoro

yq

, ,
, . ,

, ~.

, ,

,
?
!
, ,

, -
,
,

, .
, ,
, ,

? .
. ,

,
,
, .

, -

-- ... ,
,
.

. ,
,
.

436

n, 6-nR

, -, ,
!

, :

,

,
.


.
, , , ,
. , ,

- -

, .

,
. ,
... ,

! , ,

. , ,
, , ,

. !
, -, .

? -, .

.
, ,

... . ,
,
.
, .
,

?
. ,

- -,
, ,

, -

...
, , .


, ,

. , ...

! ?. ,

437

mm- nuu u) u

--,IJ,
nJ ., lO
nlt0 .
. ,

www.headfirstlabs.com/books/hfphp).

index. php,

login .php, logout .php, editprofile .php viewprofile .php , ,


session_start () . ,
,

$_SESSION

$_COOKIE.

-
. (index . php) . ,
, .
,
.

mu. 1en

e.xo()umb

. f1U~U, () u

. o.Y3fj? mlO~
f10()Vfj? KYKU.

l
J
438

nu ee6-nR

cn . n ry

php.lnl

ycaHoneH

n, nlO J

MOry n.
.? ,

URL oz . n ,
session.use_trans_id h. ini 1 (tru).
, n ,

URL .? , n :

t)..ddJ1. \1...

S10

.9. Jfl\ u..9 .l\u.Uctl\ tt,

KOl\OPbt.U. t)..9l\. cocl\ae.

UR.\.., YIIbt cu,eapu.u. a:l1poCMol\P

t)u.. . t)u.l\ .9 0cl\YIi


.9a..bt. t..

439

0 vv

- ~

, -
. ,
,

~Bxo . ,

...
.

d,30d\:0dl-U-l.Wi
t)30~d"ll'\ -

"tI'\ .d
.

()

} . "11'\0 coodUJ,el-llJ.,
KO"ll'\0pOe nv....l-llJ.

: ecoo"ll'\e"ll'\c"ll'\uSl
9 0 ''.

t)oc~"II'\b cou
t).3od"ll'\J.\.

nJd"tl'\ll

I-lC\Wlll, "tI\ o.u.


b.uu UJ t).uSl,
. "tl151. l-lC\ - "tI\

U . -d.Udll

.90 Zllt)btJ1I :l3bu<


(.3 1') ...u.. .

440

u nuu 6-nuu

, ,

?

-
?

.", ~

.~

v ...

. ,
,

, ,
. ,


, .

, ,
.

,
,

..

~XO.9 g Il..u g d.
Ull'0gqu. . Ilug.9 U11
1(

'.9 {u)

ll e peMeb!x.

.9du.
\')epeMe..bu<

ceccu.u.
\')pu.0.9u."'II'} btx0.9~
\').jd"'ll'}Sl

UJ \')..u.5i
.duu..

0"'11'}

"'II'}OZo,

n!.

,Yl\ . !\,

ceccu.u.
n1vrl51
Mec"'ll'}e cdoo.
ceccu.eu,

U~~)

I<O~.9d dj
Jdl<btd"'ll'}.
nJd"'ll'}
JdJ<pbtde"'ll'}
dfd)'Jep, . ..."'ll'}
u . crt\.9dd"'ll'}b
"'ll'}"'ll'}d "'II'}~

'-h\o . bt.

"\ I )
- _. &o,n
'.
. ~
-'- .
1[ I , \

UJ t'!...u.
, ,
.

, , , ,

yga.snom,

ceccuu
Korga

, , . , n..068.m.
?

. ,

npe.palljae1n

C593U

. , !

81589 spa.

442

tJu ntJuutJl ee6-nuUIl

...

~---------------~

'

, "!\, fte

.9 0"!\,,"!\ .90., '''h\ob!.

6 ,

t1 u"!\ > cu.

,
. ,
,

6,
.

--

~-.

........

.......

. ~..-""'"
.....-~

~"I<

1<"1< t1pu
l') "u. ,

,""!\

ced.p ~XO.9

t)u.o..u..

.. '
~-jU ::J)O"/'l\

,..aJbKO 'VI\OZ,9d-,

Z d

,:<1d"'Vl\.

.. 9"UG1I\t. ~

,
,
,

. 'VI\"JJ.5!.
K::JKlA t1 .:m ..
WJMeK'VI\oM U'VI\JJ.5!.

" ux i1'VI\u..

Kyu ygagtn.
orga ucmeaem .

ux get1ctn5U9. .
ux cyect'11I5aus
SOUJe. 5.

cyecmoaus

nepeMeHHblK ceccuu
~

443

Unn308u 8

em, UMUI11
Ul10~m u ceccuu, u KYU:? llru m KYU
1103~UU 110~m> )(ratlm ~O()He
QatlHbIe Qumu l1erUO() ~reeu.
m )(Or0\.1l0 rm () mex 110~m
KOmOrbI)( ~> QQer KYU.

Yl\ex \') \') b!. .. u.eeYl\e J1d.


bLCOKO ~YI\u.YI\.btu. dJ-tbtu.,
u.t"\ 30 dI- KYKU. u.eeYl\ \')..bt

\')u.YI\d \')0 .:I-'IO


u.\')30dI-. ceccu.u..

Il. r

"""\
~

nlloxoro

On0 ll

, , en
IIJ ll r.
.

: ,

.
,

.
,
,

. , ,

,
.

444

Q7

nnUU8l ee6-nnR

~o..9o. t)~J.-JJb

, , .

~~~ ~eh:~~Ku:

I1[.

. , t)~fuco.uo.

, :--n. \*"

__

._._.........
.-..---

---

R_

}())}5{

U.g e h.- UWUl<.- Od

d.ll, o'Yl\c~o..

t)J~-5l. 1. ~
tA..e.

_ _

npu J.bt- u

S... t)epeMe..bte

.)O'YI}5{,

I< oc-o.)O)Jc5{.

........._-

~ ......

---

_...- _ _ _ i- >

a!-lbte t)Jb,d'!\e5l t)uu .


COxpa.e}-l.b1.e

K~K, U\l:>,JIYl\5l 5l '!\..

-m6dbt. occ'Y!\d.DguYl\b ,.ct .u.5l\l.rtbtx


:.,

\fob!. . <:\.'Yl\ .bt


d..bt ., I<::I
CVI5{ - 5{ J

30 .

t) .. t)J.- 5{
t)u..

8 ~

445

8 ,

lfG 8bl~iiG'I,

Z1)t'\1blX ~O'\1oco~

'9; ,
?

; . ,

, ,
. , ,
, , ,

. ,

, ,
, ,
. ,

,
, . ,
, ,
.

'9; ? ?

; . .

, ,

, ,
. ,

,
.

'9;
MySQL?

; .

. , ,

.
. ,
.

-
.

446

QunQuuQZ8~nuUR

Marutnbl

. , . ,
, ,

.
.... f (
1 / /

l' num rows ($data)

==

1) {

:~~ :~~ rn.

/ / ( )
$row = mysqli_fetch_array ($data) ;
.
1 . user id' J = $row [ user_ld' J ;
luser~ame J = $row[ 'username' J ;
~~t~~~ki~i:~ser_id'. $row[ 'user_id' J, time() + (60 * 60 * 24 * 30));
/ / 30
setcookie ( 'username' $row [ 'username' J time () + (60 * 60 * 24 * 30) ) ;
/ / 3
[ ' SELF' J) . ' / index. php' ;
$home_ur1 = 'http: / / ' . $_SERVER[' JS' J . dirname ($_SERVER
_
header ( 'Location: ' . $home_ur1) ;

<?php
/ / .
/ /
session_start();
i f (isset ( ...................... [ 'user_id' J)) (
/ /
71" ~~SE:SSION '
= array();

/ / . .
/ / (3600 )
if (isset ( ..... '" ...... .. ...... [session_name () J )) (
setcookie(session_name(). " . time() - 3600);
}
/ /
session_destroy();
/ / ,
/ (36 )
set c ookie( 'user_id'. ". time() - 3600);
setcookie ('username'. " . time () - 3600);

<?php
session_start();
/ / .
/ /
' J ))&&isset(
(
[ 'username ' J ) )
. f (1 isset ( . ..................... [[''user_id
1.
l'd'J)
if (isset ( ...................... user_
.................... ..
......................,

er id' J

= ...................... [ , user_id ' J ;

[
_
[ , username '] -

...................... [' username ' J ;

?>

447

PHP-zumbI u

Mart1tnbl

, . , ,
,

.

"if (rnysqli_num_rows ($data) == 1) {

llI

1// ~;:==::::~:~~;) ~ :
_ - - - - - ' \ .. fetch_array ($data) ;
.L.ii~L~~sr_id'] = $row [ ' ~seCid' ]: .~
. sernarne'] = $row[ ,:,sernarn.e ] ,
(60 * 60 * 24 * 30));
~Ii"""". r_id', $rw['sr_~d'], t~me() +

v.t')....u

1< t')epeMe.bt, .
0.30\!.. . K\lI{U.
~

/ / 3
,
.
() + (60 * 60 * 24 * 3 ) ) ;
setcookie ( 'usernarne' , $row [ 'usernarne ] , t~me
/ / 3
. dirnarne ($_SERVER [ , _ SELF' ]) . ' / index . php
$home_url = ' http:// ' . $_ SERVER[ '_S' ]
header( 'Location : ' . $home_url);
}

<?php
/ / , ,
/ /

1"

~;s(siisOsn;ts(tT $:SESSION user_id' ] )) {


~
/ / is&

ni:;;i;:g:J::;=~;

/ / , ,
//

l :~;-~~ ~ ;~:;~

(3600

(.$_()I~[ss,s,i...arn() J)) { ~llpu bt.x. I.I3I1uJI,tW.


setcook~ "'.'.11 .' ,_ "'" () ,
,t.~me () ... 3600) ;
} 1'I\1e.l1epb 'l'\~'l'\G. .9d.5t'l'\

i f (isset

/ /
session_destroy () ;

\ K~K, .9 r...,u
dK
u. .1Ilwpu.d1l\' ceccu.u.,1'I\
u. ~b ~ Kjl<u..

/ / ,
/ / (3600
setcookie( 'user_id', ", time() ... 3600);
setcookie( 'usernarne', ", time() ... 3600);
<7php
session_start() ;

pu.coe.u.e Jl-i.d.u. t')epeMe.bt. .

u.ct')oJJb.3 0C\.u.eM

7>

448

nuu 6-nR

--
'n]l( ,
,n , .
4 ,

, (

www.headfirstlabs.com/books /hfphp).
index.php, login.php, logout .php,
editprofile .php viewprofile .php.

4 (index . php) .
, .
, . ,

, .

U,.1\
,", 3 0d1\u
t'1poclYIO . )v\-'jYf\
'"'pU,UlYIU, .
01\ .34.u. 1\, ~

KaK3de d1\ .
dU,.LA,Lt. .
U,u ,",o,U.1\

O~
/1/

I10Jct.u. ).
.9 '-I..u.

<.u,U,t.V1."'r)
ceccu,tA

. ,",."'r)

"'I1eM 110Jd"'l1

'J KO"\)Pl:n. 110.9.9.~


. "\)). ...

l3bt -bt .
I"Jbt-..

449

& MYSQL


ll

MHoro HOBoro

MySQL

n lIll

ll .

ll ll
.

$~COOKIE

~1t'}:.q l1.JJdClJlbd.;
'
.'.

l1 4 ,

.~110JJbe..ct /1l1d
CtJ-tbI. . m\
"
f'JJ. .lJ/1

-d.ccu.o, .9dbLe
I1 /1\.bt \ .

.}./1t. 'rr\
1J1yt1\ l1JJebt,
CtJ.tb!: .u.
U:l1JJbctlYl u.

Yr\i'l')/1>.

I{\ tl.l{ .}/10 -d.ccu.e.

~'t1\ f J-U1St

l'r.~\.. ..

, u.I103;t~

~~'t1\;tI1\ 1( ct~ ceccu.u..

vi)\ l'\epeJv\e~st .st1\.

. J.u.gJ, u. ~

I'\ 't1\\l'tbt
1(<1.1( . .}.'t1\bt.
lloJ'moJv\;t -!J5t .90c't1\~I'\<1.

l'\.bt. ct.bt.

.u.O u.I'\3~1\
lJ,)fJ.. O"tY\1f\'t1\~}u

l'\epeJ.\eti.Ou. K<1.Kw-+:9 .

mJv\ Pdcpu.e,

450

~~

u nUU8 6-nuUR

-+
~,.O~~~

~ ., ,
. ,

, .

/MySQL-

,
.

setcookie(session_ name(), "

time() - 3600);
,
,

SHA('$user-sswrd')

,
,

session_ destroy()

setcookie('user_ id', $row['user_id'])

, .

$_ SESSION = array()

session_ start()
.

451


~, ,

. ,
, .

/MySQL-

,
.

setcookie(session_name(), "

time()

3600);
,
,

SHA('$user-sswrd')
,
,

session_destroy()------------------

setcookie('user_id', $row['user_id']) _ _-+1'--_

, .

__+ t - - .

$_SESSION = array()

----------------~
.

session_start() ______________

452

7 %j'c11bfa.lfClfU,C 81J\u,f~.lfL4JI 1;oga.

n IftnOn"30BOlllfe

JrJ60r

' nrI, ()rra.


n.3 O()UH .30HtnUo u
Hw6xo()uMOCtnb UMe.ttb I'tn0rou:
06 n() ()() ... U tn.

7tnf.
UUUtnf. .
11'0 tnwru col'Mf.CtnHoro
Un.30I'u .30Htnua

nl'e.tt l'o.3tn 3)3tn

n06u )3tnf. nr.

. - ,
U .
: rn n
n, ,

, ,
, .

ero COBMeCTHoro

n. , -

, , ,
.

453

. , .
... .
, ,
.
. , L-
, , ,

Howe ew coo&ecal:

454

Q7~

.......

_---_

:..

_-_

.....

..

...aarc.u: Jlter.J

on

....
MyEl<Oll
198111.())

....:
n._

...... -.....-...: A...... ~.

etnt1tl. Peal1lpoaHe +ll.

455

6nUUR nuu

. , .
... .
J(

ynp~ , ,
. .

, L-
, , , .

3~

~~~u
l'\.St~.

d.90U
c~patw.u,e

:fI..)OI.eu

~U .

"" ..... 1C.IrtU.: _tw1'JJ


111 ...:

onrot

"';
IIL..

..' .coI

er.T.1

.9 t

,ra.-.--.:
-...
........... I~I . 'J.QJ

O~ bto.9v..O.

~~-.

K~OPO. 3dul.1~

_~

""'~"",_e ~"'i"';"
iii~
~ ~~
~~'~~?~~
oo
cex c""'~.u,.
. 0.9 Ut1 1(

YiewproIIe.php

Hu..:>IU-U .~I.1~:1

.9 )I(I.1U

u.cpo}ldup. oS \~I(u.x
"'fC\<, ~\ ~I.1U .
~pat,.

... .

-'

~
~

... ... ... ,

r:;;;~========~ _~
"

~ . . :J; ;,. :; ~ ,

' :; _..... .... .


." o ,j': .

456

7*

-...

JlJ )
, ~>,> ,
~OMeHT . l\ ?
llll . ,
,

? ,

. .
, KOl\a

. , ,
. ,
I-l<
.

header . php

,
,

, ,--

heoder.php

L-

-
,

CSS.


navmenu . php
,
JI, ,

.

~

startsession.phP
,

statsessn.php
.

-~~~~----------~


... ... ...

ll

... ....

_---- ---

footer. php ,


, - .

header . php. header . php


footer. php, ,
.

457

nuu u

6J J )

J w6
, ..

IIIaSAOHbI nmt.t\9tn

cmgasam
, ? ,
, .
. . ...
, u MOOp.mo
,
UCn

-nueus

.
,

, .

,OMnoem06.

.3ct~ 110."r\

.., ,

<:t. t\O"r\u. <:t:.

l\pctuLt I1....u.

,
, L-,

,
, ,

, .

"r\"r\"r\ .
.9.l\U~ ajd..u.

11 u....u.. .90110..

aj<:t.u.eM Ko.pe"r\.o

C"r\p<:t.u.upt.

(-~
K<U:9 0 \lQu.ju.<:t..u
c'YI\p<:t.u.u,e t\u..u.

Hecoo'Yl\e.l\C'Yl\u.5t .eox0.9U
.9 ~XO.9 t\u..u..,
'-IYr\~~ 'Yl\~l\ l\.u.
t\ 30ct"fl'\..

('

ncnenJ~

H<:tu~<:tu,uo.oe
.) 110"r\
cpq.3Y j<:t j<:t.

u I1.90"r\<:t"r\ ceM

.UU."r\U"r\

bt0.9 l\ .u.Y <:t:.

c"r\pct.u.LA,Q I1..u.

l\l\"r\
e.9u .oodpq.3oe .) .

"r\<:tuLt J-o\c:\u,u)

<:tl\OPCKUX r,p<:tctx.

l1epex0.9<:t

:. .u.u..

~~
~ j~.\:tl\e u.t\.j<:tt l\<:tKO~O ~,w~
u.l\<:t .90.bLx cu,eapu.e cu,eapu.)O

'f*'e

i l1 dex
l\<:t."fI'\ l\, ..9Ol\u."fI'\
coe. ..9u.."fl'\..U u., Ol\ect

j<:t)<:t."fI'\ ~0.ge t\... .obu< .o


458

7~

~l\ct.

IfG 8J~a.G'}h,

6411JblX ffi o1Jfocoffi


~: ?
?

: , , - ,

. ,
,
. ,
, ,
,-

, ,
.

~:

: .
,
. , .

.
,

, ,

459

nunu HecoomeemCmBUR)) n !

6J J ()

J w6

Iu. t)epeMe~e
.

, ,

<?php
session_start() ;
// ,

if (!isset(S_SESSION['uSer_id']
if (isset(S_COOKIE[ ' USer_id']) &&
isset (S_COOKIE [ 'username' ] { ,
. ,.
S SESSION[ ' user_id'] = S_COOKIE[ ~ser_ld ~: .
$=SESSION[ ' uSername ' ] = S_COOKIE[ usernam ],

.\ Kc\Cl(obte

"'II'\\uup. 1\u.
t) u.,.I-..

< !DOC html PUBLIC '- //W//DD XL 1.0 Transitional//EN

?>

htt : //www . w.rg/R/html1/DD/xhtml1-trsitil . dtd >

<html xmls=htt://www.w.rg/1999/xhtml' xml:lang='en'


<head>

"--1\..

<meta http-equiv='tt-' content="text/html;

u. (~t1\~>, 03'C\J~)u.

HTM"--JC\.I< e.

<?php
echo '<titl>.

CO.,9C\ue JQ.I(\ I(.."'II'\'U


"'II'\\uLl. ~u
1( ,QJC\u)() t)u.l-.
QJ\I-. COO1\e"'ll'\C"'II'\'y)O(.IJ,eU

7>

1\\uu,bt., I(o~opoe Gu."'II'\G

<7php

t)epeMe..ou $Q_..f..

'

. $page_title

<link rel="stylesheet" type="text/css" href="style.css" />


</head>
<body>

7>

echo ' <h> .

'

. $page_ title .

'</h>';

<7php
//
echo ' <hr />';
if (isset($ SESSION['username']
{
echo '<a-hrf="id.h"> </> &#10084; ' ;
echo ' < hrf=viwprfil . h"> np</> &#10084 ;
echo ' < hrf="ditrfil.h> npo </>
echo '< hrf="lgut . h"> np (' . $SESSION['username'] . ' )</>';
)

els:c~o '< hrf="lgi.h"> np</>

&#10084;

'.

h*> </>';

echo

echo ' <hr />'

7>

npoepl(C\,
t)u.u u.u. .1\,
u. .\ OC.oC\u. 1\W(
tbtx GOJ~C\ue .)()

"'ll'\"'ll'\1\~)O(.lJ,. COC"'II'\C\C\.

460

u.t)Jau/.

bl.\

w(

I('.

, .

o-m 1( pbt."'II'\

'"'ll'\\.obt,
t) OI1bt."'II'\I(C\ '"'ll'\\.u..,..

l7~

<hr />
class="footer">Bce np &;
2008 , .</>
</body>
</html>
<

/>

u6uQUR

Cu.,e..aeUu. startsess iOI'l.~p .9o.J1Jl(.eo


dbt"Yl)b ).. cdJA,.oM .d.
'YY\o~o. "hr\o~bt O'YY\l(pbl.'YY\b ce.ccU)O
u I'Ipe.90c'YY\au'YY\b cu.,e..apu)O .90c'YY\yt'I
1( . .9<'bI..

l1.... $pct~e._tit.te ",.~.-m

~o '\pctlu,bI.. '\'IU. d:'J-m


"'u.u... 1( ~..'j Jd~:'J
1'I~Jl(.eI.

<?
/ /
equire_once ( startsession . php' )

..bt, ,..u t)ctpa.e'YY\pbt


,tu dC!JOU ,dbtx. u u

/ /
$page_title = ', ! ; ll e peMebte. Ilu.u. )dI<rn\
ire_once ( 'header. h ');
~/ U3 d-..t::it.x rh-1u- 00
~
,~, u t1.
require_once ( 'appvars. php' ); ~---require_once ( ' connectvars. php' ) ;
HdU.Z.4u,uOWWe. ..) &u.'1'\ \i

//

~ 34 .Q, \-l l1 oc.oetWt. ..u


c-m l-lli$

/ /
$dbc = mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD,

DB_NAE);

/ / ySQL
$query = SELECT user_id, first_name, picture FROMmismatch_user WERE first_name 1S NOT NULL
join_date DESC L1M1T 5";
$data = ysqli_query ($dbc, $query) ;

/ / ,
/ / HTL
echo ' <h4>HoBble : </h4> ' ;
echo '<table>' ;
wh ile ($row = ysqli_fetch_array ($data) }
i f (is_fil(_ULAD . $row[ ' picture']) &&filsiz(_ULAD . $row['picture']} >}
echo '<tr><td><imgsrc=" ' . _ULD. $row['picture']. '"alt="'. $row['first_name'] . '
!></ td>' ;
}

else {
echo '<tr><td><img src=" ' .
!><! td> ' ;

_ULAD

. 'nopic. jpg' . ' " al t="' . $row [ , first_name'] . '"

if (isset ($_SESS10N[ 'user_id'])}


echo ' <td><a href="viewprofile.php?user_id=' . $row[ 'user_id'] . '" > ' . $row[' first_nam
'<!a></ td></tr>' ;
}

else {
echo '<td> ' . $row['first_name']. ' </ td></ tr > ';
}
}

echo ' </ table > ';

?>

461

m 60m -nuu

fOJiJAO
J ((R) ( J .. v
30

.9 'Yl\bt'Yl\Lt.

ceccu.u
.

Ull~'Yl\.

, , ,

.mOdbI. cu,e.apueM

I<O'YI\PM~
.eo~x 0v..bt

() -,
.

- ,

.bt d..bt
3 0<\'YI\..

, , ,

, ... _ ~~

Cu,e.apuu stc:\rtsesSiOIlP1p U"l.~'\ Jc:\ cu,eKou /,,1'\')c>ou,e.9ypbL 4 1I0~Q'YI\. ~ _"u ..u


II ,
u' . zef.{epuoye'Yl\ .u1(c:\1(0. uu..u ~~-'Yl\fc:\.uu,bt. I I
3QZI<

'sblsessioel-Pt1>

):\ "Yl1

C"Yl1c:\K.9c:\p"YI1.bte

'
I

,
\

jI.

HTMt::-"YI1zu
J:\ZI(:\

Hc:\uzc:\IJ,U.o..oe ,.)
'l1.9 0'YI\:\. "Yl1
\

~ I"IPOC"Yl1 ozo u )'~.z.


.90C"YI1)'1')4 1< ZM.bI.

6'eS-'Yl\:\-uu,bt

ZUl')bL.U 5.!

u J:\ZI(

Q'Yl\ I"IU....u..

"Yl14.uLt.

~
_:""""'......_~~ R.

.._

.... _

.'YI\U'Yl\

C'Yl\P4 .uu,bt
u'Yl\

0-

<

.- - ' ""

...:

=:;:;;;;;;;-----,

...

.....

.~

""".; -h:i.~==""::""~)- - -

: : .....
,
.:~-=...;;..;;;..~

c:\'YI\0PCI<UX

I1Pc:\QX . cez.o
I1u ..u. ... tU
C\ .~u..

...... :&.~} IS~.~

UjMe.u'Yl\b .94)
uKcpopMu,u.)O, 1\0

__ _ _-

... CgeM'YI\b
'\ g .9.,

....

footer-Pt1>
QQ7~

....._ .... _ ...._

JIO'Q.8::;;I98;I.-;-;II-;:::-~__...,.::.:~~Ij

u~OPMIJ,U.)O

462

..._

"'-.:
198\ ~.:==:~~~~==_R' __ ' _ " ' " 11_ _ ......,
...
.. ..

u..uu

Mec'YI\e.

..._

....

....

j'11f~J\ffii,th,G ~u,1u, g;111 tf1u"

j'11f~J\ffii,11t,G tet~;uou,1 ~rlC 1u,~

C60~ tl. RtlHHblX--f~o , ~ ruuu,


~[vu yn~u VaHHbIMU. ~

COpmUpyto [, ~bIoupato
:u, CeuJU~ato ~ce .J.Ju
u~ <> u KYKYrf3bI u...
toV.

, .
, , , ,

,
-. ? . , ,

MySQL

. - ,
, , . ,
... , ...

, . ? MySQL-
!

463

nuu/u

J n
.~ ,
, - .

. , ,

, .

u...u. .
l(z.~-.u.d.
1). coezo

U &.
("3) -- &om ra<>ocmb!

u.c1)ep~ ~e~~,

t;!'t')' (m!'W?3Q Uyl'er, m


Hem Uef uHmerecHu "ymewecm&uu...

. . 1)

t} 0. 0.3.u., '-hr\o
. .u..u.1)

'"

pecv1U1T)u.- 1)~I(

llo..u.lI\e 0.9u..ol<ozo

u.b., I((

zd,u.~.

l(ozo-.u.d.9' 1<11\0
e.au..9u.lI\ lI\...)()

!:\ ~u.1) 1)U

1)~bte

:mll\u.

t}.~u..

lI\al< .

cu.Jb.o, . u.lI\ ?

an-w

\ ..__
??

--III!'!!'!'-~-r..

Ct}U.COI( t}u.1)~1)u.t1 u. 01)~.u.

Cu..9.u. :. .1)~1)u.1) 1)~Ku.. ~

Ct}U.Cl{oM Zd., t}uJll.A..4. 1) t}Qj)'y

1)..u.)() u..<tb.z .1)1)1)gu...

464

ie

, ,

,
( ). ,

, . ,
,
,
.

CX0.9bt.e I"\pU.jMKU.

..OYl\1\1\u..

CZP~I"\I"\U.POd.bt: Ml"\pu.ep,
1"\ p'U.jMKU., 01\..u..

oew.oc.-mu..

d:91.t1 U-..9u.u.q'l<tf1bbt.u

I"\pU.jMI{ h.ecoo-mt'e-m.-mu..
-m u.e-mb 3 .u..

l"\pU.C-md"'tl1u u.d

(tOYl\d.u.., u. . .."'tI1
d.u.d-m. 3 .t.l5{u
"'tl1ux I1pu.jl:\l{o .9z<
t)jf>'d-m.U.

,
..

465

Q nuu mmmu

.n 'nl ()
, ..,
, ,
. ..

npUJdKU.

KC\)je~opu.1.A

.ecoo"Yl\e"Yl\c"YI\WI.

. . . . - - - - - - - - - - - - - - - - -- - -- - , u.t).3))} .9 .5t)O'/l\. 0.9tu.


~t)l1u.\.u.
u3 C~ j1I\.btx

w= ='
,t)0.90dKbu< t)PtA.3/{C\l(o ~W< I'\u.o.~

t 81li1f'i8Q~

.)j)j)ju..

3i Aocyra

l'\.od."YI\u.

'"

3 ,,
_

,..

.9..

',

/'" . c.OO1\e1l\GlI\Y)O'/I\ .9p~.

u.e.o

o.u l'\.95t)Q'/l\.

.1l\1l\"YI\v..
1I\d.K

!/'

tIJ"".IIII.!!!!I!'!II!III!I~ ,

"tIII_ _ _ _ _ _ _", .

, .

( ).

KC\~O~O ':L.3 I1PI.AJ d I{O


.)})j)ju. O)}e)jb!. ozy
t) PI.I..tJ.4)jb .9/{ tA.3 .9'jX .3d u.
(t)pu.c)jpCIc)ju.e u. "l'll~fC\u.).
?
Ou. .h}O'/l1 ~u.u..9\.btu.
,

.9 1{c:t.:90~0 t).30\

. ,

t)I.A.u. .:"l'll"l'll"I'IIu.:.

, .
. .

epl"le"'ll\b

~ . -J

-.(.,-

~~~=!J.
, 1I\ u.u. . )Odu."'II\
~bt .. \ ~
dOdOP0"'ll\. < )Odu."'II\, t)pu.0.9U"'ll\
."'ll\"'ll\"'II\.

466

ZQQ8

6aJbI


~. , ,

, .

,
, .

-u),
ogmuux.

,
, .

cocmas

eti gaHHbl]\.
6 gpyruu

!>,

Onucaue ose06
(tna5AU\J ux.

CfaaU lU

mi m tch_user.

osemau

U
~&
.

::~~

mismatCh':'user
user

ido--w"

username

ux.

uogctnU9
~ "1 u.g
:J1<.cJ.b&c:\e)J I-td. "10,

nog

'-h')o i(J{:\

password

5(g 5( "15(

join_date

t)ep gu.ht.

first_name

g)J :\du.u,.

last_name
gender
birthdate
city

state
picture

OC"Y1c1J1bbte J(u.

I"\u.bt "VI\oM
I\.9, :\
I- :\I"\bt

C"Vl\pYK"Y1ype "1:\u.u,bt..

gue guarpabl
tna5AU1jbl nAgeln

omgutnb


.1 , .

, .
,

tnaAU1jbl

,
. !>
...

om

]\

gaHHblK

467

u QU Q3 mismatch


/,
, .
. , , ,

, .

--------:-(-t--g-~):--' /~ ~~ Kobl.e .9d..bte, e.ge.bte


(to

t> t>Ju. 11 "l] .d. .eox0.9u..o

011 .u.d.11 011.u.


t)Jd.11 '~u..bl.

response

t) pU.J.ctK d. .eCOO11e11 11USI.


~pMe t)u.11pct11US1. UJ1U.

mismatch_topic

011d..u..

"1f
I

I
I
I
I
I

468

zn8

11

101

"

102

11

103

11

104

'

11

-w

.~

.4

t4f

102

104

JI

11

8,

469

tluwtlR mismatch


/,

'"~

, .
. , , ,

, .

:9 ce~o .eox<?9u.o O'Yl\Me'Yl\u'YI\b, vrt obt.u .!OYI1.

'yI\<o .9d.t-tbL. ~e;ry)OUJ,ue 0"iY\ 110j<::!.'YI\. O"iY\e'Yl\d. f)'OI1POC.


l1u'Yl\d.e'Yl\ . I1PUC'YI\ dC'YI\ue uu O"iY\pd..u 1< l1..bt.
I1PUJd.I<Q . 'Yl\'YI\u.. 'YI\J: ~e &je
'YI\d}O'Yl\. 110C'Yl\O~. 110 I<fd.u..eu. . 'YI\I<U
I1Ojd'Yl\..
K"'f\O

CKcIJcVl. 'tf\O

I1

"'f\eM

j? ~ .J"'f\ou. 3 dtSt

I1Pu..3dK o .eCOO"'f\e"'f\C"'f\u.St

pcl.)'!\5t coeu CO~C"'f\e.oU


"'f\d.~J.u,. O"YI\.9,, 0"'f\ "'f\d.>.bu<
.btx. d KO"'f\0PbI.e o.u.

.110"'f\. . J.5t)O'Yl\.

3qecb .e"'f\ .u.KaKo~O ~Ud.tSt.


C~5\.Jd..o~o I1Pu..3dKd./IIIJ.
.eCOO"'f\e"'f\C"'f\'u.St. "'f\aK

110,30d."'f\u. c5\.Jd.bt.e J..V.'.U

Ilpu..3dKU .eCOO"'f\e"'f\C"'f\u.St
u Kd."'f\e~Opuu
.e

"'f\d.~J.u,bt.

I
I

d,dUu,a 'YI\iS'Yl\d,t~_resp0l'1se

i1\d,u.d.'Yl\ .j :.
t).30d.i1\ u. tlpU..3d.KOM
.'t\'Yl\"'f\u. j I<u.
u.seCid u.
id.

470

I"\:\ u 51.

coxpdS\."YI\b I"\pU3dKU

."Yl\"Yl\"YI\u..
u Kd"Yl\ez.OpUu, KO"Yl\0PbI.
.7'YI\U I"\PU3dKU O"YI\.oc5I."YI\C5I.,
"fl9.u. "YI\d~u.u,,
. "YI\z.d d. I"\ u "Yl\5I.

Jdd"Yl\ JdI"\UCU
51. ct.:9 0 z. 0 O"Yl\e"Yl\d.
m bt.~U"YI\ dC Jd"Yl\

"Yl\btp .3dI"\UCU 51. ~OZ.d.d,


1"\0 .u. d ct.:9 bu1
ez.o o"Yl\em m I"\!

471

6 mismatch

[ li

.
,


.
, ,

u\i

tnaAU\j, Otnopag

J.aetn9 - If

nutt

mismatch,

mismatch_response

, , ,
.

gpyro\i tnaAU\jbL
nu..btil )
u.\10j'Yl\. . 'YI\

. 'YI\., '-h\ob!. u.>


n o..u."'I! , "'I!U
U
bt. OdOJC\ d.u

usename

password

t"] . .bt

}?

u..'YI\u.u.u,ud.'YI\ \1 RU.jd.K
.'Yl\"'l!'YI\u.. 'YI\d.u.u,
'YI\iS'YI\d.id,_topiC, > 'YI\d.

'Yl\d...u5l

c5lJu. 'YI\d.u.u,u.
'YI\ iS'YI\d.i<1Lres pO\1se.

responsejd o--tf
response

gender
birthdate

city

category

state
picture

mO"'lJ ~ \10KG\3btd.e'Yl\,

'-h\o J(d. .'Yl\.

.eUll-\.l..l... ), KO'Yl\opbt.il

bUlo.'Yl\. d. \1!&u.btil
I()O .il "'I!d.u.u,.


.

u uospa.
u ulU

n5 593 gy

tnaAuuau cmauae

. ,

, .

472

nUjb nu

ei1.

nRum , n8Rum

. , ,
, .

llu.btt1 ). I-U( useCid. ~..u ). .J< user id


. dbt."I\b .<.bt
jU:'IY\ "l\ !..u ~ .

~ 'f\d.uu, "tI\iS'f\ot~_user.
30 t)ucb t) 00"l\. "I\uu,
d.'f\uu. .7"'IY\OM 3d.).'f\. "I\iS"I\ot~_user. .9d.0. o. 3d."I\b.
0lQ u3 . <pYI-U(LJ.t1;
t) 3 0 0'f\ ..,.

t"tI\d"tl\ .<db.btCi
'..l."tI\Uu.I<d"tl\

.9Obt O"l\e"l\oJv\.

jdt)UCU

t!d"tl\..

llu.btCi I<).
l-U( topiC_id.

UYl\ "tI\
.u.d.b..

u.."tI\U~d"tl\.

.3dt)UCu. tpUjd.Kd
g "tI\duu,

Yl\iS"tl\dt~_topiC.

mismatch_user

mismatch_ topic

(
Jbt."l\:
1(d:9d.

.3dl1ucb

~ 'l!10U "I\dduu,
)/(.U"I\

.L""t ..

lJd'f\..

:\<1~d. jol1ucb 'f\


.,,-,.duu, u"tl\
:"T.. e'f\ KOl-U("tl\..

-)]lb 3 0d.''tI\. ()d

-'3

jlQ .u.u.

~ Pu.c"tI\ pdCYI\ue!
o-m d.u. ) .
,

mismatch_response,
.l0 ,

-:- :.smatch_user,
mismatch_response.

user_id

.1


-l ,
.l. ,

..u. ). l-U(d user_id


"tI\duu, "tI\iS"tl\dt~_respot)se.
C5tJbtde"tl\ 3dl1Ucb, r.~)

nplI

UKcpopdu,u)O t)PU3.dKi:1.X

;ia .. ~ :

"tI\du.u, "tI\iS'f\dt~_user.

.10.1 .
Kecod"tl\e"tl\CYI\tJ.5{ 11 0 jd"tl\.,
u , jdt)u.cb)O .7"'IY\ozo 11 0 jd"tl\.
;!

473

nU, m nerl?uu

Ul?HeUJHUU U l?:>l?m mu
()rryr ()rryrOM, UMUI11 U -
u l? mu ()ua'1'aMax nrl?u
mr, >UtJ.IU U:?

, 8ll n r ,
6n . Apyr Apyra.
,
, .
, :
--, -- - - .

6 8J8 MelAV 060


V ( J 6
COOT8eTCT8veT J v 6))
, -- , ,

,
, . , "I
.

"nu

TJ......

, ,

, : ( )

, ( ) -
. l ,
. user_id

,
. user_id

8"i1"iI

"- ~ 0"_

"3 3

u..--..,

mismatch_user_log in
9OW"-' ioin_doa

. #t~~'''~,

2008-05 ...

08447 ...

10

60n

2Od ...

2008-05 ...

e511d7 ...

2008-05.

062.40 ...

2008-06 ...

'10.'

?08-06 ...

111'")

l1"
13

r--...e6

I'\"IY\

rtu.KdKOU.

;~u.

....

mismatch_user-profile
Iast_ _
user,..prolilejd

e>-ow

fint..:n-

XncoH

?!' "II'\u.u
"II'\duu,au. u."lY\.

...

user_id ,
, - .
-
.

474

...

(11)

...

J "II'\Ut\d u...--...

/'

/r7
./

10

J
116"11I

L#

(8"

---...

....

~.
, --.

..

-- ,
,
.

.

( ( ,
. . ), --

, ,
,
.

13

b4f283 .. .

103

11

104

11

If 5bJ~.e't1u

r-----.+_,

'9: ... ..:j!~:.~!~~~~~~_.

L......t---""\ n --r, n0?

:
- , --

, , . ,

Ogu--ogo.
m.
oga anUCb

pogumeACott
ma5U1,Jbl

698. ogo
at1UCO

gepen
ma5U\Jbl.

() ,
, , ,

mismatch_user

Oguh--OUA\:

oga u

() --.

pogu.'tt


, ,

, -- ,
.

, --,
. , ,

, .
--, ,
,

tna5AU1.jb1

698.

ectn50

nUceil
gepen
tna5U1.jbL

, ,
.

8 ~

475

8 --

r-...

( --

~;zJ1)lj:i~tt;ftiu?

-+--4-_. ~ -~ L.

--,

-..!-_.J

...

? . ,

8

-- .

- - - - - ---'

+_ _ +

, ?

- -

I , . . -.......

3 n

3 nii

mismatch_topic

I----,.-~-;;;;-;;;;:--]--1'. - - - - - - - ~
08 447...

~ijji~i
i f;';}~:;o!R :l W It'~ ;4A%ti
_. 1

BHeWHOC

r-~~2--+-~~
~~==~~-~=~
w~ocr
~.-~

10
(l~"'-

e511d7 ...

062.40...

'7Il'f

L":\~I~_...,-~"",,,
~:::: :::"...L..:.4.. 12.:. .8_
: ._.. ...J,...._-,
)

fr\..~u.-( -...~LVN

1'""... ~ (j

~~~~\"

mismatc _ response

u...-

"'U-t.oGu.JI>.

r_~idO--W

"'~ \t ""_id ~

-w

8JO I

,~~, 8JO~.

\
lOPiC

1/

ici ~

11:)Qt)lJ.Cu..

..u. ct~

"-:~:::~t=::::::~.----;;-;---,r---r"
~~"",,---;====:JG+~U
~.L\u.
I) Jgd1\5i.x,
u. JCltu..
d~tJ.iJ;:l1\iS'f!\dtciL-'
81

"" 9
\
.9.ClHHbte I1p.3 ctK C\)(
resp0\,\se

5".1\.

l'\I(YI\rt.bL'"

t!.,, I-I.d Ilyt\u ~(

\j1\Cl.u)() ,u.
j jdl'\u..I",u.

coqep:*'...d~I.J...t.< dbt

~hbJd'I\~
U

Jd.t)uc.5UAU.,

9d~IUlJ..

...i.Ji\.ctf'J.l.

82

""

\"'-......

"

84

-...

1 1

1
'4/

11..

CtJ.1

" ~

j \

1t.

r )
4

11

.'Y!jg1\'Y!j~I.,(..
cfS'5!Jctbt ,,,"
\ -'J

1)0 1\IJ.I'\ ."u.-I(-/"zu.t-'.

'iepeJ Jd.IlUCu., ..u.

.\.t5'd,U,S{ I1PUJL\KO

.1\'Y!j'Y!ju.Si.

1 /

11
2~
'---;I::::;-----j:::.:.:.!:::::=1--+.:.1 :..
1 +--~:~~(.,...;~I~-..j
'---;1:::04:---l~~::
::::::::+--+':'II:...t--+-=:.1..--:';:;4~--I
102

. . '-"

1'\ pUJctK

fl1\1\'Y!jU.5t u.

i<d'll'\E',Z0Pu.U, K01\OPbt , (.),\'!';r,.:m. 5

-- ,
, ,

Mhorue-<rO\J.:

, ,

1ectn50 anuce\l

pogumeAbCO\t.

mismatch_response_ ,

:m -- . ,

user_id

topic_id

rna.u' 5938.
1ectn50

mismatch_response.
mismatch_response

nuce\l gepen
tnaSU'

, , ,

, .
, .
, ,
, 2.

mismatch_topic

476

mismatch_response,

nf8um ",, n8um

, , ,

. ,
, --, -- --,

, , ,
.

477

Qu

, , ,
. ,
, --, -- --,

.
, , ,

478

n8um , num ,

. HeHaAonro .  ,
n_. .))
.: , rn n.
.

sql ~,> ,
www.headfirstlabs.com / books I hfphp. SQL-,

, ~:

mismatch_user, mismatch_topic

mismatch_response.

MySQL, ,
~.
, DESCRIBE
(mismatch_topic mismatch_response)
.
~,> , .

~.t.i1

) topiC_id

Jb\.QlY\.
t'\epu.I:.
I()I..f lY\Qduu,
lY\iSlY\QtciLtopiC.

479

Un3080u 60

mu. m,

~un j?3j?m (), er>I.Lla


U/j?ulO n~m, ameroj?uu, nj?uu
m~emm~u u :7u ;,mux nj?uJtIaKo~. ~ce ;,
nm Haumu KOHKj?emHbIe m~emm~u?

n
, n n.
.

Apyr

ApyroM

n .

, , ,

,
. ,
(
, ,
) .
, ,

,
,

, , .


. ),)
,

. ,

.,

11

12

13

14

J4

, ,


( ),

1-_..J~",::,~cn~~~~:::;:~=--i_ _-;::---1 ~ ~ "\d.t;;u, "yy\ls"YY\cI-tcLti .u"\51. 25 t1P U 3M KO


15
16

1178

21

22
23

24

25

480

."\l:>"\"\, ~t1~.f.u.fblx MeJj(.qy t1i\)


d."\z/ol\\,( -Vn r.\/. <1: 5 yoo.e fJ'3D-.Z

."\fs'"\..... u
"1

~' . . . . . . . .

"n~

/
?

28

( l ([[)
,
? ,
( ) ,

mismatch_topic.
, , .
, , ,

mismatch_response

. ~AHKeTa .
' .'
"
..
I(d~OMy
.I'1I'1 U dlA.
... ".""." .......' """ "v .......,"" ,.....""'''''"""..
U3 lipUJd.KO

1l' ....."""""

UJUJ( 1'10
.bL t)PUJd.I(O

ellp""Tp>en'"

.."Yl'1"Yl'1"Yl'1u..

"YI'1duu,
"YI'1iS"Yl'1dici)_respol1se
U."YI'1 3dliucb

00.>1".... '..

~~=::

o.u. 110.c:IJ.)OYft
110 liUd.,"Yl'1U
1( ctJU .!..

.. ... ...-w pt"'1'""""' . ..........

1(d.'\..u....

SQL-

Jd...u..u

'".."'". 80.,_'"

11p'uC"Yl'1pdc"Yl'1ue/

.'',,",<

INSERT,

"Yl'1d.u .
cex t)J\.

OTKpbIBwero

."Yl'1"Yl'1"Yl'1u..

( )()npauIco1l<

HOBoro

mismatch_re sponse, .
, mi smatch_re sponse ,
, ".
respon se ,

(">.> ">. ,

SQL- UPDATE

, .

,
, .

, . ,

, .

~ SQL- SELEC
mlsmatch_response, .
J >.> : .
. , :
.1{ . mi smatch_ topic, mismatch_r e spons e.

L- <<, yR
.

, L- ~AKeTa, ~

" >.>, " >.> .


~

481

u n u m;smotch. ...response

6 J

6aJV AaHHblX

, ~AHKeTa.,

mismatch_response.
mismatch_response

, ,

~AHKeTa . ,

mismatch_response,

- .

. I-ld UJ Kool10K I1pU.JI-ld

."Yl1"Yl1"YI1u. <' . 1-ld4"11..


"YI1o.l< 1<0.1< bt d.u g "YI1. du.u,

"YI1iS"Yl1o.i~_resp'Ollse . 'm. 1l0J~"YI1.

Jo.l1U.cu. IlY C"YI1b1.u. .31-ld'/.u..u. IlpU.JI-ld


.O"Yl1"Yl1"YI1u..

[ -,.;;:;:..-;;-..;:.:;::.-:;;:;:::;)--:::1
i

~'-'' : _ () Otw _ _

_.: DJI8CpOC8e ~...

", - . . . . . . _.. : ~. O ~....

---~. ~.~~~~. O~
, ~AHKea.

mismatch_response

. ,

, ,

, ,

, .
. .....;.;,. ...-::_

_ _ __ _ : - _

_- -1

T _ _ : O~$~..
]I . . . . . .:0 Ilp8C'J1lllC8e O8paIRe. .e
~ O .,-rpocnoe $.....

- - . . . . ....... : $_
.. .........ecw: 8 .:pet:t1l

e ~'"

OnPUUDC

ellepb, 1l0 "YI1ozo 1<0.1( 1l0.30."YI1 1-ld4 K,DIlu.


.3o.gu.cu.ot1 ~co.u,u.et1 ( .31-ld'/u. Il.PUJl-ldl<
."Yl1"Yl1"Yl1u.), :i I-ld U)O'lY\. ..9t1"YI1~u."YI1bl.
.3I-ldu. "PUJI-ldI(~ ."Yl1"Yl1"YI1gu., K0"Yl10pbte
bt Coxpo..u."YI1b "YI1.du.u, "YI1is"Yl1o.idLresp Ollse.

~. ,

(INSERT) .


, ,

~AHKea., SQL- UPDATE.

482

..J

...

n8Rum ",, n8Rum lO

Maru u

MySOL

, , 0
mismatch_user ,

. , 0
- ,
. ,
. , .

II

II

II mismatch_response
$query = "SELECT * FROM mismatc h _response
$data = mysqli_query($dc, $query);
if (
($data) == ) {
II

np

WERE

user_id = '" . $_SESSION['user_id']

mismatch_topic
category_id , topic_id";

np

$query = "SELECT
.FROM mismatctLtopic ORDER
$data = mysqli_query($dc, $query);
$topicIDs = array();
while ($row = mysqli_fetch_array($data
array-ush($tiIDs, $row['topic_id']);

II

.,.

mismatch_response
foreach ($topicIDs $topic_id) {
$query = "_______________ .mismatch_response

II

np

~---~-

) VALUES ('" . $_SESSION['user_id'].

'$topic_id')";

mysqli_query ($dc, $query);

II

II

np

if (isset($_POST['submit']

mismatch_response

np mismatch_response
foreach ($_POST $response_id => $response) {
$query = "____________ .mismatch_response.~.. response = '$response'.
_~~_ _~~~.. ~. '$response_id'";
mysqli_query ($dc, $query);

II

echo

'<> np

WERE

coxpaHeRbl . </p>';

483

. &MYSQL

u MySOL

, ,
mismatch_user

. , ~

-
. , ~

. , .

// ,
//
// mismatch_response
$query = 'SELECT * FROM mismatch_response WERE user_id = '" . $_SESSION['user_ id']

qc ,

$da
if

$query};
. ta} == } {

npOeepK~, u..)O"l} u J")Uu

~ 1}~Ku..u {rtbtu 'ff1~duu,.


mismatch_topic
category_id, topic_id";

""
,

mismatch_topic ORDER

$data = mysqli_.~~"'~~~~ery};
$topicIDS = array() ;
while ($row = mysqli_ fetch_array($data)}
array-ush($tiIDs , $row['topic_id']};

//
//

. 'ff10Z0 m6bt o.3G\'ff1 ,c.CCU

I1YC'ff1btu ,3.G\.uSl.u I1PU,3.G\KO


.'ff1'ff1'ff1u., .G\. KY),ftO

UJ

ce I1PUJ.G\KU . 'ff1'ff1'ff1u.
u.,3 'ff1G\6u.u,bt 'ff1is'ff1~tcLtopic.

mismatch_response

'.mismatch_response
VALUES \

~~~""~II'-~::~~~
mys

$_SESSION['user_ id']."', '$topic_id ' }";

k 3'1} ...1} -l(G\ reSpo l1se

J t)1}G\, 'ff1c:\K KG\K t)Jd:\'ff1


~, -Q),Q ~.u . .t)U Jc:\ucu.oU
,~Kcc:\U,ueu d. . (. t)u

/ / ~~~~.u ~PUJd.K~ .1}1}1}U).


// mismatch_response
if (isset($_POST['submit']}) {
// mismatch_response
foreach ($_
. nse_id => $respons
,iS,n:at Ch_response.. SET
sponse = '$response' WERE

.response_ id

e_~d

."

$query) ;
echo ' <> . </>' ;

~ ~ce, m UJ..'ff1

'ff1l1~.'ff1 q:. ..

06r~d-mI<U. -

ceEep
3'-mo I(J{~

respot)se ~:\Uu,bt
~is~G\-tci)_rs 0l1se.

484

co e

,3K-Q.u, z~ 110J~'ff1

, nn

8bl~iie't1l,

Z4t1tblX ~o1tfOCO~

~: 3

array--push()?

eepaHbwe.

, n0an

: 30 . ,

array-push ( ) ,

, ,

-push ( )
, mismatch_topic.
mismatch_response
...
.

n SQL- INSERT, 6 6
6n tl
tl n" KCDoro

&.

nonIt30Baentl,

HOBOro

nlt3
-3

n" tl
tl,

n0en .

nlt3 SQL- SELEC


" tl 6n

mismatch_response, 6

"\Gl. bU10I-UJ."\~

" tl .

el.e d. "\d.. t) r :9
bL

".3 0ct"\ d
ctl-U< e"y\}

.-';JI'

L-
, ntl
tl.

485

Un0u ,

e Jl 3
,
, ,

<.

. ., ,

yn591

L-, .

gaHHblMu.

4~ L- 4AHKeTa~

mismatch_response. ,

nratn

4AHKeTa~, ,

u:uu.

mismatch_response,

cogycs

. , ,

mismatch_response

response

ll u..Wl ) resp ol1 se_ i d


u.I1 0 .jjll\51 .9!'51 "'IY\0~O' l!\~bt. jJJ.KdJlbo
u.t{lI\u.u.u,u.d"'lY\ 11051 0.9o. .9d l-U1.bu<
HTM\.-ht u. Jd:m d:90 lI\dKoe \")
jdl1u.cb)O lI\d~u.u, ,3!. ...btx.

HTMI...-

<>

<lgd></1gd>

&g8.

n. d .bl.x

c~ ~t)u..u.
1\d~u.~
bL,9dbu<

t1:f1'1eM t1Pu.c oe.u5t u...ed

~ dJJ.u..9d.blx 'Yr\d~u.u,bI. t)e u. )Od.

1\ddu.up. do.,3bL~.

L-f\IJvm .J..ec"e J

}f nP ?</>,,,;;,J .. , ul

id='7' am='7'

cmgauu nett

'Yr\'S'Ir1dt ch._respol)se..
Q

~ :JI1~5l~ btoPOM I<OI1I<U.

<l1 fr='7'>:<ll1>
<1nput type='radio'

gax.

I<~ bt ~.u.:Jll\ K~oo t)5t .3d.u5t

<form method=post,. action=-->

<fieldset>

M~npu

~u.cu.o ll;

v 1

-'1

:
- 2

<input type=radio id=-76- narn=-76- :l =.

<la~el fr=-77-> !t:</ll>

..,.....

checked=checked- I>

I>OI'<r

111'''-,..",.......

1>

<~nput type='radio' id='77' ='77' value='!'


_,
<1nput type=radio. id=.77' ='77' v
_ . , checked- checked' I>
<label fr='7'>:<lll>
alue- 2
I>Or<r 1>

<~nput type='radio' id='7B' ='7' value='!'


<lnput type=radio id='7S' =*7 value='2'

<la~l fr='79'> :</ll>

<~nput type='radio' id='79' =*79' value=*!' ch"cJs;_'"'1Oh.,c'k",i '


<lnput type='radio' id='79' arn='79'
I>
<label fr=''>-: ~
/>
<~nput type=radio' id='SO ='' value='!'
_,
,
<1nput type='radio' id='SO.
checked- checked I>
2
</fieldset>
' vdlu. e. =. 1

<fieldset>

< 1"gnd>''''''''np''n4~ ()J[< Ilegend>


</form>

.I/>
illlll<ill/>

,~ 11

cr 110 IWI<OJI}' 113 'f npll38

~ --------------------------~-----------------'
.-rypos...:

=
---+

nltn
OAHoro

.~ en.... : .llcrpacr

",(l1,

ll<lIIIr:

J;lf81""

"0II0iIca""'''':

Or


crpac

8Jl.

potecIlOfl8Jl ......

6lo6.:

.crpacr
.crpac

486

z8

Or

n8R , nR

, mismatch_response.
L-, 3 ,
.
, ,
SQL-.


,
. , ...

, !

//
$query = SELECT response_id, topic_id, response FROM mismatch_response
WERE user_id = , . $_SESSION['user_id']
. '0;
$data = mysq1i_query($dbc, $query);
$responses = array();
whi1e ($row = mysq1i_fetch_array($data
//
~

~",a

//

mismatch_topic

~~E."",\::::2 ~,~~~~~~~~::~;~i~~i~..~;.~>$;~;;i';~~;~~;d'; :
==

I(Jl\!"tl\

,3dI')I.!Ceu.
I')~.

,3"tl\d"tl\

11,,, i

i f (mysq1i_num_rows ( ........... .) .. == 1)

{
$row2 = mysq1i_fetch_array($data2);
$row [ 'topic_name'] = .............................. .
$row['category_name'] =
array-push($responses, $r;;~y;

l:itI').t-St

iJ ~

487

, mi smatch_response.
L-, ,
ynp~ .
, ,

SQL- .

,

. , ...
, !
"
k /'
"*
'
(~~>y
~1?'

Md.CCu.

response id

3Q.

11 pU..3QKo
.ecoo"Vje"Vj
"Vju..

..u.

~ ~ ,.- 1.

topic id

O--W-

category
.J

"< t"

77

78

79

80

81

-w

82

loi

"f"""r""IW""" "'

">1

mJ.t\u'.d~

.1l\ts'm m'
ut\.3.m c5I. t\OUCI<d,

.d.\..d.u.5l
u.

X~

','

{11

-~

mlJ.\J.l(d

t\pU.J.dKd

...

76

"Vj IlPu.JQ
u I1 u h .))ro
k 1(C1"Vje.~o u.
I

-1\

~user id ~

ll..

f'.d.IJ.ertoe(\

O--W

response

' ,
.
,~_top"

'
.

~",

m~

. I<d,me~

./
L $resp0l)ses

I<d,m
'
.u.m

~~du.Lt

d, ~.

IlpU..3i-td. KO
.ecoo"Vj

m"Vju..,

U110 .3yebt.x
Jd, .u..

bt

L. mddu.u,.
AJ<em d,.
miSmd.i.~_t iC, 1 ew ~
$query = SELECT response_id, topic_id, response FROM mismatch_response .
WHERE user_id = ,
$_SESSION['user_id']. ,;
$da ta = mysql i_query ( $dbc, $query);
gctiJ UI1/~1I) ~wgyrO !'\epeMer;H'J )O
$responses = array ( ) .
4f' ()~r;u J1l)d1l)~ ,1I)OPO~O f)
.

'"

' '

'("')"'I'l'.z) J'1r,POCd, m00bl. . b;(~bt\)d1l)b

whlle ($row - mysqll_fetch_array ($data)) {gJ..~ rV.I J'll\(111)bI. opu.~,w"o j<1lPOCd,


11

488

n , n

7tiu fU)Ii& tim&emc.m&u


!fatim & oa~ uti! & ec.mo&oM
/0fm, & &t!<>e mFti! fj?eetiti
<<11fuc.mfac.mue u m&fUIu;? ~u 31110 -_ _ _'" & 31110 //mu&ti;?

, . ~ Il30aIIt,

, "lI n. .
6 MySQL.
,
.. (true/ false - /),
(), ().
() , ,

( ).
,

TINYINT.

"

=1

=2

, ,
,
. TINYINT
,
. .
. .

~8U8 . u
, ,

. .,",U:\.
t)OKQ ,", I"\Oo.9Y .I"\

:""t\Daw,.t-W.. .

Ot-W. !...Du.)(l\st
""t\. ""t\dK ...

~ TINYIN
- ' " - ,
. ~
.

foreach ($responses as $response)


if ( ........ .. .... .... .... .. .......... .. ..... ,) {
echo ' <input type=nradio n nae='
, " v alue= ... ... .... ..

. $response['response_id ' ]

hkd= ... . . . .. . ... ... .I>

';

else
echo ' <input type= " radio nae=' . $response['response_id'J
,. value=.. .. .. .. .. .. .. .. /> ' ;

489

, ,
,

"I1\.u KOI)KU

_
TINYINT
.3dUCuOu. cpuKCdUfAeu
sl ,
llPUC"I1\pdC"I1\Ue t'\st"l1\ .
.3W1leJvI. t'\P';}3W1(Kd
1 .
.O"l1\"l1\"I1\~uSl .3W1l ,
d.. dd.3 e ctrtbl.x,

COO"l1\ee"l1\c"l1\~e"l1\ .3W1l) ~

llPUC"l1\PdC"I1\ue::o).

U .3t:1.u fn1o~o I'!PUJt:lI(Q

. "tl1"tl1"tl1 p<to 1, I'!Pu.cou:m e

Q"tI1pu.dyrrlY checked "tI1e~Q (it1 ut>

fo~:a:h?;::;::s7c~;~~;'s.:.~;~;:e){ { ~.u ,"."&'

echo ' <input type=*rq~o* =*' 'ch$ris~~nse['response_id']


'* value= .. .......... hkd= .... ~~.. ~....../> ';

foreach ($responses $response) {


if ($response['response'j ;; 2) {
"
'<input type;'radio' ;"
. $response['response_1d'j
" value;'2' checked;'checked' I> ';
else {
'<input type;'radio' ;"
. $response['response_id']
"value;'2' I >';

490

!"

n8um HHH,, n8um 80

06

..

, .

Tepa.pb1i1

(Aebrt1)

.
:

i f -else. (lUl)
?:
if-ls..

. LU

~.

12,_

I'J. j.J\:JI.pcuk-u.

'W\ J.ctu. 'true,

ot1PhAtn1OP
'-r- ..

1:

stnb ucnoAb3068.

gA9

;ogunnAAU11Q

'-"-' _

npoctnbV\

v.-- bu)'W\ ~eu.e1. ynpe6Sl'W\


J(:<!> () 2~
Kocm~l,IUi1
r

/'...'

~,

muna -Je 6

~-------~I~u . ~~.u.e Konamotl .


fale8
uee'W\ J.u. fd.~se,
bU'\.'W\5t. ~..u.2.

?:

i f -el se. i f - 1 se,

, L-,
. ,
.., ro ?

:.

echo '<input type=wradio narne=W' . $response['response_id'] . ,. value=Wl'


?

3.ctu. "tl\. ~o.. btc:I.J/(.u..


l).9 ."tl\ J.ctu., Jd.Q
'YrIep.ctp.bl. ol)epa'W\opoM

?:.

$response [ 'response' ] 1, checked


<input> checked, ,
.., ,

<input type-"radio" "--- - "279"

1 ue="l"

.... _..: llCJl8C

..

QII

, ,
, checked
<input>, , ..
.

491

.ww quest;onna;re.php ()

[J ) J
TOro,
.. ..,

($responses), . ,
mismatch_response.
, ques t ionnaire . php.
<?php
II
require_once('startsession.php ' );
II
$page_title = '';
require_once( ' header . php') ;

~}JJ.

~ .90&t/<l\btx d.o

require_once('appvars.php');
require_once('connectvars . php') ;

t::t0Ct JQ.Q

'"fYIp<tJJ.t.t.

I I ,
if (!isset( $_SESSION['user_id'])) (
echo '< lss="logi">, < hrf="lgi.h">
'

questlonnolre.php

O"rI,bt'W)u L

</a>'

.</>';

exit ();

I I
require_once('navrnenu.php');
II
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD,

_);

II ,
II
$query = "SELECT * FROM rnisrnatch_response WERE user_id = ," . $_SESSION['user_id'] . "' ;
$data = mysqli_query($dbc, $query);
if (mysqli_nurn_rows($data) == ) (
II rnisrnatch_topic
$query = "SELECT topic_id FROM rnisrnatch_topic ORDER category_id, topic_id";
$data = rnysqli_query($dbc, $query);
$topicIDs = array();
while ($row = mysqli_fetch_array($data))
array-ush($tiIDs, $row['topic_id ' ]);

II rnisrnatch_response
foreach ($topicIDs as $topic_id) (
$query = "INSERT INO rnisrnatch-response (user_id, topic_id) VALUES ('" . $_SESSION['user_id'].
$topic_id')";
mysqli_query($dbc , $query);

492

rnisrnatch_response
(isset($_POST['subrnit'])) (
I I rnisrnatch_response
foreach ($_POST as $response_id => $response) (
$query = "UPDATE rnisrnatch_response SET response = '$response' " .

n.

"WERE response_id = '$response_id''';


mysqli_query($dbc, Squery);

echo

'<>

.</>';

//
$query = "SELECT response_id, topic_id, response FROM mismatch_response WHERE user_id
SESSION [ 'user_id') . "''';
$data = mysqli_query($dbc, $query);
$responses = array();
while ($row = mysqli_fetch_array($data))
// np mismatch_topic
$query2 = 'SELECT , category FROM mismatch_topic WERE topic_id = ,n . $row['topic_id')
$data2 = mysqli_query($dbc, $query2);
if (mysqli_num_rows($data2) == 1) (
$row2 = mysqli_fetch_array($data2);
$row['topic_name') = $row2['name');
$row['category_name') = $row2['category');
array-push($responses, $row);

//
require_once('footer.php') ;
7>

11 pe.:?f<:ge O1j. u,u,

.o.u. u.3.
d.u.e..oaKu.e. Ka1je.ZOpu.u.

"e.pozo t)u..t-lcl.l<d.
. 01je.1j1ju.5I..

. d.

.~1't1bt. t)pU..3.d.KO
:.'\'\'\u..,
t)

1. == 11plJ.C"'t\pac'Y\u.e.
2 = 01jd..u..

> '\d.'If\ bt3od. d. u U.J Ji'f\UJ(


.u,u.u .3."I\ " KKOt)OK. Hd.)f(.d."I\u.e.

lIe.pou. IIu.u.i'f\ 1< d.... acI.Je.


af.u.Wt.x .3.u. t)pu.3~Ka .'lf\.i'f\i'f\!u.
~pu.C"I\rd.Ci'f\u.e, "I\0POU -- "l\d..u. .

)), n
.

8 ~

493

n.

quest;onna;re.php ()

--
" n_. OOll8C'l'8..
.. ,
.. (

www.headfirstlabs . com/books/hfphp).
questionnarie. php, .. VIu. php,
. .
-

(iridex . php)

.. .
, . . ,
(

), . ,
. . ,

.. , ,
.

?
~-------------------------------------------------'

Or

() Or

: 8

Or

Or

Or

- :
~R

Or

Or

:. ~_

. "

...........~ ............................

"::f

~ ..
:

www.headfirstlabs.com/books/hfphp

494

, n8

tfG 8bJ~iiG'th,

ZV11bJX ~011OCO~

': 3i cr , ": n
, ? :, n

en - ?

: . .

, ,
(t rue/ f l se).

mismatch_response

.
.
.

, , misma tch_response
.
.

'

mi smatch_topic .
,

?:

. ,

: , .

.,/. ,

(/) 3i .
, , .

an i f - 1se en
, .
?:,
en
: ,
i f - 1se. ,

, ,
. , ,
? .
, .,
mi smatch_response
,

i f - 1se

, .
.
? : ,
.
.

. ,
mismatch_response, .
,
. ,
,

L- < insert > ,

mi sma t ch_response.

checked

. ~.u.. t))f(,e.uu coo"n'je"n'j1\u..

. t1pe~J.cMo"n'jpeHo ?"n'jJ.'4"n'ju ~<.\<.\.u Cl..!

..

,",01.
'11.>
..

.9 00 <.\.u. .. t1PU3QK<.\ COO'l\e'l\"n'ju..

Aoiat.IIIC 110....0 np..,..a IICCOO/ll&c."".UR ....., co6""kttllYto IIIU'AUL\Y lIIislllakh_ fopic (. nbtO
5Q~po:
INSERT INTO mismatch_topic (,
VALUES (' ',

t1g u .90 _~~e.tL. .oo.o IlpU..3Ht.\K<.\ ."n'j:t\"n'ju..,


t) KPgU.eU , g J<.\l')uceU Yl\ex t)30<'\"n'j, KO'l\0pbte
.Uu .9<.\.bt.e ~ ~.e'l\y. .7'1\)' .eox0.9 UO
Y.9~~'I\b ce c:,t1 u CU 'I\<.\u.u, 'l\iS'I\<.\tcl)_resp0t)se I)

category)
'')

~aAUIIIC & ,anucu ~ IIIU'UIII lIIislllakh_l'CsponSC (. nbtO 5Q~npoca:


DELETE FROM mismatch_response

Y6~ulllWo 1II0, "1110 AIIKcma~ nUAatUR HCCOOIII.cm""&UR~ n&UA nOAC ~attlllll)C


~AA "O~ np..,..aa IICCOOIII.cm"".u...

~U/IIC aoc'Au60 ,..a"Ctluc ~AA "O~ npu,.eaa IICCOOlllkm"".uR, Olllnpa.blllC " ",,& ~AA
06pU'oIllKU Un."'IIIt, CO"l'attUAOCb AU .tuCtlIlOC .au ,..CtlU..
8

495

tl60mtl tl3

AaHHble
,
. .,

, . ,

, ,
.

- ,
. , ?

I
\
\

" '~

80r

~ 11 pou,e.cce.

0.8: 8llCJl"ll

Or

..: 8

() Or

lll: llCJl"ll

80rII

u.U.I(. '<:\.u..
ctbl. u.J...u..

4u....u.. .jlll1bt.

( .3j'-YI\<:\lf\ ll.lf\u.)
IIu.u.lf\

1(

.3..

.ooa. z.eynl)bt. I)U.34

."\~.lf\lf\u... 7mu.
d.lf\. I)..u.
.3 t).u.lf\.i1

z.Pjt)t)bt.

, , ,
- .

,
. .

,
,
.

496

, , , ().

3 KamerOpUu , ())( ()011yU.\eHa u,


U110 , , (),

, MOri\U u 11pOOi\eyr

mismatch_topic

!. ~ .3.cteM .9

gbIJ~dgweu. I1
.ctu.eKoau.

Owu.dKe

... O"'l\ 0.9d.,


btJbtd}OUJ,d. "'I\dKYro
I1 g
Ae"'l\a~'>,

: .

mismatch_topic.
: . , ,
,
.

: . ,
.

: , ,
? .
: , .
: , ? - ,
, mismatch_topic, ?
: !

misrnatch_response, mismatch_topic

: ,

?
: .

mismatch_category,

. ,

::lismatch_topic

mismatch_category.

497

anuu

meopuu gaHHbIx.

..,
, ,
,

uauU9

gysuU9

. .

,

MebUJe11Ue

gaHHbIx. u

n5eue

9u gy

rnau1,JaU
, MySQL
, , ,
, .
' , ,

,
.

1.

2.

~ '<\I(J1)Oct'Yr\51

'Yr\0 .M.oe, '!\

"'<""----- '!\d. 'Yr\d.$u.li,d. 'Yr\


Ot)u.cb!.d.'Yr\b?

,

, KorAa
.

.
,

r .

. ,
, ,

. ,

, f irst_name last_name

misma tch_user, ,

.:

..

gab1e -

gab1e. pa5Utn1

, .

go

.uu.aoro
. eoogu.oro

, nu.eu.
. 'om. ou
,
.

pagm

gA9
498

cso\i

oro nu.eu9.

nSRum , nRum

n1l0ecce nJ

06

TOro
N ,

~ . ,

Osecneue
58.UIU.A\ gaHHblM

cootbetc-I' , , amo.apocmu
, . ,

war

nyu

1. , uauuu

gaHHblXo

~ ~o ot")u.cbt.a.e"Yr) <:t1.U.cl "Yr)<:tdu.up:


4d~.u. .u.UJ<
t")~u,, u."Yr) p<:tccbv!l{u.,

2 v

peu"Yr)u.zu. ~u.z., dt")!

P0Mc\J-t"Yr)u.J(fr!

11

~y ?~
<:tJp<:to,"Yr\bt.<:tu."Yr\e

3.

C"Yr\~K"Yr\~P~ <:tu.

"Yr\<:t'u.u,I:it "Yr\<:tK, "Yr\dbL


. z. )!(,

dblJlo "Yr\ ,3<:trtt:!

u."Yr), "Yr) d.bl.

/4"Yr)JJb Qbt,

4I((o "Yr) Jo..

?
If 8J~ite"t1l.

g1)t11JX ~011OCO.&>

'9: on 1ibCll
11

MMHMallbHO r ?

: ll.

'9: II ?

: ,

. ,

0 ,

, , ,

: -

, -

. ,

, .

,
,

499

U30UU

, ,

- ,
, .
,

, ?
- -
,
, - .
.

U3a~U9
ueetn C50U
gocmOUHcma.
om

3amcs

1\

-
~~

onmuU3aUUU

306

- ,

gaHHblK

l.11lffrJu,~.&>r1Jfii, ~8J\u,llat 0111h.'&>t1h. U opocm


<11/)i\,f~'LlflJ,G ff<JJfJfbJX. 'I JJf11t,
fruMtfJ '&>r1\UtU, 8aJ gr1lflfJX.
l8.et1cs

=.::uu

OrpoMHa.,

., n. 6 ... ~
d.UJt-U-lst

<\3<1 .bl.>< !.. ~


"..u"V\..w ..
1"\0 .3 ."V\.t-tD

aJ"V\..u aJbt.
.,

'

20fU'll1,
~dJrl: .2u1

.,

n. 6 l

2. YMtlfb\UtlfU,tM ~oJ\u,qtC1h.'&>r1 gr1lflfJX gM l1oU,C~r1


'&>Jl1oJ\lftlfU,t ~r111foco.&> l1foX ogU,1h. 8JC1h.ftt.
MeneHHe , .w n

........ _oropcno ...

500

"V\01"\, 1"\ 0 :9u"V\

.u..~J ."V\,

p,:; - ,<>?

6aJbI

, ,

t .
,
.

.uaU9
gaHHblx.
6aem

. - ,

. , .

6, n .

ux

,
.

: ,
",w aoocw, pea1I4.
, 8ntJl ,

n- 6n

, ,

bl-tml ,
nIoI QC.

, ,

nlO.

.wo, 8ntotl

.y;tKO, one

, .

. ,

6I(, nHHHe aoocw,

<On1" 6opWo.

~"<:.

Mh.o-.)) .9.))u.t).btx .9 C1 ..btx

.9. f-U(.

u.

. t)epu. ..
\-------::----I
~
)1 OYl)cymcYl)~e'Vf\
06447 ...

O.9.ope.e..o

. . 14.u.~u.

.9C\~u. ... ~O d1 Ild.l

&~PI~
~

no'

23Odcd ...
o51 1d7 ...

0620.40 ...

41263 ...

6, nlO n
_ Apyr Apyra.

.-.'Vf\
d\lu.'Vf\
~.u.K C1J1brtOCYl)b
3C\t"\u.ceu. 'Vf\1du.u, .


, ,

.
,

.
,

Of-U(ct. .9 \1 . Yr\Yr\u..u.u -.9.


JCI u.cu.Yr\ o'Vf\ .. .\w< d.tA.ct.u..
-.. -"""
" """~""'~""'\""4""~
'-..m"",;;,,;:,:;t:'1,'j.7r,.,7-:-:.rf~,, ,~;Z.7",::%%17';'1_:;
.= ;fJ,17i
{.
~...i1t, j:-'~
' -:;.~
id;;71 .9d. u. YI11Yr\ct. ~o oJd. \Yr\, Yl) lI.Je.rte.rtu.e.
~d..u.. .. ~ .u.x t)oYr\pedye.Yr\ u.~.....u..
______

>"
no'

06447.

~:~:~

23Odcb ..

Alhe"

::;
::~~:
_ ""' 41263

u,"m
Tupelo

7 ~::~~ d;:~;~~;:
GA
30601
iOI'kj9
AZ
MS

65399

",bypkjP9

elme 'P;c.jP9

oCYr\C1J1b.btx .9yx. mdbt c:IJu.Yr\ Yr\


t).. iI'J:.. .9 0-.bt llepe.rtecYr\u. .9C1~e

MecYr\e UYr\Yr\CI t)Jct)). g CO}O


gdYr\...} Yr\d.du.u,, Ut)J. 2I-I{o.
d.Yr\ t)u... I<)1.

501

QUQUR  nuUR HecoomsemcmsuR

, ,
,
. , ,
.

;%! 'iJi!

. rriotdt
'~
,
'. _user ~

",15

use id ~

usename

passwod

join date
fist name

last name
gender

.';nismakh_response

birthdate

response id

city
state
pictue

z8

topic id --.-

esponse

name

..
id~

" use id~


....

topic

502

nmQtch..topi

O--W

category

n8Rum , ynpon"me

1ft 8bl~'tt'}h,

Z'if11 1X ~011fOCO~

~: 3
06 //ZI-?

:
mismatch_user .

mismatch_location

location_id
ci ty state
mismatch_user location_ic1,
. ! - ,
location_id ZIP-KOA ,
, .

~ : , , 3 , 3
. ?

: , . ,

. , , ,

' , - ,
, .

//ZI- , ,
. , ,
. ,

ZIP-KOA
mismatch_user, .

~: , ZIP-KOA,
, 3?

: . ,

mismatch_user. ,

ZIP-KOAOB, ,
. , ,
, . ,

.

ZIP-

mismatch_user

6- . , ,
mismatch_user.

503

6 nunUR u

.
, ,
,

. , , .

,3..u.

., ."",Q.u.
I(Q..,.,eZooeu.U "p~al(o
...,.,~..,.,..,.,u.

. u.)OVl\

oC""'CV1bKY)O

Q..,., ~b!. .ct..buc


.,u....u.

..,.,..,.,..,.,u. .

IfG 8bl~~G't1t,

Z1t11bJX ~011YOCO~

~; mismatch_category w
?

~; 3 , mismatch-,ategory Bcero
3?

; , ; .

mismatch_topic.

,
, .

mismatch_category,

. ,

mismatch_cat egory

--

mismatch_topic.

504

mismatch_category

)
, ,
. ,

mismatch_category mismatch_topic .
category mismatch_topic , .

3ct..u. ..oOu. i\cl.u.u,bt~

..

i\iS'Yl'\ctt~cl.tr',

KOi\OPO ::JYI1 "V\X.I"'.~l:..

category_id INT NOT NULL U_INRN,..ctu...ct..u

INSERT INTO mismatch_category () 'JALUES

('')

()

VALUES

INSERT INTO mismatch_category

()

VALUES

('')

INSERT INTO mismatch_category

()

VALUES

('')

INSERT INTO mismatch_category


('')

INSERT INTO mismatch_category () VALUES


(' ')


14

category_id mismatch_category


, ,
, ,
.

UPDATE mismatch_topic SET category_id


WERE

''

L--------=-----'~:t11:-...,:;'u<:' 'YI'\z. u...'YI'\UCu.ct'Yl'\pcl. Kct'Yl'\e.Z.OPu.u. 'YI'\ctu.u,


. <.:I.t _L tODic ~..r.u. )'
<.. COO'Yl'\e'Yl'\c'YI'\oct'Yl'\b
_ _ _ _ _ _ _ _ _ _ _ _ _ _.... 'YI'\IS'YI'\ U1_ I
.u.u. 3ctt)U.CU.
.3..ct.. ct'YI'\u.....1\..z. u. ..'YI'\u.u.ct1\ct. Kct'Yl'\

_L

'YI'\ctKu. ..ctu.eKo<.:I...u.eM <.:I.'YI'\..u.u. 1\ctu.u, 'YI'\IS1\cttU1_ct e~ory


(t)u...bt. )).
~
505

n nuR

--
HO.YIO 6n

-----

mlsmatch_category

. .

MySQL,

..

rnisrnatch_category, SQL- CREATE


TABLE, . ,
INSERT, . ALTER
rnisrnatch_topic: category
category_id. , , rnisrnatch_topic ,
category _id rnisrnatch_category,
, .

SELECT , , .

I1I, 6131 I
l ) I30II?
Y6elnea.
.
___..: ono - _ . , ,

Coaaiint,.... .cuaii

. ,

a&lIIIoI .....-.. _I00I.

. ,

. ,

6etea.,

ono _ _ _ ._
cw pynI.
cex l\du.upx

..an ,.",

130

co.3~ l1Du.bte

, ~
I()u., l} l1u.d"WI

'"

.u.l(dJlb.l\ u.x Jdr.

( ~~~

O"II\cY""cl\u.e Jdu.cu..ocl\u. 0l\ .u.\l\l\u.I(. -I(~


I(J .94u. u.JJ.4) MeC"'tl'\e :.u."'tI'\"'tl'\ d

\.30d"'tl'\, L.l.J.bt 0"11\ I1dbt .3dv.cu..o C"'tI'\LJ..


506
8

npDR , nR

& cmf'Ymy!"a
()bf)C "!"uetiu
m&emm&u" &aem
&uu 33"!" ue!"u

PuiKem3" <questionnarit.f'hf')~

/ / .

$query = 'SELECT response_id, topic_id, response FROM m~s~tch_response


MWERE user_id ~
$_SESSION['user_ld]
1

Ml_.

$data = mysqli_query($dbc, $query);


$responses = array();
while ($row = mysqli_fetch_array($data
_
//
//
// mismatch_topic
$query2 = 'SELECT , category FROM mismatch_topic ". ,
'WERE topic_id - , . $row['toP1C_1d ]
$data2 = mysqli_query($dbc, $query2);
if (mysqli_num_rows($data2) == 1) {
$row2 = mysqli_fetch_array($data2);

$row['topic_nae']
$row2['nae'];
$row['category_nae']
$row2['category'];

array-push($responses, $row);

. 6llw CII. ... 6 ...


", .... . IlI060 .
,
mismatch_category, ,
mismatch_topic. ,

mismatch_topic.

, ,
,
,

(misma tch_ca tegory).


507

n!

3 ...

..e:ma

, ,

rnaUU

, ,

<l' npt.OgUn1

. ~n1-IPUt lln

. .

5 sae gaNbV\

J - - - - _ --

U an.yrnJ58U>
~~:

508

an.0:6 . en.

16J1~
w IIII
! - ?
SQL-, (join)

mame

5meu9

. ,

egucmeoro

(inner join),

~ubtx

UCnb068.Ue\

. )'I)d."uu, ~~ytr1

, u.Gt

u. .)'I)Uud.)'I)

U5e8I11C9

~ IlPU.3C\Kct

ucu u

.)'l))'l))'I):

SELECT mismatch_topic . topic_id, mismatch_category . name

~~OM ~i.~ ma~Ch~tO~i~ ... ....

0"egUeu9

l\.u

Kd.)'I) .01L.

)'l)~ )'l))'l)

(mismatCh_to~ic. categ; ry_id mismatch_category. ca!~::_~:)KOCtJ.)'I)C5{,


'-. \l.A,4. 4\ u;;Po.U,
~ u u-u. 'YI'\\dUu, \)\)'l). )'I).

!ON

\)'I).ku. ~l\ .~)'l)~)'l))'I)., dblJlct


,1u. u ed jC\llpoce 'YI'\ctu.u,. .4

:~'Yl'\'YI'\u.. Q.bt. COO'Yl'\e'Yl'\c'YI'\oC\'YI'\b .

Ilj\u.. I(}bt.x ~ INNER

z. o ~cex 3\\jU eux 'YI'\C\ uu,.

tJ.k.,U:} Il 3d( .1!))'l))'I)g:

JOIN.

eK'YI'\u.~KC\'YI'\Opbt
/)

KC\'YI'\ezopuu.

\jPU"dKO

mismatch_category

1Jmd. U(\

*''YI'\\'YI'\ctX
,-""'<"--?'--~==--'Jdt\\ .u'Yl'\

!r-----'r-"- ==,......----1 dJe.oC\t\.U.e

1-=--ft-_ _ _ _ _"1d.'YI'\z uu, I(O'Yl'\O~OU


1-=--#-_ _ _ _ _"10'Yl'\'u~. t\ U d

k-'Yl'\'Yl'\-mu.,

I-~~-------t u..
1---=-+------1 LA3 'YI'\\uu,b\.

f~~~~~~~

L-_ _':::'-\---'

.1 .

'YI'\iS'Yl'\dtch__

dt.r 'YI'\C\K,

'tY\obt. .
u-'YI'\Uu.\'II),'

COO'Yl'\ee'Yl'\C'YI'\eO~dJ1

u-'YI\uUd'Yl\j

Kd'Yl\ez.opuu 'YI\d.uu,
i 'YI\d.t~ tODic.
'YI'\ 5
I
1\I\d.X .3C\t)pocC\

.41\~94bt
3 odeux )'I)~u,.

8 ~

509

n SQL-n u

Tallllll

,
, . ,
,
f(,
, .
,
. ,
,

~).u
e.u "VrIduup.
YC"VrIpdI-tst"Vrl

..9~J{O"Vrl
f)' Jdl1poce

UI10Jd.u
.9 u..uu.

510

cnAb058.Ue
YCA06<rO
osmaeus

60w,
06


SQL-.

osegueue

uuem

SQL

. ,

,
WHERE,
, .

SELECT mismatch_topic.topic_id, mismatch_category . name


FROM mismatch_topic
INNER JOIN mismatch_category
ON
tegory.category_id)

gsyx

nucu

tna5AUu,
uCnOAb3yg
6 YCA05bI
6eus

onepamopbI
cpa5'eU9.

, WHERE

~(.\ I<J.\ zu\"!)

vr!u.

I<U"!} J1Lt

.u.

:\"!}_~'.z ~D<:1.u

.)

. ,

J"!}r.:\"YI).< Jr.:\I]pocc:\ 1<c:\1<

WHERE:
1

BHewHOCb

BH8WHOCb

~ ..

JII8

8JIJ0<8

~.Yf\Yf\'VY\u...

8.."J0<8

~eKYf\u.c.pua(dYf\OP

t1pU..3 dKd

h-Yf\Yf\Yf\u..

u..3. u..3 Yf\du.u,bt,


9bte t1pLt.3dKdX

'w'HERE

u..u

I .

'VY\ddu.u,.

Hdu..eKO~d.u.e KdYf\ezopuu,

KOYf\P-U 0Yf\Kocu."y!}C$( t1pU..3dK


KeCOOYf\eYf\CYf\u.$(, UJ -
u.3 Yf\du.Lt Yf\iSYf\dt~dt.
1{

WHERE ~~


~.
mismatch_topic, , .

mismatch_topic

\Jt)~d.-,om

;;Yf\d'VY\ btt)-.u.. t)epou _


d'VY\u Jdt)POCd (t)'VY\~)OI.Jl.u
btdu"lO 't/HIR~ )
ypeJdK
.3dt)ucu.

-'VY\u u.'VY\..u
~

. btdu 't/HIRE
.dUu. u'VY\
jdt)uceu '~'VY\d'VY\
.3dt)POCd

U.

511

SQL-n8

USING

Sbl~iie't)t,

'9: "~,, """~~""'''WE.~~:~ ~O~:::~ "",~~

. . ".WEAE

, " -_ _ , ..""

II mismatch_category?

Re ?

; . , ~II

, ll .

cn. WERE

cn ,

WERE,

(category_id),

...

WERE

rnisrnatch_category .narn =

''

, ,

, (<< .).

cn WERE

, 1le8

. cn WERE

cn WERE

, .

, .

- rnisrnatch_topic.

J

USIHG

, INNER JOIN ,
~~?
,

eume 5btpaJeue

USING. USING ON

51 5

51 5

ON

5rpa.eue

USlNG g

an.

copaUJeU9
5 K01nopoM

, 05"begU}SIOtn

odeu.x
"!\QU~
ubt.,

SELECT mismatch_topic. topic_id, mismatch_category .

"!\. uea

cQ.u.x "!\QUu,

FROM mismatch_topic

~:;~~~::Q:~::::::~:;:::~~i9 mismatQh_t;at~9Qry, l~::_id) v

>
!I"'"

. ..

.....

WHERE mismatch_topic.name

' '

ON

(category_id), USING:

tna5UU sae
ogu51
.

,Ag
UCnOJ\b3058.ffi
osegueoM
an
51

6
SELECT mismatch_topic.topic_id, mismatch_category.name
, '-hr\o .du..

FROM mismatch_topic

- .7"!\

INNER J~IN . ~ l ::h_tgry/ u.. I{J

US1N9 ~c~tEl "'_"1

~
=

WERE mismatch_topic.name

uea .

. ...,ct.. D<1."!\Q (=). osegulS

' '

, .

mas.u. g

5bltnb

512

USlNG.

ogua.06blMU

6
.
II .

mepamU5

SQL

us 58.

5ocm

, .

nepeueoam

.
,

ma5AU

, .

aMe .bt l..t.... '!')\u.u,

=.

. "",- CVlb YJ1 YJ1u..bt l..t..e.a I<oq )"j<.t.u.'!')

. ~3I<I..t.. u. . 30>~
L. 1) 0 fW..df..
_,-1'
,-:""
FROM tl~s .!tb1!tt>it(i'C:({'~,g ij'
~ \\). AS <1i-UW
INNER JOIJ~~';~""'~* "';"'*,
'. '
~<.l 3d'!') QJ1b"\ "\u.
. :t.~tC.b~~tgg~~
~
",J.RC
u "Y\t . "V\ctUu,bt

SELECT topic_id,
~
*:<~~":':<?:___

'hrIr..

'~"~:T

"V\iS"V\<.Itc.i)_topiC .

USING (category_id)
WHERE

m. = ' '
~

<.l1 6 "Y\t ("\."\u..


u~.u .7"\. "\ctuu,bt).

onpegemI

npeospaoam

ero

cogaue.

Me9St

npu

ero

el

"YI\\S"Yl\\tch __\tr

(cgm .

<V1"Yl\4"1\u.. u.. "YI\C.

u m 11.),

"Yl\"Yf\ ,

miS"Y\C\t~topiC '!') dbt'Y!')b 'Y!')e\iepb

. 06

bt.<.I \ "YI\\du.u,

roaa. bLct . "\ctuu,j

5
5

uqp.U5

,
? , ,

! ,
,
II ,

, .

rnisrnatch_topic

rnisrnatch_category

(),

. 06J1,

110

I3btdop 7"1\

u.4I<bt.u. u.e.4Joo\u.

(topi _

tegory _ ).

).u. ,"Yl\\"YI\ ,\t1\ ...


. u.J< \.. .u.l

aueoaul1
U5

uea

5 _ma

5 858.U11
sygym 5cynam u

WERE

mepaU5 uea.

1.JJ\. 5
5 ma5AU1J,
~

513

nu SQL-n

Os'eguee

' w

qxpemus

. ~,
,

KO.name.

. :

//

$query = SELECT response_id, topic_id, response FROM mismatch_response .

.
WERE u ser_id = ,. . $_SESSION [ 'user_id'] . .,.;
]) i.3~I:)'YI'\~"I\ ~btt).Iill5(
$data = mysqli_query ( $dbc, $query);
''j t)lillX
$r~sponses = array ( ~ ;
,3~t'\ooco ~l(~}O'YI'\.
whlle ($row = mysql:L_fetch_array($data
(
J.~Iill.I1UJI(
/ /

.O"l\"l\"I\u..

u. 1(~"I\eZopu.u, 1( 1(0000000PbI.
Olill O"I\.oC SI."I\: 1<d.:9 0
u.e.o~ue 'Yl'\.9.bt. MI1POCOM

$data2 = mysqli_query($dbc, $query2);


if (mysqli_num_rows($data2) == 1) (
$row2 = mysqli_fetch_arraY( $dpta~) ;
$row[ ' topic_name'] = $row2[ ~~] ;

$data3 = mysqli_query($dbc, $query3);


if (mysqli_num_rows($data3) == 1) {
$row3 = mysql i_fetch_array ($da Ea*,,)'rfC ,
$row['category_name'] = $rw3[ Rn~]
array-push($responses, $row);

1<

:
//

u.t'\.30~u u...u.Sl

t)OSlSl"l\Sl ,3."I\
u.,3 u..~.u.. t)u..3l(o
."l\"ll\"II\t.L u. 1(~"II\eZopu.u.
1( 1(000000opbL o.u. O"ll\.ocSl"ll\cSl, 110.;

.z u.... ,3~t)POC~.

$query = SELECT response_id, topic_id , response FROM mismatch_r


WERE user_id = , . $_SESSION['user_id'] .
$data = mysqli_query( $dbc , $query);
$responses = array();
while ($row = mysqli_fetch_array($data
//

"l\"l\"l\~'iOu

"I\~du.u,.

Sl t'\.t.L
.3~t)pOC~

u.t).,3}O'Yl'\Sl

cVlb"l\"ll\u..bt.
u.e.

514

l8

n8Rum , nn

& ra&HO nouaIO. t.Cn1


eUIe OOU ~nroc

~U oOoUHWUSI &

Motym. & eUIe HW)(OOUO

Q~bQ&a~nroca~

,
, cn n an .
,
~.,
. ,
:
,

, , ,

. ,
, ,

: ,

mismatch_topic

mismatch_category.


0 . SQl-,

//

mismatch_response, mismatch_topic

mismatch_category.

$query =

$data = mysqli_query($dbc, $query);


$responses = array();
while ($row = mysqli_fetch_array($data))
array-push($responses, $row);

8 ~

515

5bJ~a.e'th.

': lO?

6V11bJX ~011YOCO~

: 3

(equ i join) ,
(non -equi join)

(natural j oin).

': , SQL-
-

: ,

.
.

(outer joi ns),

(left outer join), (r i ght outer


j oi!1), (full outer j oin)

, .

. ,

(),

, ! ,

, ,

3 ,

, ,

3 .

ON. ,

, .

. 3,

, .

0,

516

Head First SQL.

n8Rum , nRum

--
,
. nn nn .
<!<~ ,
.

- <!<AHKeTa~.
, ... . ,
!

, uum,

Korua rlOum
~ , ~ merllfb,

Korua ~ HeU .u 3muX

I ~~d. dCIJct

~t't.b!.x I)u.t-St
, O"ll}"Yll"YIlll.::
I C"YIldJld. .
... DZOY 113 1lIUtOII ?
-OCn-'

I
I

. - -. -- - - -..- -..-

.0. . .:

T8)'IIpoII".:O llCpacr

....w

Or8pam.cllc

.pacr. 8 Orp

....: .

Orpam.

. 1Co86o.~e ....: 8 llC8c-rw.. Onpam.


....... 8O.IIocw: 8 .:. Or8am.

peil

el'\epb, ;.9<:1 "t\u.\

.9<:I.bte

. .9,du)OYl1'

dcIJe, POp<:l

C"'r\d.Jk:\

t').<:I"'r\.,

'-.m==::===::::::=::::"-...-

~:::::7~ 8 Onpam.

- ..

I
,

-'1
\.

6"'.: 0 .: 8 Or8am.

.......w,.....: .pacr

nr IIIJSW"':. JICP8C

~a-"

8 Orpam.
Or8pam.oRRC
on~._ _ _ _~

..:. c-rw..
_ . _.. _ .
: 8 .8

.. : c-rw..
Ocpwe " ' - : 8 pae:-rw.

Or8pam.cRRc

8 Orp
Onpam.cRRC

.,

t\d u.d

"IIJ.o~ u. ~?,d.

.ofs'ou 'l\ctdu.u,,

d.u. ~.bt.e

110 i:\'I\u.,
/(O"II}opbIA

"Yll."Yll I)P~.a./(u.

."Yll"Yll"YfIu..

J.-I.ct <':J<"'r\d:
.9 u .ctu. u

,.u.~"'r\.

1'\0 j"'l\d."'I\d. 3d~POC<:I


I'\dPOiJ. u..uu
"'I\d.duu,d., U

d..bt Qu.ct.u..x

I'\PUJQKO

."'l\"'l\"'I\u..,

,<:I..

ux jQ..u..x
u Ka"'I\e.ou...x, KO"'l\0Pbt.

iJ. t).."'r\.

o.u "'l\.'"'I\..

r,J<:I"'r\st..

517

uu

.
ll ,
ll

ll. 8ytO.

..,

. ..


. -
.

518

z8

~uu UQOf
m&emm&u, 110)(, Q&
33<): & 3I11U u&u l1!'u&
m&emm&u, )( u u amefo!'uu...

~ Y"erebl, m m !'euJ3 33<):?

ll w. II
n_ cn_

ll , lOCR IIl
llll.

, ,
,
, .

lII,
, ,
..:

519

nfUKtJ (}

608

mismatch_response

0,1

2,

')

"

=1

,

. ,

rnismatch_ response,
response 1 2 ,

-,
. ,

i f - 1 se

1 2, .
3. ,
.

u nu ecoomemcsU9 + nu ecoomemCSU9B
=3. u ecoomemctn5ue!
, .

, ,
4 '>.

520

ztJtJ8

- ,

<l . ~

,
.

, , .

n II

3 n mismatcnhJesponse,
n, II
II r, ,
II .
n ,

n
nwr II.

n,
nOnII30BaTenllx, ll
II II

nOnII30BaTenll

II

r n0n. nllII
n n
II,

n0n r
n0n1l.

r
~~II
nw .
_
ll nw ~nw,
nw
,
II.

4)

w, nw
,


n0n n.

521

nu nUtl

u UUUQU3t1UR n

Jmo"'ll) Jqt')pOC

o~u..eu.e,

, , .

u.t')J"'ll)

, ( 3)

"'II) bt u.J

u..t:lu,

$user_responses, t')PUJd.Kd.X

, .

.1f\1f\1f\u..

1l 0Jq1f\..

$query = "SELECT rnr.response_id, rnr . topic_id, rnr.response, rnt . narne


AS topic_narne " .
u. whi~e u.li.3i\5t 5t
i\,
'-tY1)dbt 3~i\di\ 3dliPOCd
"FROM rnisrnatch_response AS rnr "
liPOUi\U. ce .3dt)U.Cu. u. .3di\
"INNER JOIN rnisrnatch_t opic AS rnt "
f.<\..ctccu., 4u.U u.rupopf.<\..ctu,)O
"USING (topic_id) "
liU34< .e.cooi\ei\ci\gu.5\.
t)o.hbo.i\ .
"WERE rnr . user_id

= rnysqli_query($dbc, $query);
$user_responses = array ( ) ;
while ($row = rnysqli_fetch_array ($data)
$data

n f41I.r'

R n

mismatcnh_response,
n,

array-push ($user_responses, $row);

')

} z- OOpaOOi\K
"'1:

n
{) u, whi..(e
Jd.u.i\. f.<\..ctCCu. i\ d.i\

u.#4u,) cex t)p' u3.ctKdX

R r

n,

.Oi\'Yr\i\u. t)Jd'Yr\.

'

R .

, .
~

4-

rJjq ll8.... ..u.1f\ oeJ(Y


:7Yno u..i\u.cptAl<d'Yr\
$rnisrnatch_score = ; ~ ."'ll)1f\1f\u.. 9
11 Jd'Yr\5t
1'(
_ l'
t)Jq1f\u.: '! ou,eJ(q,
KOi\opbtu I1po~ 5ti\
$rnisrnatch_user_id - - , ~eM
Keco01f\e1f\C1f\u.e.
...1

.ct cdoi\e1l1c'Yr\Ete

t)i\.u,u.a.b. Ci\GI'Yr\YCy

$rnisrnatch_topics

..Oi\-m'Yr\u. JO
~ .u, t)Ou.C/{d J"'II)d

array();

11

u,. .Oi\-m-mu...

n
nwr R.

522

l..u. ,3d. .u. J1f\Ou.

t)...u. t) okot-lqu.5!.

/'

I1e..ct u-m
7tn 1\ f.u: )f.1\ ~d..u..
u..-mu.u.d-m
t)eUJd.KO t-lecoo1f\ 1f\1\ u.. ..
t)JGI-m t. .ctu.u {55t t),30q1\5l.U.
n

I\Ou.CKq 1\\ pq t-lbt

-1, !) -u.1\ d. 1f\,


"'II) u. 0Ut-l u.,3 1f\ctbbtx

t),30q1\u. . ,3qI\Ou.

qt-l1f\,"'II), KOt-lt-l,

f.45l1f\t-l.

0
. l>

, . ,

, ,
(, ) , , ,
,
.
.

$user_responses

( )?
,
.

$mismatch_responses.
Yri"!) d.ccu. .9.>t"!) .3.t:1u.

7tn- .accu. .9.u- J.u.5I. li lA3


( h.e.coo---lA 11030~Q-.5I., .9w.~
liu...lA. lA lAW\j. h.e.coo-.--lA.,
$u ser- responses
1

..

..

..

(6.

T~

~r
.
.

$mist h _responses

~
78

d.9U.d"V!\G\ .t:1 .t:1L1.

~O"V!\

l.

79

60

80n ..

80

14

81

>.,

kn.w

-S[

IipU..3.t:1 K O ...."!)fJ"!)"V!\fSu..
.9Py~o.o r,jG\"V!\. -

...

onnt.

~~.
8

...

~1
~

''

e"y!)c"y!)eu.e.

r- m'!1 .:tCC .'!1.


t)O "" '!1 J((
3d.bie ~z

~'l\'!1'!1gu.

d..u-j/Ql'\.

3d.HHbt.MLtld.J L'V<

Kd. .....9u3d.'Y!1Q
t:\ I-'.d.UJI.Y

KeCOO'Y!1ge'Y!1C'Y!1ue.

. l-t~u. I1~.9u.- \J.,lA .j Q


-. }. Q

.., Q .u. Q .3 ..u..

l-t.-g.-Yl\~il o~o.o u. -d. . u....u.,

!\bt li.9.u.-, I1.Q)O'/I\ o.u. u.lA c1.J.YI\.

, ,
, .

foreach

, ,

while

, ,
. ,
,
II .

while ( ... ) {
~

, !. QYl\QYI\,
I-t . u. .9 0 ..

523

for

, ,

for

,
. .

for,

- .

, for ,
- .

for,

, ,

uu,u.aUJ\u,u

($ i).

CJl

'll1u.q
<Jkt

, '1110 eC'II1b

Jl.

"pc6'oeue 'll10 .

"t-o
\l(~-u.

t)epe.9
4qJJ0 u,uKJlQ.

.34.u.

~(
..i:
}

'-...

true,
.

~OUn~ ($user_responses);
I-U<u,u cou.\1t()

CI(OKdu., dY.ge"ll1

,."I\ I.ccuo., 'l\


U\1 0Jb"l\. .

'e~y u~.bl.u.

bu10Sl."II1. \1pu ,:90,

t):9uu u,UKJk:I..

~U 1(0.9' t),..bu1

$ i ,

r--$1

06ll

j.."l\ l(u"l\
bL..u.u u,<J16.,

.34.u.. "ll1Ul('

Ll,<Jk:I. t)u'.u..
e.9uuu,bl.. $i++ -

1r}0 "1110 \..


"II10 $i = $i + 1. '

, .
,

for,

$user_responses

$mismatch_responses

$score

for ($i

if (

$i < count($user_responses); $i++)

array-push($topics, $user_responses[$i] ['topic_name']);

524

s8

nR , nR

IfG 8bl~iiG1h.

Z1111blX ~011OCO~

'9: cn
n foreach?

for

: foreach
, ,

.
,

: ,
, ,

, ,

, .

for,

'9:
8 ?

, ,
,

.
,
, ,
.

,
,
.

'9: 5- ".
,

: ,
,

. ,
.

525

3
~

~ .

ynp~

~ , for, .
$mismatch_responses

$user_responses

76

"

n 80

"

-w

83

u)j? u.)j .3.ctuu.


lleu..3.ctKO .)j)j)ju..,

.btx t'1 0 ' 0\)j,

Ou,eru<.C\

~~u.u.d."!\.

)j. pC\.o u.)j tA.X


.ctu.e.oC\u. "YI1C\K Cl. JIIbt

.d. u..uu,y I\

d.:9 0 .. .d.U..z

."!\~"!\l'l\~u...
f or

($i

i f

.3\\U Cl. Cl...bt.x


(:A.e)jC\::':>
u. u..
Cl.bt.x.
ftr\tA.X

; $i < count ( $user_responses); $i++) {

($..~~r:J.~~9r1~~$.r $.\][r.~~P9r1~~:J + $:m\~:v,,(;:Lr:~FI)$~(~\][r:~F-rl~~]

.. $.sLore.:t:;:; ..1; ..
array-push ( $topics,

mr.

~....

nlt0n,
nlt0n

r nlt0n. n n
n ,

nlt0n r
nlt0n.

526

z8

$score

YnPOURiime ",, ynpaURiime

3w Jlll ")
, ,

(myrnismatch. php),

mymismatch.php
//

//

$query

SELECT FROM rnisrnatch_response

= rnysqli_query ($dbc,

$data

WERE

user_id

= ," .

$_SESSION['user_id']

.'";

Heco01f\e"'ll'\c"'II'\IAe ..'Yl\ dbt'Yl\b u..


.- Q51 'YI\Ooo \jd"'ll'\.,
) ( ~
"'11'\0
.:- .
.. .. n ....... ....."
KO"'ll'\OP~ jd\rwv, d"""'J.

$query);

if (rnysqli_nrn_rows ($data)

!=

// ~ ,
//

//

$query

= SELECT

- JOIN)

rnr.response_id, rnr.topic_id, rnr . response, mt.narne AS topic_narne

.....e:IIE:::---_
....
_ _ 3 t)J"\.

"FROM mismatch_response AS rnr "

JI-lct ~u...u, '-h\ob!.

"INNER JOIN mismatch_topic AS mt USING (topic_id) UJ I-lctodut)u.JI-lctd

WERE

mr . user_id

= '" .

$_SESSION [ 'user_id' ]

$data = rnysqli_query($dbc, $query);

, ";

.O"'ll'\"'ll'\"'II'\u.. I1pIA .fl'uu.

u..q:J<ldLI,U ."\"\"\.

t)Jd"\e5l.

$user_responses = array();
while ($row

= rnysqli_fetch_array ($data) )

array-push($user_respo~s, $row);

~ J<ldCcu.e $user_resp0t)ses ~..)O'/I\.


. " " " - - - ce ..bt 110 I1pUJI-lctd .O"'ll'\"'ll'\"'II'\.
t)jod"\..

}
//

$rnisrnatch_user_id

$mismatch_score

= -1; ~ ~. "epee..bte "'ll'\.u.d)O'/l\


_

$m1.smatch_top1.cS - ( ) ,

t)dpae'Yl\pbt " t)OU.CKd


."'ll'\"'ll'\"'II'\u...

n."\,

3'rr\0 . ce,

!lU"'ll'\

c"YY\pa.u,y'

~
527

yisatch.php

//

//

$query =

"SELECT

user_id

FROM

WERE

mismatch_user

user_id

!=~~~~:[g~:~~~'~~~~
d \JQ ~YVn u;;.bt ~

$data = mysqli_query ($dbc, $query);

u.U,. 11030~1\u.,

while ($row = mysqli_fetch_array($data))

U,l().u. 1\,

//

$query2

response_id, topic_id, response

"SELECT
" WERE

)
FROM

. 1\ 02 02. u.i:U,1\.
.~1\~1\1\u'.

mismatch_response" .

user_id = " . $row [ 'user_id' ]

$data2 = mysqli_query ($dbc, $query2);


$mismatch_responses = array();
u'~~.bt

while ($row2 = mysqli_fetch_array($data2))

CKOoKU,

array-push($mismatch_responses, $row2);

.d.u. U,d)'1\
~I( 1(0.9

u,u.l( WI1i~e.

//

$score =

np

$topics

array() ;
;

$i < count($user_responses); $i++) {

($user_responses[$i] ['response'] + $mismatch_responses[$i] ['response'] == 3) { $score += 1;


.
.
llep'eMe~ 1\eKC1\OO.o 1111d
array-push ($topics, $user_responses [$1] [ , top1c_name' ] ) ; . 2' \J u.U,1\. 1( 1\U,\J i\Jt (2),

g. ~o.o 'h!\o~bL O~

'"

' - - - (\bL

I1u'~~.1\ U, pdlS".u.Q1\
_ _ _ _ _ _----------------~.9:J.:..z_Uu.
__
l1u. 1\U,\Jd \\Jt.
11

11

$mismatch_score

$mismatch_user_id
$mismatch_t opics

fJlbL ce

=
=

$row [ 'user_i d' ];

\ ",----C\d I1q,bt:9u
cYr\pC\.u.u,e, \ 6 1>'
. .3\ .u.....

528

ml(.

_ _ _ _ \J 3 0 ClYr\. ~)'.

array_slice($topics,

~
,:- .YYrI,U, dOl

$score;

\ ll e pOu. )'Ilg\fs'.)O{JJ.,U
.Yr\)'I(u,U,u. ij, Yr\c.l.

.1\Yr\c"tf\u..
1l 0 p.

MUqe..oe

Yr\O IlPu'C'{;'C\u'~eM..3M ru.l


)'u1. .'Yl1~Yr\ Yr\u..

JYr\0'j 110.30dYr\).

nptl8llum , nptl8IIume
/ / , ll'pe~e btou:m .3"!\:\"!\ OUCKq. ..

i f ( $mismatch_user_id ! = - 1 ) {...
~~----

$query

"SELECT

( /
//

usram,

first_am,

\lceau'Y!).bcst, 'i'!\o 4Uf1~ .O"f\~"!\"!\~u

.9~"!\~um. 4u..

lst_am,

city, state, picture FROM mismatch_ user"

$row = mysqli_ fetch_array($data);

~ u.,eu.
1l0.3 0 d:m st

echo '<table><tr><td class="label">';


if

(!mt($rw['first_am'])

echo

$rw['first_am']

i f (!empty($row[

''])

echo $row[ 'city ' ]

. '

&&

&&

, .

!emt($rw[ ' lst_am']))

$rw['lst_am ']

. ' <br /> ';

!empty ($row[ 'state'])) {

, . $row [ 'state ']

t:J,_O
. ~ ~OO .Q U lt..tI!1l1Q
>
'
' <br /
.J
.J

11 Yf\..

if (!empty($row['picture']))
echo

' < i;J

src=" , .

Io1toUPLOD

echo ' </td> < /tr></ table > ';


//

echo '<h4>Bbl

ut($mismth_tis )

: < /h4> ';

foreach ($mismatch_topics a s $topic ) {


echo $topic . '<br /> ';

~ . d.. l1oKdJQYf\b, 110 I(QI(u.,


U,3 I1PUJMI(O ~Yf\.
fieCOOYf\~eYf\CYf\ue.
.

//

echo '<h4>' .
$rw[ ' first _am ' ]

' <
' </ > ' . ' </ h4 > ';

href=v iewprofile . php?user_ id= ' . $mismatch_user_id . ' > '

else
echo

' < > < hrf="qustiir.h" > ,

</ >

' . </ > ';

529

u!

-
n .
>.~ ,
. (

www.headfirstlabs . com/books /hfphp).


mymismatch. php, . navmenu . php,
.
-

(index . php)

. . , .
.,
.

I"\OK~d..I1a.
'-hI) t

u.t
..)O'Yr\ .
u.e.ct.b t-to .
I"\dP OU .

~d u.t l"\oce"'l\u:'tr\

"'l\dt~

t-t"'l\"'l\"'I\u.::.

'fiu.u."'I\. '-hI) ~d. "'f\ u..c:\Jlbt-t

."'l\"'l\"'l\u..

530

z8

n8u , n8u

58 gab1X

, ?

, .

, , ,
l1 .

date

7trJo

l1.ct..ctSl.
~<:t.9{btx
IlpU.u..

i~1\<:t~

o., I{1\

~______~~__ ________1 ~ , ~~=:'~=


scoe

sceenshot

appoved

COXY<:t.st)01}CSl.
~U1\I..z.u,

e.g ebte
11 Jo<:t1\u..

YrI .<:t., ..

, 1\: o.
.... ,3<:t1\,

UI"\'. a.u1\b!..

!)bI. eea:~..o
. .d~.u
r-------------~~~ 1\<:tu~

I"\u...USI.

I-----..........----""""-----------i i u:Y\<:tp.bLe

obt

~l1<:t~."Yl\
d<:t3ou <:trtb!.x

I screenshotl
... J
J..
. JQ

531

gab1J\

, 1?

, . JI1
, , ,
.

~ ,...........-------,
md6I..t$
.m l"\I..t..

)d, mr.bl
.51.m. o':Jeb
.u dm)

.Ndu.J...ii
~ajbl.

aatoJ"\O<I'oo

Ccbl..nKd rt.CI
"'I\ddtAu,y,
~4~)

u"'l\l.2.U

L_--;::::::::!!!!!!!~,_-j

I"\O,30d"'l\, I

IltAJ.9. tA"'I\.

,3 .obtu

.LUU ).

1f:"-v
ddJbt

Y6eec~, lfO ACl". aoapHW.

Coaoiie ""8 ClJ 6n"w

Y6eec~, lfO ._. . . . . II

pd.3

. .CtI pyr pyra.

u . "'I\

n88'I" _.

532

~m "'I\e . t)pdMd
-

"'I\(o

"'I\dbt du:v\.,
"'I\ b!. u..x . ,3ddbl..nW

:rtJ:

.9d..btx IltAl-.

.bte oht

m C"'l\~)01\

t)

"'I\ YYfI

'1:
.. ,_
,.\VI..

nu , nu

Kpoccopg

u MySOL

,
? ,

rn

1. ,

2. ,

. ,

7. ,

4.
.

5.
.

6.
if-else .
10. .
,

,
.

8. ,
, .
9. ,
.

11. .
1 . ,
_ _ _ _ _ '

12. ,

14. ,

533

poccoopg

534

u MySOL

/ , (

MySQL

MySQL, r
.

6.4 ').q"uu,,
t}r.9~QIi.d. JI JU
.
3..tA,St '1~ JQcI. ,
.90.t11}ct~~ .
1}'Yl'l1}JmJ .usu.
e~ .9py~oa: 1}Qu.~U:.

t1tu..~ ~~~ ~Ml{qu

lI'Iduupt., .90)1)u.~"t\.
3<mu. Jd;1)u:ceu'
3.1}

1}QJJu.U,

: u.c:t.
I).9.951u.U:

OdPQdO'Y\KU. ~pJl'Itibt: ~,

.9QrtbIx l).9~

m'Yr},'..i\

. 11

11;11t,~G

lf1;~u,u,

c11t,fo1;u,

U, 110J\30~r11J\1;u,G

-t-

*- 06.,.,,,IO' -..

'1en/, mofo
uun u, um

ocmaol?umb . Hauuy & kakoe-U


m,

pa,l?wy ,/)(

u l?;,opl?y .110m, l?Q3, l?bIuy


) U ocmenet<xb.


. -
.

, ,
, . , ,
, , ,

,
.

537

, u

60
RiskyJobs. biz ,
, .
- : ,
, .
, .

<! ,>
.
, ,
. <!

,>

06

_;;;;==II=t.

-mQ !)'ll1Q. cpop~

~ !)Ou.CI(Q

b\Jb!.Qe'll1

cu,e.ctpu.U, 1(0'I\10bt
u. 'll1 .~f:J}

~ t)Ou.CI(Q

1( oc:t.btx
PQdO'll1 u..u.u,u.u.Py e 'll1
JQtl .ct 11 1(

l , _, Henpoca.

riskyjobs ...
Qd01l'1bt.

Cl88 :

Jd.!)u.cb g 'II1Qdu.u,
riskyjobS.

w 8bCII 88 1

g 'II1Qu.u,

...... .... .

~ 'II1Qu.u, riskyjobs

.9 Q'II1 .

.c:t..u.st PQdO'll1
u. u.x o!)u.CQ.u.st MeC'll1e
.910 !)u.I(Q.u.st
u..~u,u.u. I(Q:90

riskyjobs
litle

descripliQn


...

90210

32801

...

...

...

k .. .

Q:9c:t.. 3ct1iu.cb j.u.KQJ1bKO


u..9'I'\u.c*)lA.u,u.~Q. t)Uro
t)u.., roQ.

538

05701

m.. _

ZIP

stafe

...

PQdO'Vl'\e.

cify

~"Y

..~


."

2008-03-11 10:51 :24

000

2008-03-24 10:51 :24

2008-04-2803: 12:45

45490

2008-05-22 12:34: 17

27701

000 .

2008-06-28 11: 16:30

34139

2008-07-14 10:51 :24

87101

2008-07-24 10:54:05

07030

2008-07-27 11 :22:28

--------j~ l

nen

romo& mOMY,

mt>l oc.yt.lIecm&umb & m

cmamb maOO!'. .. nOUCK &n!'uetiuu


f'uco&aHt>le !'aOombI em HUaoro

e:;Y"bmama!

8..., 808 ...............

xu pew'

- ......... 81faere. en
UOC On/lllIlCA .. nOl!ClC?

-.. *=- _
.........

~ C8010 IDII8JI81O aoty:

;....., ......... &00.0 -


~ ....

$user_search,

SQL-

. ,

riskyj obs

$search_query
"WERE

$result

title

"SELECT

=
=

job_id, title, state, description FROM riskyjobs " .

'$user_search'";

= mysqli_query($dbc, $search_query);

ctt)UU1\ ct o1Y\e1Y\ .! ~
~

539

, n

$user_search,

SQL-

. ,

riskyjobs

state, description FROM riskyjobs "


, , tw..!
"WERE title = '$user_search ' '';
11 dJ.1.4 1'1)010\ 1't)0
$result = mysqli_query($dbc, $ search_query) ; u. cp4tw.G\e.bt.x
G\ruilit.x 11 btr) .tw.u.

.G\. .3G\llpocG\

'---> .. 0 .....'.

u.LW< c'll\.P0zu.: 1'I)0.

coo1'l)e1'l)c1'l)gu.e 1'I)eKc1'l)Y,
e e...DM 1l 0.3 0 G\1'I).

3
SELECT ~ ~
,
. ,

Pezu.c1'l)p YK u.
1I0U.CKG\ . u.ee1'l)
J4tw.,1'I)G\ KG\K

. bt.~G\..tw.

, ' , ,

WHERE MySo.L

, , ,

110

ti tle

riskyjobs

~MaTaop ~:

G\tw.) .

u.1'I)!G\1'l) pe,u.c1'l)pG\
KMlJ.G\1'I)Y !.:

SELECT job_ id, title, descr' tion FROM riskyjobs


WERE title =

' '

----------

OllepG\1'I)0p = 1'I)1'l) 1'I)..

01't)1'l)1'l)u.. II 4.tw.u.
J.G\tw.U C1'I)POK.

, ?
, t i t 1
~MaTaop ~, ~MaTaop~ ,
, ~~ ~
~, , , -

, ,
(

MySQL ) , , ,

WERE

= , ,

, , ,

540

l89

nonQen

sQL-J 60 6

LIKE

, ,
- , .

SQL

LIKE (),
WERE.

LIKE

=.

, LIKE ,

.. , t i t 1 .

SELECT job_id, title, description FROM riskyjobs


WERE

LIKE

,
. ,
:

Ha~

~-------:;g)--

~!i)

LIKE

SQL
- (%) -


.1 , .

,
,

ytnbte U

SQL ,

-
,

SQL

LIKE.

CJ.

LIKE

LIKE:

' ____ %'

,
,
, .
,
.

541

8Q riskyjobs

l , . n
))
n n .

riskyjobs. sql ~ ,

www.headfirstlabs.com/books /hfphp. SQL-

riskyj obs .

MySQL,

r i sky j obs . sql -

, .

, .

SELECT job_id, title, description FROM riskyjobs


WERE

description LIKE

.7'11'\0/11. .3dt)poce
u.t)'ll'\.

OIi~Pd'll'\0P LIKE .
u.'.u. 3dliu.cei1,
I{O'll'\opbtx I(J{
<!escriptiot)

eC'll'\p-d'Yl'\.

.u.~'ll'\.bI.e .

542

'%%'

.....

......


. " " :

www.headfirstlabs.com/books/hfphp

meKcmoewe nnen"

Onepamop UE u

He K o1f\opbt.
bt.Dd)i(,e\'tU.5!J.\

.
, ,

.....
~
.::...----

11

()

.,ym
()

cOO1f\e1f\c1f\t>O~d1f\b

. ~1f\Q1f\
0.9 w pe.e ...o.

LIE

LIE

'%JI'

LIE

LIE

'% %'

'%'

'%%'

LIE '% %'

~~,=
~~~~
I~~~~~
T~CTep

54

nm L/KE umbl

On I1E

u .aru

LIKE. ,

, ?

LIE

'% %'

1,

, liJ ! ,Xk.&1. $. K~

d cu.oM t\.
6~K . ~
LIKE

'%_'

Yn'j bt.d...u.')
. coo'V!)e'V!)c'V!)ye'V!)
c'V!)p0I(C\.

.u. 0.9t:1
-

544

lQQ

I
LIKE '% %'

nntJen

110() ~r>u, ~ '(.7 u (.',


Hecoo~ecye HU () u3 CmrOK , ()~a u

~ "r UCKOMOU r. ~u(), " "


u ()" ra~u~amb nouco~bIe r ~
~ U ucamb u ~ ()u.

s-._,

)(n lt8C ~~~~f8ee, _pocq


- .......... ...., .. IIOOICII?

P.cO we .w. .

1-- ,

al IO PIfCII08&1f1l)lJO 8oty:

~) .

..1

Hd.W t)Ou.CK bt. !. .34u.1\.

1'l\u.., u. !. bL u.a.u. d.
3 u. .3d.u.41\ 110 01\.9.1\u.

Mec1\O 1\O~O. 'l!\dbt u.d.1\

CPPd.JY 3

.3du.41\ u,u...

8I1 l II
", II
ll_ lllt

, Il.
,
,

.
,
,
. ?


SELECT , I1
.

545

PHP-UR explodeO

6 Jl CJl
. .
, ,
,

. , ,
, ,

.
explode ( ) ,
, . :

explode () .

, rp ,

, .

, ,
, . .
- .

Q,3 U"Yl\~

:~ d:9Q

d
:

t)0.9 C"WIpoI(Q

explode( )
~-8IIJI~

. .
,

. . , - . .
, ,

546

$search_words.

.", nOfUJenu

, SELECT,
LIKE OR ,

et)epb bt. UJJJ.,eJ. '\'Yl\'YI\U .

Ot)u.c<:\ue:O (deSCripi:iOI)), <:\ . J-tc\ue.ogque:o


(i:it,f'e), 'YI\d.K Kd.K

ohu.cq.u.u. <lu.'n'I.

__.-....~d.u,u.u . I)OU.CKd. 'Yl\~'n'l'YI\U.


WR

description LIKE

'%%'

OR description LIKE

'%%'

OR

'%%'

description LIKE

, -

, :

"SELECT * FROM riskyjobs";


$where..:...clause

II

$_GET['usersearch'];
$search_words

explode('

"

$user_search);

foreach ($search_words as $word)


$where_clause

.= "

description LIKE '%$word%' OR ";

if (!empty($where_clause))
$search_query .=

00

WERE

$where_clause";

SQL-,
,


,
, ,
, .

, ~

547

nu

,
, SELECT,
OR. ,
vP'~ :

Tet)e~ .bt. U ll\ll\lI\u. I(,J<

(O~~ <tue (deSCrtpi.iOt)). Q . (1(t-u.o<tu

.. ~ _\-._
. / i,.f). lI\QI( I(QI( ohu.ccuw.u .q,ull\..
SELECT * FROM risk~
u.~4u,u.u. . t)ouc.I(Q .ll\~'vr1lI\u..
WERE

descripti o n LIKE

des c ripti o n LIKE

'%%'

OR descripti o n LIKE

'% % '

OR

' % % '

, -

, :

"SELECT * FROM riskyjobs";


"

$where_c l a use

..

$_GET[ ' usersearch'];


$search_words

explode ('

foreach ($search_words
$where_clause

.= "

'. $user_search);
$word)

description LIKE

u:\ 'YI'\o", 'h\o ).. btp<t.u. W'HERE

Ke")C'Yl'\oe. ":9 ,. ct.'YI'\ . 1< t)OU.Cl<oOM)

JC\lipocY.

if (lempty($where_clau s e))

.= " WERE $where_clause" ;


7fC t).) .7'Y\ozo ot)~'YI'\opQ C'YI'\~OKQ.

$search_query

" .

Q<1.t)..r4A5t Ct)r'~Q o'Yl'\ '..z.,; ~5t'Yl'\. ==;o::...,,:,:,;.:.~::::-.-.-...

t: I(., C'YI'\POKU. Q.t)....u .d..

.. .. -

SQL-t,

hea88wepa6ew, _


,
, ,
, .

..

S~IO..~..~P. (\~.~~~Rb~... .... ........ .............. ...... .. ... ....... .. ....... .... .. ....... .. .... ...

W~.~~. ~~~~mr~.i~IJ.~. :?~~m<?:~r~: .9.~.~~~.l1rJ\9.I). J; .~~.1)~~~.9~~~~~:

OR

~~~.if.~i.<?!1. .'.~~~~: )s. ..... ... . ........ ~t\:o:: J~1.0:01')~;~:;::~.:~:~:~Ci


1')

548

Jt:,.r.....u.u. Ja\-)poca!

8 n8

implode()

, , - OR
LIKE WERE, . ?
LIKE ,
, OR ,

. , .

~o r\3U:'1\1,

implode ( ) , , ,
exp l ode (). implode () ,

.:9 t)0.9CYf\P0I(Qu.,
I(~Z.9Q o.u.

J~

$where_clause =

' OR

"

-.

$where_l~st);

l - -.u,u.. iYf\D~ode()

1(0000000pbtu Yf\Q- 11-

~.9u.5!.)OYf\- .9.

\J} CYf\DOI(\J
-~

J"

~ 7tnO .. ~bI."1\ }.du.~


I}"1\I KO"1\Pbl.e

~bI. xo"*,u:me ~.u..u."1\

0.3 QQYf\ .9. CYf\POI<y.

. o~~}o "1\.

OR?

, ,
.
'

OR " WERE,
OR LIKE.

-,

OR

implode ( ) .

549

Q QQQ

$where_ clause

S50

l9

_ non_en

--
II.. . .
3rp . .

www.headfirstlabs.com/books/hfphp.

search . php ,

, ,
,

search . html.

3rp .
- search . html .

, ,
. .
.,

implode ().

l 808. IOopojlw _. 8.
lI8C p8WMOCII onp.'_ , .. ?

. . .

ow
uop_

........08. 6:

----....-. . . .

I<aKOU 50JJU ~50p ~aaHc!

I:C)1l

_._~---""

~, m fomo~ ~bjcmynamb

~ m~ 50

---.o-poouw

_ ........

=:=,:.'1:':'"~

lapo6cna .. - - _ 0 1 1 8 - 0 1 .

mm peoHmy 5KO~,
, ", Mof 5 Haumu paOomy MoeU m ...

---~

n03".

----............ _........

~:':'=~-="
.... 110.,....._. __ -c............. ~ ..... co..;

8...

aoeIIi-=r_~--

20081\14
11:22:28

blmb

l . - . .
& & ?

. .
ll8ll

paow

.................
acte

8>IIIUIOI

Omi

ar

... _. _ _ ac:yccne

Jlun.

__

..".....,..,~oe.copou

"""'""JI8PY..........- .

..

c:aapeoreao8 oy.\aIu. .--..


IIJJ8

_tn8OO

.. llWp)' 8l1li

. .

Qe ...

pu......,.........

.._ ..

qYrYID p815cny.

.......

)'811.110n C8DpOIIIIOO ..,.....,_ _

....,.. u.

2008-11-14

21 :13:3S

cpou. 1'DIIIo1O. QII)JR -........-.

__

ara

IO

_ _ C8III88C.""

~_

... QPY. tu:

.......... _ , . , . . . . _.....

1OI"JI&8IICII....... ~K . . . . . _ .

5yn............ ...uy1l<a.

"'f<IIIY. ~ un

oaepl'lly'l'll .~

'llll8l'Ult8lDl1ICIIU'fU8D(

CIIOC06tIOCnJI awn. _ pt,IIIctU81eII88


..........wa. ....... .,......, !IY'I8 CIY.Yr .... " yat1U>
lI8IIIIDt

.1IJI1'8IOIO

ld8C'nP ~_.

: D"'''' JIY'IIIIOIV ape~.


_

....... . . . - ........ u6oJD.1ll0IILWcore, ..........


"""'" acero. 7rII p8ora jIIIJI 8. K-.wI! ... IIOIII
atllll1'UCllel aPI1IIIQUI ...... DCJI 113 43 nyIIJm>8.

._"_IIpOIIOIIII.

no .. .........-... pe.rrc8 ccn.

~'JIIIUmIYIO

......... 6wn ... ,

c:en:y. ... ........

....... CaOI ~ ......... 1Iep'I8I . 3eG,.a

aPe.!IIIJI8JfII ycwo. IrI........ _

pt,IIIn.

_...,....... ......... pa6cnw. _ _ oro. ...


IIC8e'n

a:paogrn. ClDa : III'OI.

18UII'IIIIU
.-....

CIPCII1>8 _ 0 1 IIIIQ.... ""'""


3 CIIPIIUII.

1IL1IID'I..,_e

1IUCIIJII8.Uo0II

552

aepeIIII)'IO +

8,..._.
lQ:III'III:eC'11N

~IIDIOII

. . . . . UQl88lCIIIO

n ""

1'en

1'?

"~{)~
.... --."-''''~;J i

SQL-, ,
, ,

. ,

~ '-'.:

'~! .t!

,, ;

~UleHue u
SQL-, ,
, ,

. ,

.$~~IO..~.~Q~.r~~~,'j~C?~$................................................................................. .

explodeO n03Bon.eT 6

,
cn .

explode ()

, ,

,
, .

explode ()

, ,

explode (),


, ,

explode ().

, ,

554

8 8

0660
explode ( ) ,
. ?

, explode () ,
. ,

,
,
.

pegsaume89
ospasoma

nOO5OAgeIt\
ygau11

Ne
CU1

u3
,

... ..7"1\ ...

cmpo.u

u osum
gaettwy

a;pasomy

.... "IY\..9~ CPYJ<u,ust exp-d


.9~C"lY\ \ ..7"1\!

He"lY\
l.U(~Kx.

J~I)51."IY\bI.x'

$search_words
}fG

8bJ~ii.G'th,

64111 ~011YOCO~

~.
-. .. ..cnon ooro "

, , .

paJenteml " paJ6eH .... ..

. .

OblO .... expolodeOl

: , ",

-. : ,

, ,

: ,

, .

expolode ()

, .

expolode(', ' $user_search},


,

,
,,

, , ,
.

555

PHP-UR 5tcreplDCe()

3 HeHYJHe CltM80Jlbl
. .
.
. - str_replace ( )
. ,
: , , , ,
, .

vrI 110.9c:mP0l<d, KO"V'I\0pylO

~ xo'W\u:me 3de .u'W\b ...

str_replace ( )

nO""HJJ:me?

m 110.9C""'P0J<d,

I(""') bt. xcyw\u"",e

,3de.u"",b...

r-

$clean_search = str_replace(',', "

...d

1'I\ t)0.9C'W\POKd. KO'W\0P~)O

~ xO"V'l\u'W\e. c'W\du'W\b .. ""e.c'W\o.


',

~e.3.9e., ~.9e. 1'I\ ""'

K~aToxoe,

');

""'.d"",. .Jd11."",d. ~Y.ge"",

3de.eA t)..

$l_srh

str_replace ( ) ? ,

, ?

556

lD9

, , ,

$search_words

,
.

$l_ srh

str_repl ace(' ,',

$search_ words

explode('

"

'

$user_ search};

$l_ srh} ;

$search_words

It.ct! ~

$search_words

$search_words

2 It.ct! ~
, ,

$search_words

557

, , ,

$search_words

,
.

$clean_search

str_replace(' , ' , , "

$search_words

explode('

"

$user_search};

$clean_ search};

~u qd. ..Yf\d. 4Ud

II,'jCYf\t.u. UJ-3d Yf\ex 'j UUl.UX


u... lI".d. IIOUCKOOU. CYf\POKe.

.'J f{dU .4Yf\d.9 0 U Ud.

3 u...d.ll ..'\

t)Yr\ d t)yCYr\bt.x
.Yr\d #4ccue
UJ-Jd Yr\, 'Yf\

2 u.... ~Jdt)Yr\d. 3d.e..e.


~

U t)pode.lJd.

t)d. .

, ,

558

9\

_lllO, . "lt lllt


IIIt II,
IlII " " ,
_r ll, r II. .

, , ,

? ,
.

$search_words

,
, - :

SELECT

FROM riskyjobs
description LIE '%%' OR
description LIE '% %' OR
description LIE '% %' OR
escri tion LIE '% %' OR
description LIE '%%'

WEaE

l ll" CII _
, " _

"
. .

, ,
, ,
, . ,

r i s ky j obs

.
, SQL-,

, ~

559

iJQ

3 6
Jl Jl
,
,
. ,
.
,

,
,

SELECT.

foreach
i f,

. ,
. :

$search_words

..

7mU. t)YC)1)bt.x

, "lO

.."Yr\ ::Icca

KOToporo

bt ~bt)1)b

. ,

d.bt!

n"
.

~
Hogbtu. Qcc , t)O"Yr\oM~ 'h\o
. )f."Yr\ "Yr\o.i1bKO .\bt
u."Yr\gu."Yr\.btu. u."Yr\u...u.
t)ou.cKd u. . )4"Yr\ .u.(

l1~c"Yr\btx .."Yr\!

560

., nons08tlmenblIe

HenVCTblX Jl
,

$search_words $ f inal_search_words.
$search_query = "SELECT * FROM riskyjobs";

//

3.9 t-. .oo.o:


Jd.. 3dI'\SI.'VY\bt.e

$clean_search = str_replace(',', ' " $user_search);


~ c~ojI,dJN.J. \"\~.
$s earch words = expl ode(' " $clean_search);
I'\) :-JIJ,L
&!!">{' "
K~ "~
= array () ;
stcrepJdceO.
if (count($s earch_words) > ) {
foreach ($search_words as $word)
pox0.9U J.l< 1')0
if ( !empty($word)) {
~
d:90
~..lj' ..o.CCUd
. " ,:~' ':';~"' *';' """ ,[] = $word;

$searclL.worcls. d:>fC:91
et).Y CljOu. ~.1j.90~..
~CCU $fil)d~_searcLwortfs.

, $search_words
,

foreach

. ,

[] $ f inal_search_words.

.
?

SELECT ,

, ,

$ f inal_search_words

//

$search_words:

if' (count
fo reach
$where_list []

) >

as $word)
"descript ion '%$word%'";

~0"f\ .9 'VY\. 'VY\dKOU


)I(.e.. 'VY\0'VY\, KO'VY\0F'-U
~ u\,,\0.30o.u. .,

. ~'VY\O'VY\ ~

$where_clause = implode(' OR "

$where_list);

// Add the keyword WERE clause to the search query


if (!empty($where_clause)) {
$search_query .= " WERE $where_clause";

u\,,\.'VY\. t.ccu

$f\I)dJ_sedr~-worcis,
KO'VY\0p0M .'VY\ f\YC'VY\W<

.'VY\o'

, .
,
., , .:

SELECT

* FROM riskyjobs


0 ,

WERE

description LIKE '%6%' OR


description LIKE '%%' OR
description LIKE '%%'

561

u search.php

--
, 'IO.. n.0n.
n.. , n.0n.

search. php , explode ( )


implode ( ) , ,

SELECT. -

--

hco.a we . e:JyJ.8 .

. P06Cm.J

.........
"4 -

--562

l9

2008-1~14

21:I:j

2008-11-14
21:17:16

r,.ua er &, u uU
rMom UUJ . m ur

uru. DOlOCb, ,.UJ rmum t


hrd!7s.m, KomOrOM &&uum m m
t1Uu, m t10&em rm oU mru

UJ &U &u.

JI.IO
IIW , II
. - , JIl, CIIw.

, ,

.
, ,

, , ,
,
:

563

PHP-UR substr()


~ ~
, ,
, .

,
, ,

-<}'U9

substr () .

, ,

. :

substr($string, start, length)

~
_ ")

Yl\ t1z,Ub~v

rrt Jfic:\d.'ll) !Jt1U,


I<O'll)opOU .9 0...

1\ , u,3 KO,OPOu.
jJJ,i. XOYl\u.. LL3

fic:\d.'II) UJ.u.

I\O.9C1\?OK~.

!.9'll)I(u....

C'll)pol(e,

substr ( ) ,

... YI\ 0Yl\


.u.Yl\

sustrO
nm50AgeI11
ue
u
actnb.

u,3bu<
u...

,
. :

$job_desc

'

. ?

';

, ,
, .

i\\~~ CII~

rrc orJ1 1t?

///

.. . 50 51 52

012 3 4 5 6 7 8 9 ...

substr ()

, :

--------~~ substr($job_desc, 4, 3)

J 2 u.d.,
t-tctu.t-tct t)0Ju.u,u.t11.3.

--___

-----3.~

------------------~. ?

substr($job_desc, 49)

d.'II) UJ.u.
!Jt1u,u.u. 61 u., 'll)al<
I<l( #hr. . !.9d.t1

substr($job_desc,

3) --------------------~.~

substr($job_desc,

9)

Jd..u. 'll)'ll).

d..,-.'II), t1Jl<"Vl\
.90 I<0.u,ct C"VI\P0I<u..

564

z9

...

", nonuu

subs tr ()

. , .

,
.

- 53 - 52 -5 1 -50 .. .

-3 -2 -1

9
~substr($job_desc , -53 , 7)--~________~------~.~
~~~
\')~u,u~ -"f1.
\ct1) UJ.u.

substr ($job_desc, -9)

____________~~~_:~---t~~

\')oU.u,u.u. -8 u. UJ\1)~
.90 1{0KU,d 1)I(..

-,

HTML

,
, .

e c ho ' <table border="O" cellpadding= "2" > ';


echo

' < td> </td~<td> < /td><td >m</td> < td>< / td>';

while ($row = mysqli_fetch_array($result))


echo ' <tr class="results'>';
echo '<td valign="top" width ='20%" > '

$row[ 'title']

. '</td>';

echo '<td valign="top" width="50%" > '


echo '<td valign="top" width="10%" > '
echo ' <td valign="top" width=" 2 0%" > '

.
$row['state']

' </ td> ';

' </ td> ';


'</td> ' ;

echo ' </ tr > ';

echo '</table> '; -

565

...

~Ul88 . u
-,

HTML .

,
,
, .

echo '<table border="O" cellpadding="2">';


echo

'<td> </td><td>n</td><td></td><td></td>';

whi1e ($row = mysqli_fetch_array ($resul t) )

~. ..O"I\u. KoKu,e

~C'VI\b tlu.d.u..

echo '<tr class="results">';

C'VI\poKu.,

'VI\~ d'Vl\ 1')O..'VI\, 'VI\ 'VI\ 'VI\

$row['title']

'</td>';

echo '<td valign="top" width="50%">'

.su~~Jr.(~r~~J:.~~~r.~r~~<?!)'J 0,1.00) .' ... </td>';

echo '<td valign="top width="10%">'

. $row['state']

'</td>';
'</td>';

echo '</tr>' ;

echo '</table>';

<.1 sumbI

"' 5bJjiiG't1I.

Z'ifllbJX ~OllfOCO~

~: IUI
..


0 -

substr ()
MySQL SUBSTRING ( ) ,
, substr ().

substr()

.'ll1II

IIoI .....1

: , .. ..
ne". ecn " cno

CAR. VARCAR , 38lle

.. cn

1, , -.

100

, .. cny

SELECT SUBSTRING(job_description, 1, 100)


FROM riscyjobs;

~: er, ecn nePea1 lll"

substr ().
substr()

I1IIH nOCPOIOI enll 6onllWY!O,

0 - ,

n'" cei 1 eper

OIOIII po6enoa lIOIIIIecnte,

, . 0 SQL-

""..... COOIIIeC1IOI

_ _"101

: . ..

n . ..,
no cn

566

s9

.: sustr(':

0,10).

" -- - - - - . , ltlfl
, , r .n
search . php , subs t r ()
,
. -

8__1 . ~oopoa IIW . .

XI81I 88 pewQC onl 8 ?

.lCO...... pa6ow. .

OnBC8IIIIe

8I
2001-11-14

--

AptDO. .

I1rWI1, m

2008-11 - 14

21108-11 - 14

r,mm u omcormurol?aHbI
110 () rerumruu u 110 mm.
I1romul? 8"
) I? '.

el'lepb u. 3d.1fIY 1fld.


.cv-\.o~o ~

oCl'lpU.~1fIb, 1fId.K Kd.K


t)OKd.Jd.d 1fI 3d.1fId.,

d. . 3d.1fId.

u. ..

,
,

567

o6aneHe

Jl

JanpOCOB JJl
peJVJlbTaTbI Hawero
,
, ,
. , ... ?

HTML,
. ,
, .

11 OJbJOC\1I1
MO)f(,e1l1 p<:I30f<:l1l1.
I'))f(,ef5!.u

1I1ct1l1 Jb.,
01l1 CO P1l1UpoC\
1l1\"II\bI. 1')0ucKC\
1')0 >Od UJ w)ux

..8. .1 8608. arop IIW - - : - . ; .: : - .


88 _ pewlIQC omp.8~

I(.l(. ~bI. .

t) pepc:\1I1U"ll\b w)u
4w.\.q.u..
~Ut)bl.I(U,
vr10dbl. t)pe.90c1l1c\U"!'l\b
t) 30:\"!'I\)

P.Co we p.60w. .ll.8 .


~-----

-..-....

8C1epBO

I(Mt)I(OU
4 >Od
w< .9 b!Aopc:\
)f(,:\~

t)c:\fC\"'e"Yr\j>c:\
COP"II\UPoKtJ..

, ,
. ,

ORDER .
,

, ,
.

SQL- :

SELECT
WERE

568

FROM riskyjobs
description LIE '%aTa~op%' OR
... ion LIE. '%%' OR description

LIE

'%IoDt%'

8 n80


, .

, , .

?
?

569

ORDER m nOUCKOSOZO n

, .
, , .

.. ~D..:IO. .~..~p~ .(\$.~~~R~~........ .... ........ .... .. .. ................. .... .... .. ............ .. .... .... .
.....wtJ.E.S~. ~~~~r.i.t.iR~JJ.:%~~~%:_QR .4~~~r\.t\9.1)..~rr;. :~.9KtW.~_Q.K .....
....~~.~r.if.~i.q!l . ~. :.~.~~~~.~p.~~.~:~ ............................................................
~....QRP.~. ~1. j9.~_1!~~............................................................................. ....... .

WOJbL~~;oM .. SE\..fCI.~..FRDA\r.is.k~aabs........................... ,....... ........ ........... ....................... .


110 ~'d.

.....'tI.. de.scrjrfiat\ .\.lE: %.u(%:~QR .cLeSc.riptiQQ..I..!I . : %o)(.o.%~OR. .....

~::;~u.Ci
.... des.cr.tpii.ol1 .\.IE :.%.e~ac.pe~.%: ............ ......................... ........................... .
(ASCel1diI19) 110.90 . .... ORDE&. .si~t~ ........ ............. ......... .......... .................... ..............................
d.. JO.I1u.cb
dd.u.4 .3d l1U.cu.: ..SEkfCI .~..fRO. .riS.k~~Qbs.......... ..... .......... ..... ..................... ...................... .....

ODRLR ~) jOb_1:ie
.....'tI.tt. df<s$<rJpiiQt\ .\..IE.: %Q~W{%:_QR .deSc.rip.ti(>'l)..\.... : %.QKQ.%_OR.. .....
ASC.
.....&~$.<ir.if:t.i.Qn. klt: .'.%o~~Qc.Kr~~.% : .... ........... ............................ .... ...... .......... ..
....QR.D.E&. ~ 4~:t.~_p.q$.t~d ...................... ................................................. .... ....

'PI!. .u. !.

u.l).~"tIj
"tIjdKu.e .dl1fbt.
4l)pu.ep, u.
."tljd"tljbL

,
?
?

~: bt..l::
.u..,

.. sEkfCI .~..FR.Q..r.i$.k~jQs .. .................... ....... .............. ...................................


't/t{t:'Pt:'
.1
. t
Lll<t:' '. - I '' QI? .1
. +.
\}I<t:' '
' QI?
........
~. f<s!<r ..'Qt:\ .. l\l... .. .'! . .. . v,""'I ..'!_ . 1.'\ . lj\eScXlp.~19.1)...J.J~ .. p.QKQ.. 9_ r.-.... . .
....~~$.(tr.if:t.i.qn . klt: .'.%o~~Q~~p.~~.%: ............................... ..... ........... ...... ....... .. .. .

I). .

.... QRD.E.S.1.j9._~~..D.. .............................................................................

(1)0 ,d.u.))
l1 . .u
)(u., I{

1)0.d"tlj
d"tlj
I1"tlj

4 "tIju:

.u.l1 bt ,

~ t).5{"tIj.
Yr}0

01{ "tlj

UJe.u."tIjb

.u..u.U

t). 4

.u.u.

570

zs9

.. SEkfCI.~..fRO..ris.k~~Qs...... .. .......................... ........ ... .. ................ .. ............ .


...:tI.tt. de.s~r1iiQt\ .\..I.:%Qv.W{%~QR .ds.ri.ti().I). },..:>.Q'.%_ ......
.... ~~$.<ir.tp:t~Qn. \..lt: .'.%.~~Q~~.%: ... ........................ .................... ................. .
... .QR.D.E&. BJ ..$:tc;l.t~.D:ESC............................................................. .. ................... .

..~~IO. .~..~p~..t:'\$.~~j~~~..... ..... ..... ... ... ... ... ........ ........ ...... ..... .... .. ....... ..... ..... .
.....w~.~~.~~~.i.t.i~~.\.J~. :%~~.~:~qR .9.~~~t:1.t\9.1).}S[:~?tW.~~Q .....
.....q~~if.~i.q!l . ~..'.~.~~~~.~p~~.~: .................................................................

....QRP.~. ~1..~:t:~.....!??t~~ ..................................................... .................. .

nOn308en

l1, nl'lem nucamb


or utJYlOUlef 03Uatlu & 3mU)(

ny.ro&. f~ &3ocmU u~m

no&m0I'Horo nUCatlU co3UatlU


nf'OCO& mruubl UU ~ UJUmb I'3:?

_ .03O)l(ocn. eCl'lt. .petl


... 8ll .......nOIlH... "...
.... .... nOllIt30llCll'8ll8M ",
r"'II n_ ., 8CI'It 03O)l(ocn.
aIt 8", , .",
rneWll.
,

, ,
. ,

, ,
ORDER .
, ,

. ,

URL

,
, , ,
,
WERE ORDER . ,

sort, .

.
WERE,
.

sort - -

sort, ,

ORDER

, .
.
. , ,
...

571

n -uu

V Jl0

, ,

.
-.

substr ()

mysqli_query ()

Explode (),

.

,

30m
uu
n6091

yam ug

Koga gAS1

, . 1 ..
, , ,

1nStn

..HOOKpamo.

, ,

, .
, - ,
, :

~ d,Yf) d,.rtYf)d. cpytU<u.u.u. lI~.9ct'Yf\.


C'YY\P OKct Kctl:.\~, d.I:.\l'f\u,. . ~
$clean_search

= replace_commas('tightrope,

~J{u,u.. ~Jgctd,~ rlogyro


572

C'I))POKY,

/(O'Vrjopou. .jct\i'l))bt c34e .ebt


cu.o.. II.
9

walker, circus');

3l 31l n30l n30ln V


, ,
. ,
,

Mbt. \l.ct CPyt-LIJ.,u.U,


g ct'lY\~ ctpZJ'MeKYr1d,
d.ccu, $use.r_sectrci),
I\O'Y1\0Pbt.u !.. .3d.U,

bui ld_query ( ) :

u,l').hb.3Ji 9a ..bLe,

e...gef-U-I.bte \l.3 0ctYr1


g \lOU.CKOY)() cpOfMJi.

//
$clean_search = str_replace(',', ' " $user_search);
$search_words = explode(' " $clean_search);
$final_search_words = array();
if (count($search_words) > ) {
foreach ($search_words as $word)
if (!empty($word
{
$final_search_words[] = $word;

.ymu. 1.J<t
u.z ,f>'...

//

WERE

$where_list = array();
if (count($final_search_words) > ) {
foreach($final_search_words as $word)
$where_list[] = "description LIKE '%$word%''';

$where_clause = implode(' OR "

$where_list);

// WHERE
if (!empty($where_clause)}
$search_query .= " WERE $where_clause"i

_ - - - -_____

"01j ~'\u,.u. . .Yf\ct. 3


!.. .3dct .oy)() CYf\pm<y .3ct\lf OCd
. 1jo,o, 'Yr10~bt ...9' bt.3fJctu., <.u,,
. u,Il'0ctYr1 3-'Y1\o-m .3c1.l\poc.

bui ld_query () SQL-,


$user_search_

, ,
, ,

$search_query

11

$search_query

build_query($user_search) ;

n..U $sea.rci)_C\uery ~.34Ye.ue 3-"I'\o llepemeHJ-lOU


I1pU.cctu.cte'Y1\C51 ,,ctd. .
.u,u. 3J-ld..u.., 3-Yf\ ~\kJ. 4 .btU I\U.bt, "c1.tlfOC-

coo-mYr1Yf\.Yf\..9-!J-l1.. ee.ge~
t)JGIYf)- t)OU.CKOYro .
,

573

nu

~ :

:
?
ead

, :

,
.

, ?

. ,

First:

,
.

.
.

eod

First: tl

, .
,

: ,

, ?

- . ,

, - .
.

Head First: ?

:
?
,

, !
, .

Head First: ?

: ,

.Q

: !

, .
,

. ,

eod

First:

First:

:
, . ,

Jf.

ead

pe.Q eod


, ,

First:

. .

- .

. .

: .

?
- .

, ?
,
, ,
,

, .

eod

First:

, ,

: ,
, !

574

,
, .


- , .

ead

First: ~I

. .

:
.

n0

--
, ... " ..

Sl

build_query().

search. php bui ld_query ( ) ,

implode ( ) . -
, , .

3ma ti~ nll.30m tiu


\?uild_,\Uef"(), "", )(\?OLlJ, t " tie COj?murrem
j?Jllmm . MO(IIU rwm tiuu ete o()Uti
Metim, m otia MO(lIa \?euJumb Umy y:iiJ'f

~--~

Sl . ..

build_query()

OAHoro.

$user_search,

, .
, $sort,

. $sort

, :
,
.
(ORDER
) $sort.

1 6
He l11 cepbe.3.btx

, :

!. ebtdOd.JllJ.. ..7Yfju.
u.\

I .

u. u.x .3tld.u5l

ep~e...o

~d.u..

~"Yfl
,.Yfju.x
1")0 u.x

:)g"Yfl

I!fd. UJ1

et:op~.

cooYfj(SeYfjcYIj u5L

$sort

1:> ORDER

$ sort

2:> ORDER

job_title

Oc.ot;'C\uU .

COPI11u.p0t5l<u 1"10

j ob_ t i t 1 DESC

$sort

3:> ORDER

$sort

4:> ORDER

$sort

5:> ORDER date-posted

sort

state
state DESC

6:> ORDER date-posted DESC

OI")U.C4.u.ro pC\dOYfjbt.,11}C\K
t")..u.

..7YfjOU ~OPNt.u,u.u.

t5 cV1rh g
'j'C\

u.Yr)nM 1l 0 .

.. Vw.<.:l'WI

'''1

? - ,

(ORDER )

, URL .

riskyjobs,

.
I.

575

, fI fl, 'I11t1 31110111 (;


apryMeI1l11 ~sol"\:, neQu, u
()fl 8'I11 atl eU CPYHK~ u
(;l11 ()el1 (rn 08' 31110:?

, llll ll ll, .

" , ,
T .

, :
.

- , ,

build_query ()

.eoxoau.o l\et>ejctepYjlJ."Y\b

J
I
c-mpct.u.u,y t). iY\oeo,

I\jgd,iY\ w,..iY\

.j11 ct-m t)OlJ.CKd. $sort URL:


COj.9d.e1Y)c5t g u.
HTft\L-'YI\d.du.bt.

o-rt] t)QYeM,Y

1\.u. <td ;>.

$sort_links ~<td><a href='"

.3 -

, ?usersearch='

ct
... bU.i~(C(juer\l()
d u..bt e

bUlct)W\:J)G' .d. d..

'

&:srt="></>< /td>' ;
(

1.)

t-td,U}JI..-Lu.u. I-U,
\l-"!\. f.N:Jt COj.9ct e.M }

$SERVER[ 'PHP_SELF']

. $user_search

KoOI1~<o(1 bt.u. .d. d,l{.-u.d

...bt t)jct'Yll.
~pu.'YIlepu.u. t)OU.CKct, 1\bL Mbt. u. \JD\""
t> COC'l'Y}d.e UR.L..
I

f"..bL \je.pe.9d e. u..cj:)(IPd~/'O JlGed t)0p~Ke

COP'I'I)U.~ogKU. peJ.)'iIb'hJQ11'!o t)Ou.cKd.

I(dl(

-irJ

\-j6I(:\, am11'!m,'j)d. I{l- md"'!11,

l1d.pcte"'!11p sori. pcteK .

~ )

<<( d

sort

URL,

, <?, ,

href,,,,' sctr~_~?u.srs:\rd,=roD%9%D%%D.1%3 2%DO%'RO%DO'Y- \:. 'YcD

%%.1%%20
%DO%~F%DO%BI%DO%
J51%DO%~5%DO%~4%
%8%.1%82%%

!35
%~ %r~ %~.1 %~C% 2
% %131 %.1 %8> %D %
~A %%15%0%

~2&sor 1"'.1

____

"

/l1li1';

, lIi

;.

l . , .
?

VV i''''IU'I-'<J Il\q

\10

Jd.JJ

ot}u.c<.\J-.)

'-I"Yr\<J ..9<.\'\'},
..!.

. Jl~

.Oj)f

u...ge

tl n30Q

. uatO, 311U f\.I.u ra5ol1a.!Ol1


s;I ")( )( ~anpoco", 1'10 OOcmOs;lm
u r, 'r~ 1<0110PM Mbl >tl
l1 r~1l1 , l1~tl
~ ocxoo~[e nO~OKe~ ru~
~--~

:
, .

: ,

, .
: , -
,

,
, ?
: , .
: .
. ,

~,

URL

URL

, .
: . ,

URL , ,
URL, , .

: . , ,

URL

, ?

: , !

if?

, ?

: , , , ,
, . ,
,

i f -else.

: ,
, .

swi tch

( ) , .

: . .

: . ,

if-else , .

: . ,

swi tch -

, ...

G ~

577

nRR SWITCH

.n r

SWITCH

Ci HrJHOe w

3 .n .nw B03MOlHX ,

Ynpa1W1UJ89

swi tch

Kocmpy\tU9

SWfrn cocm

. -,
i f

-el se,

u3

u3

swi tch, case.


swi t ch
. break,
, swi tch,

syge nepegao
yneue.

- .

ucu

switch:
~_

-- _/I t) .'f!Dd~u.

om
3}l.eus,

nepeMemIOu

1.

~t1OI-(.

'

~..u. . . i)

~ u.K'h1t;pllpe"l)o.i'r1~~ fHP t)~pe.9o."'tY)b

t"!:\'.. l")eE~U C"I)pdl<e I{1 t)

lld.f]rou. l(."'tY)J{~U sWiich.

' .

10

" - - m"Yr\

.)J

';

- "Yr\

t:I10.., "Yr\ ec~.


4.ctu ller.eMe.rlOU

~bet)efit__GO~e f.f]. 1..

';

break;

3:

4:

Iu. b!. x0"Yr\u."yy\e, Yrlbt O.9UI-l u. "Yr\o"Yr\ . .9

t:l10.5{51 . 9~X u. 3.ctuu. t\epeMeMoCi., IiPOCl\O


\1O}.t\ec"Yr\u."yy\e . t10 \iu.l-l.btX Me"Yr\0J.(.

$benefits =

' !';

break;
default:
$benefits

= '. ' ;

Iu. t).....5l u..eeYf\ 30


1., 2, 3 u.u. 4, W1

.3d...u.. .

btl).. "'tY)"!) 3l< ..

. d.}. "Yr\ "Yr\pu.

t)(;"Yr\., "Yr\dK I\d.K 3 u. 4 Me"Yr\Ku. ... u. "\. .

578

',

..,

J{OKCi'r1pYJ<~u.u. S"Witd\, J4..


Kocrnpy1JUU
~t)lYj, I{(. J ~I( I{. \JQi)

switch ($benefit_code) (

Koga.

Kaotl

swi tch ,

$benefits

Koga

I break ,

break;
2:

C60tl

. ,

$benefits =

gas

OCXJaaem

CASE.

i f - 1 s

IF

' . $benefits;

t)<"Yf\d: .el\Koa. 3 ,
. G~9~"Yr\ .u.I{(. l{d
d, f5;ct bredk.

generate_sort_links ( ),
. ,

. . ,
: 1 , 2

,
,

4 =

3 =
, 5 =

= .

generate_sort_links($user_search, $sort)
$sort~links

= ";

............... ($sort)
case 1:
$sort_links .= '<td><a href = '"
'&sort= ........

. $_SERVER['PHP_SELF']

$sort_links .= '<td><a href =


'&sort= ........

">< I >< I

$_SERVER['PHP_SELF']

'?usersearch='
;

'?usersearch='

td>' ;

$sort_links .= '<td><a href = '"


'&sort= ........

"> </></td><td></td>,

"></></td> ,

$_SERVER['PHP_SELF']

'?usersearch='

. $_SERVER['PHP_SELF']

'?usersearch='

. $user_search .

3:

$sort_links .= '<td><a href = '"

"> </></td><td></td>';

'&sort=

$sort_links .= '<td><a href =

$_SERVER['PHP_SELF']

'?usersearch='

'&sort= ........ "><1 >< I td>' ;


$sort_links .= '<td><a href = '"

. $_ SERVER['PHP_SELF']

'?usersearch='

. $_SERVER['PHP_SELF']

'?usersearch='

$user_search .

'&sort= ........ "></></td>, ;


case 5:
$sort_links

.=

'&sort=

'<td><a href = '"

"> </></td><td></td>';

$sort_links .= '<td><a href


, &sort = ........

">< I >< I

'?usersearch='

td>' ;

$sort links .= '<td><a href = "'


'&sort= . .......

"></></td>,

$sort_links .= '<td><a href = "'


'&sort=

. $_SERVER['PHP_SELF']

'?usersearch='

. $user_search .

. $_SERVER['PHP_SELF']

'?usersearch='

"> </></td><td></td>,

$sort links .= '<td><a href =

$_SERVER['PHP_SELF']

'?usersearch='

'&sort= ........ "></></td>' ;


$sort_links .= '<td><a href =

'&sort= ........ "></></td>';

return

$_SERVER['PHP_SELF']

'?usersearch='

. $user_search .

~o 1\0,9 C03,9d..u5l 3d...g 1)0 ..d.1lto,


-~.- - 11'\u. jd..u. l).g}OYYl., ,d.
l')~ct'Yf) . bt.!, .u.G\.. Yr\od
COPYf\U.pogKIJ..

579

QswQR generate..... sor(,.1inks(}

generate_sort_links (),
. ,

. . ,
: 1 , 2
, 3 =
, 4 = , 5 =
, 6 = .

..fU.t\C.tiOQ ..

generate_sort_links($user_search, $sort)

=";

$sort_links

.SW.ltdt ... . ($ s ort)


ca s e 1:
$sort_links
, &sort =

.=

Iu. li....Ltd5l $sort \..1'f\ 3.d.u.. i, .-1\ ~tw.d..'\, "m


d.~e. : 01'f\cop'Y\u.pod.bL 1"\0 l<..d.() '\ u d

~~.}'\ ll e pec o p"Yr)u.p o<:\'Y\b !. .u.5l. IIf..9 /

'<td><a href

= '"

.2 .. ... ">

$sort_links .=

$_SERVER['PHP_SELF']

' ?usersearch='

< / > < / td>< td >< / td> ' ;

' < td><a href =

$_SERVER[ ' PHP_SELF']

'?usersearch='

.3.. ... " > </ a >< /td> ' ;

'& sort=

. = ' < td><a href = "'


.5..... "> </ >< /td> ';

$sort_links
'& s ort=

$_SERVER[ ' PHP_SEL F ' ]

'?usersearch= '

$_SERVER['PHP_SELF']

'?usersearch='

$user_search .

..br.eak:..... .
case 3:
$sort_links

.=

' < td>< a href

= '"

.jl .... " >

' &sort=

$sort_links

</ > </ td>< td >< / td> , ;

. = ' < td>< a h r e f =

$_SERVER['PHP_SEL F']

'?usersearch='

.4... .. " > < /></ td> ';

' &sort=

$sort links .=

'< td> < a href = '"

$_SERVER['PHP_SELF']

'?usersearch='

$user_search .

.3.. ... " > </ >< /t d> ';

' &sort=

..br.eak:.. .. ..
case 5:

= '" . $_SERVER['PHP_SELF') . '?usersearch= '


.jl .... " > < / >< I td>< td> < /td> ' ;

$sort_links .= ' < td><a href


'&sort=

$sort_links . = ' < td> <a href =


, &s ort =

$_SERVER['PHP_SELF')

'?usersearch='

.3... .. " > < / > < / td> ' ;

$sort_links

.=

'< td><a hre f

= '"

$_SERVER['PHP_SELF')

'?usersearch= '

. $_SERVER['PHP_ SELF ' ]

'?usersearch= '

$user_search .

$user_ s e arch

6..... " > < /></ td> ';

'&s o rt = ..

..br.eak:..... .
..c:Jefd.ui~ .
$s ort_links
'&sort=

.=

'< td>< a href = '"

.jl .... " >

< / >< I td>< td></ td> ' ;

$sort_links .= '< td>< a href =

$_SERVER['PHP_SELF']

.3.. .. . " > < / ></ td >';


$sort _ links . = '< td>< a href = '"
.

$_ SERVER['PHP_SELF ' )

' ?usersearch='

'&so rt=
'&so rt=

' ?usersearch='

.5... .. " > < / ></ td >' ;

u. ,,epe.meIO-lct $sort . \Yf\ I<.d..-u.


~ J.d.' uu. u. OH4 Ict.c:\ 2, 4- u.u , 1. .1.

e'btf5ecmu. u.J.t\c\.u,u.; \igctb.. f5U.g e Olf\coP'Y\U.POd.HH;Y;o t)o 3d.Yr\ctM pez.u.c"Yf\pctu,u.u. ~.u.u.

retu rn

g .u..~. t)0p9:9Ke.,
;80

build _query()

~ ~.

bui ld_query ()

SQL-, , .

genera te_sort_l inks () ,


. bui ld_query ( )
, .

ORDER .

ORDER

$sort:

~.~'-:- 1$~:~~~:(~)C j\Ill:t:;~~~~~~~

function build_query ($user_searc h,


$search_query = HSELECT * FROM riskyjobs";

u,llll d."IY\ d..~:md.

WERE \l. !{ cop-mU\J. ($sor-t).

11
if (!empty($where_clause)) {
$search_query .= " WERE $where_clause";

-m , .90da.bt.u
(~u.u bU.i~(C

~yery(). 1l0}
YrjU llctu
I{.Yrju,u.u. sWiich

., Jd.hp0Gd.

g"'1'l'j.

Rbt.ct.u. ORDER .
01') .

tl COP1!)pOK.

COO1jeeYrjC1ju.ll
JD..t\

dp~y.MeK1!)d. $sort.
Iu. \iOgd.-m
O)1JKpb&d.ei'r\ "IY\d.
YKa,y.\.u.5t .d.
COfYr1U.pOKU., d...i'r\

$sori: . "lY\

u..Me-m K-lld..

3~~.u.t)~"IY\

(\')0

.)
t"\OlI.CKd.

''!\d'\

d-m '.g.
.eo-~{,o P'Y!\u.pod...bt.

581

n search.php

--
, Jl0Jl
Jl0Jl .

generate_sort_links ()

bui 1 d_query () , ORDER ,

. ,
- , generate_sort_links ( ) .
-

search . html .

. ~I

( ), , .
, ,
.

u,u5t 6Ui~(C.query() u.d..l'I\ I)OUCKOY~ Cl'I\POKj.


KOl'l\0py)O l\ctl'l\ e . P0..3dUg,.J.e.'!'ri
.ct 01'r~9-bt J.~ll'l\bt ct1\ ux ctcce
.3G\l'I\eM ..9ct5tiY\ UJ G\CCUG\ I\:'Yr\ J..1\bt U 3.9~"Yt\
3d.llPOC J.bt. bt....u u btd..u.. 110li..d
'Yr\lJ.i cooYf\e'Yr\CYf\uu 3.ct. .. st
I'1 ouu, Yrj t]ep~ .7l'1\U I\(Jctl'\ t:po.K 0.9\).1--"

IjOp5l..9KO COpl'l\Upou.

68IOeI . (il _ . .

08" """. ....n.c nottc?

1el1erb I?u t1w


~u ~uu.1l0)(.,
, "'r, - (

Mamaoora.

G D

u n0 I

Kor()a m rurum
, rmm

I Ii,

~'"

'

~','''''

',J:,..

"

'"

'

"

l , , .
?

.
:

II

iI IlOJlQ, .eJWOIIX Dpoll'l' eop!I1O.

uap

:&8J!())'IO, 'lt() uapll )l0!0 .

peccpou uyn JU 1l0JlUeau pa3JIII'IIX rpID

oMenll1CO

e.u. IIro u:aapn.

OIIII .",

~ .... DQ~DI Dp<CII>


upc,CJ.IIIX or 3- 2~- OJI:' - ,,,

epomma

2008-06-28

ca:amar tlllcllllI pyroe


Jl&llll II ICp1IU BblCOI<JD<

2008-09-04

IUIJII . ...

... 0DIIJ0IiI JrrOJlOl', .enll p6cmrr


IIORD4II . _ ap1t ...

DCIWIIIC 'III; Il'8.1II peur CIUlOJ!COB rpey epllO'll


:=':'
Cl:il, HeOOxoIDI , J11 'IIICl'O'[)'
ra.op

:mJIIIII "OJI'111U .... ev:


ory YCDOalCllJllO ro 1VIIIJf ...

2008-07-29

2008-08-17

BcpJlOY

28,,()3-l1

!:s: cno. DOayJUPIIXX


1III'0l II anap JU
<:IJf Teuepae.,

..

IOXO

o.aIIII llpJt eRlIl

.- expewtOIf JtO
1-3 ro)

t.'~~

2008-03-24

2008-11-14

..

2008-07-14

-Jt

2008-11-02

2008-11-09

JIIDIII

...

2008-11-14
omrrll eaJI<: -

2008-11-14

i>

583

Jl [ [
, ,

,
().

, .

.:9d51 "l'1\..u.up q.u."Yf\

,\51"y!)b .tw.151\
.U\lbL<GI}I',u r .9p~i3u.e
1"',0

c"Y!)eo.rw.yp!. ~"!)6.Yr\~ t)OUCI<d..


Jlg.Yr\~

}I"o)/(,e"y!)

z.I{

r;ep eu"l1\u 1")0 }il z.U\lbl

1\.1\YI\)OO..l;j1O 1)

G"1~))...<''1

PBCKoeaBwe W.
JlaORD
"OOr

()lIt~ll;

,(",...

:tuap*1qI't)f)'

1I.tn

..

fts..&J*

:t OO' II-'

1&=,.-

:znos..HQ9

...

;zoo&.1I -'.f

fh.tu~~1f

M~~

2008-11-14

2OOII..(JS.2l

u(;,

05 l11 Hatuero fU
ma.Kue rpynnb\?- 17 .l11 "us;l
u & nuu &.

asueu
mama

.n

u3

rpynnbl

nuu g-u

gaem 13..ocm
BblogUtnb gy

rpynny

cmu.

,
" ll

KOToporo

".
,

SQL

LIMIT.

,
, ...

I{JU~..u...

u n

, ,

3V

LIMIT

, ,
, L IMIT.

LIMIT 5 :
, :

SELECT

FROM riskyjobs

ORDER job_title

.. bt.ct.u.. WHIRI

~ 'Yf\ 3ctl1foce :i9fffl u..:;..t..

.").1 .'I:"..j..l'.i.".4.\

f~~jQ1
.'"'
.;.;.:>.'.;"
.;.
..

3ct!"\U.CU. 3 "IY1d.u.u}:1t, m,

Dcte~LOCuJ1brlo t"iOl..lGKJ 6,3 Kd.KUX-

~u. KplXY1)epu.e.

.9JYY1 ~J.bL Yrj

t1 e pbte Il:m,
3d.tju.ceu, KeJct&u.cu..o o"Y!J "I110cO, (l:>

- -
~

u.x coom,eem,cYrjye)'!j u.5l JctI')DOcct.

ASetn

yn

. I
.uecmo-
, bUlld_query ( ) ,
....

. nuu. u.m
,

nam

LIMIT 5 , :

netJ9

= build_query($user_search,

~n~

$query

$sort);

rl.I.'lr.III.~llf!II:~!:j\;;rill~'~fl'
J:?o'~;;

d..u. bt.d..u.51. LI l{orLeu, Ci\poK. 3ctll poCC\

.ct..u.u.!5ct"Y!J u.'!'\ iJ.~<\btx

i\d:Vf\

bit)rl. u. .3C\t"ipocct .\iu.u. 1)5(:'11)1:>)0.

,
, ?

\;

, .

, ,

LIMIT. LIMIT,
, . ,
11- 15-,

$query
$query

= build_query($user_search, $sort);
~
= $query."
~
btCi. ct..m,
~ogopu:m,. ~<

lSm0f,0u. d.pzyJvI.eKm
~d.m 1{ u.m~

"cttlUceu .90)ju..t
dbt:Vnb 11 tj}{ _ ..

u..3~d.fbtx 3d.I1u.ceu.
(t)m, Yr)ctK l{

t)epgbtx 5{ij.

u.

\")

...

...

......... ...,.u

...

LIMIT. ? LIMIT 10, 10 ,

Ll10

, ,

... '\

"""

OQr

~.

...\

...

r1

...

-..__ ..

..}
./
'"

...

bLu.U f dJ)"
.

585

n [//,

nea '~ cn

UMIT


,
. LIMIT
. , ~ ~

q .

()
<) LIMIT.

:
.

LIMIT
.

'

" 111

BHtI8t1e! Patlos. 8',


.r wr npanoc

".~_"JIe
If8RJIenIIJIe

,.601"101. l'Jll> _Cn

..... 60. n." (.

Otlu

paow

IlaWl:1IOJi8lt

.....

:,; ..,.... ItpC)I'f)O!t

OuHcu:e

_. vAllt&'

,~f)R'fIttUIIltu.pt)l::'m:lOr: ......
~-WUUOl &.m.wu ~-. C.oaw 8

<-.1234->

<1234.:.

LIMIT

LIMIT 5, 5

<1234.>

LIMIT 5, 5

LIMIT 10, 5

LIMIT 5, 5

LIMIT 15, 5

- r. II

LIMIT

rn, r

Toro,

, ,

586

build_quiry () , ,

, LIMIT.

, n

build_quiry ()
, ,

, ,
.
~~~~~~~~~~~---~".

$cur.....page
URL-
$_ GET.

URL 1
,

( ).

~:

'

i.
';,

~.i..:
~

~~~--_-1!tL~~~~-____~______",.
$results-per-page

'~.


,
,
,

.
LIMIT.

$skip
, ,
.

LIMI T.

$total
LIMIT,

, $to t al.
,
.
$nn.....g s

,
($ total),
($resu l ts-per-page), $num-pages.
,

, $t otal .
,

$results-per-page. $nUffi-g s
, $cur-pag e .

587

n, Q mm.&f

,

,
, ,

$cur-page

,
.

URL .

$_GET. , $sort, $user_search

$results-per-page

URL.

($skip),

, , ,

, ,

,
.

..

cYr\ po.n.u.u,bt.
. ~l(ctJo.l,
3.ct.u.

\10

QI{ -

1. (1"I...
CYr\ pa.rw.up) .

$total $nuffi-pages.
,
, .

588

...

n0



, ,
, , , ,

, .
$total

$num-pages.

LIMIT $skip $resul ts-per-page.


search . php , :

~ ..3~1f\cJ."fI\ J!..i-W.' 1f\,


.3cJ.l')fOCd

(;;)..3 ~cJ.Jlt.\-ll.. LII

uQ)O'/'f\. 3d.\iuCU,
Ol'l'\.1f\1'\rou. fv;mu..
1l 0 U.CKd..

2.0.

J{LI,u cei~() (.3)


$result = mysqli_qu

1 pOIlYC"I!)U"I!)b

( $, $query) i

)1'\~

while ($row = mysqli_ etch_array($result


echo

ults" > '

l(~~"VJ') U.9 0

l.L."J(,d,uz - ...

...u. 1..\-,3
1\

..1\t ..

3ctliu.ceU.

echo ' <td valign="t

width="20%" > '

$row['title']

echo '<td valign="

width="50%">'

substr($row['description'],

echo ' <td valign="

width="10%" > '

$row['state']

echo ' <td valign="t

width="20%" > '

substr($row['date-posted'],

echo '</tr > 'i

echo '</table > 'i

'</td>';
,

100)

10)

. ' ... </td >'i

' < /td>';


.

'</td>';

]3bL\it-lt-lu. .:j1OiJ;l. 3\,1, 1-1.0 ~ ,71f\01f\

------- fd.3 bLd.f Li, m 02d.u.ct.m,


u..1\ u..(.l.btx 3ctliu.ceu 1f\
l'\eMu., KOI'I'\OpbLe .u.- 5( 1\~.U

CY1\fo.rw.U,bt.

"

589

nK

3 Jl
, SQL-,

,
. , ,

: 4 ~

()

4 ~

<),

. , .
, , .

$user_search

$cur-page

, ,

URL.

URL.

$nwn-pages

$ sort

,
.

' - - - - - - - - - - - - - - - - - - - - - 1 .
, ,

, -,
. search. php,
?
, ,

generate-page_links().
, , ,
,

. , ,

generate-page_links () .

, :

590

u n

u MySOL

generate-page_links () , .

,
.

//
//

function generate-page_links($user_search, $sort, $cur-page, $num-pages) {


$page_links = ":
// - <)
if (

$page_links .= '< href='"


. $_SERVER['PHP_SELF']
'?usersearch=' . $user_search
'&sort='
$sort
'&page='

else
$page_links

//

1/

for ($i = 1: $i <= $num-pages; $i++)


if (
) {
I

$i;

else {
$page_links . = ' < href='"
. $_SERVER[' PHP_SELF']
'?usersearch=' . $user_search .
'&sort='
$sort.
'&page=' . $i . '''> ' . $i . '</>';

//

()

if (... ................................................ . ) {
$page_links . = ' < href'" " , . $_SERVER [' PHP_SELF']
'?usersearch=' . $user_search .
'&sort='
$sort.
'&page=' . ($cur-page + 1) . '" >-></> ' :
else {

$nwn....pages

-~ UI1 .btQ .9~d. C-Jld.iJ.\.Jf\


$page_l inks;
btu"'r! 4 -ct. gu. u.d. ) ) .

$page_l inks . = '


return

591

u MySOL

generate-page_links () , .

,
.

11
1/

function generate-page_links($user_search, $sort, $cur-page, $num-pages)


$page_links = ";

//

<)

'?usersearch=' .
'&sort='
$sort

$cur.-page

'&page='

else
$page_links

//
//

for ($i ",-::=",:,,--~,,,;;,,--'i.:.:u;;:.:m~R~;;, $ i + + )


i f

--

11
i f (. $cur-page

.ffi

$n-gs

$page_ links .=
'?usersearch=' . $user_search .
'&sort='
$sort.
'&page=' . ($cur-page + 1) . "'>-></a>';

~lse$page_links
{

~ u~btQ
I

.= ->';

.9Ij{~.5( C'YYjpa.uu,p"

}
return $page_linkS;

b1u'YYj. -l<d.

g u.. CUJv\&OJ1d .
592

()


~ )'),
, , ,

(
) , , .

<?php
//

function build_query($user_search, $sort) {

fJ',bt .<.V1U 3-'YI1u. mpu. jJ(u;,u.,

~--t)'Yl10 .e'l\ rtiJ.Kd.KOU. .~o.9u..l')t


l\epe l1u.cbtd.Yf\b u.. u. 'YI1 01') . I-(,

return $search_query;

//
//

KOTOP~

_links($user_search, $sort) {

function

return $sort_links;

//
//

function

er_search, $sort, $cur-page, $num-pages)

uup.d.UJdU. I)e.pe.mel-U'lbtx, .~L.\btx d..3u.J


"Yr\d.'YI10 I)Ou.cK4 u. &d. u.x 01fl.9 .bti<

b'Yt)~~rw.~. l~Yr\. I-ld. n'Pl~ ",dUll bLd...u.u.

return $page_links;

LIJ'\ u. ..u.Zd.u.f-U-lbl. .u.t).bt.OI(.

URL

$_GET

$sort = $_GET('sort'];
$user_search = $_GET('usersearch'];
// ,

$cur-page = isset($_GET('page']) ? $_GET('page'] : 1;
$results-per-page = 5;
/1
$skip = (($cur-page - 1) * $results-per-page); ~btJO J.<.u,u.u. .t)rd.f_sri_.fiIlS()
//
echo '<table border="O" cellpadding="2">';

./, "'.9d.L.t. 3d.. )'fjdu.upt .

.J)1\cI"YI) 1l0U.CKd. u.

c.Ltlle.pccbu1o~

i).

ebteo.9

t!OJv\.} KOJIld.Kab!.. echo

// ~
J '
echo '<tr class="heading">';
~.
echo generate_sort_links ($user_sear~h, $sort)~tJe \lWYf\, ec'W\b____~.
echo ~tr>';
______
. !

search.php

search.php

, J ....
//
require_once('connectvars.php') ;
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD,

DB_NAE);

//
$query = build_query ($user_search, $sort);
13bt,3oe J.<Ll,U.u. bUi.fd_9uery() . C033C\.1-'JJ.5!.
$result = mysqli_query ($dbc, $query); '-I)U.I{g~ 3\.I1\.,
$total = mysqli_num_rows($result);
$num....pages = ceil ($total / $results....Per....Page);
7m,O fd.u. LI.

KOi'\)ODoe MI::JL 3.9d.


// ~ : ~ ~~ . *IOl.o. ml1L
$query $~.
LIMIT $sklp, $resul ts....per....page , ~
U. I{'fI) 9(J..bLe
$result = mysqll_query ($dbc, $query);
'_____ .3
. ..
while ($row = mysq1i_fetch_array ($result
{
'\ 0,9
echo '<tr class="results">';
"fI)..u.Lt.
echo '<td valign="top" width="20%" > ' . $row[ 'title']
'</td> ';
' ... </td>';
echo '<td valign="top" width="50%">' .~
str($row[ 'description'], , 100)
echo '<td valign= " top" width="10%">' . $row['state'] . '</td>';
echo '<td valign="top" width="20%">' . ~bstr($row['date....posted'], , 10) . '</td>';
echo '</tr>';
,

r -Ifj'\ 1\0.9 bt. .u. . "IYJozo, ;nSbt., u.t)!::


''~u.} SUbstrO, y~<opOmu.'I1b CmPOKU t')u.\..u..

echo '</table>';

\. '\'1 u. ctm

pezuc"IYJpc\'u,u'u.

~gl-tuQ.

// -
if ($num....pages > 1) {
echo generate....page_links($us e r_search, $sort, $cur....page, $num....Pages);

~ J:$bt,30 ru<u,uu. 9\')ra.t......st_~illks CO.3.9C\.I-tU


mysqli_close($dbc);

?>

3d./{pbt.1't)u'e

3ctz.g~(g m\.~u.u,bt. 3)'111ct'\ l1ouc~d, u

.u. l1 bt u. ,9 ux \lW /.d.br. e~o.

d.,jbt .9\.14. . tdee e.ust.

tl..\. t) I{.I.J\./{u.. \.'!1J!

, ffi~G'tib

Zi)f1tbl-X .ffi01tfoco.ffi

~:

grat-gJiks() ,

Xopowo,

echo? generate_pageJinks{)

, I1"

echo,

: . ,

: .

. ,

, ,

echo,

, ,

594

u n0

-
nJ )).

genera te--page_l inks () search. php, ,

. ,

. , ,
LIMIT ,
.

~ - search. html .
, ,
.
,

. ,

-
l , , .

ra50my !
iy (? f1erMOHm.

..... "nR

uodu: KOJ1O'Ul.U waa.opa . IIR)'

ep,.o:r

200803-11

aJIllU:l.

2008-03-24

J:OC epROro ..'J.D (: W.l:1'" .

ctyu rp81 )'1UpID. .mr:ocr


o.tro nan n..I u '1U1 n~ ...
~c.cpo.a : :8IIIReJI1U p:a..IlIIIIli 8

200S-04-28

pe..I '8lfiO u.aD. ;1l ..

raIl. lO<' ...... vr on.l

200S-05.22

1I0838Jl .8 llJlC. tcyJrI1fN 3 ._.


BN 6yn .-n ":. R

"

QOC'I'OIIlR'oe lIiI::

2008-06-28

.. ar 3-. 11.0 2So.IiI Io. ...

."Yr) d PC\OYI)'

.9 0"Yr)\"Yr)!. . \!
.. f..
,.

~ \>
:

www.headfirstlabs.com/books/hfphp

595

MYSQL


_R

,
.

596

!!

MySQL.

MySQL

rezy ffibJr~J;eHu,JI

'

*+- *

",

-+

HaUJe,o KflacCHo,o !
et\U rfl,
JaMemUM?'

, ,

, ,
.

.
ryn . ,

, r n, -
.

n ({

J )
0 B03MOJHOCT

RiskyJobs . bi z .

-,

. ,
.

~ ."Yf\\u,u...
\ liu...u..
1< Oed.i-bte. pd.dO'Y!bt.
.9C\e."Yf\ I1.lY\.. 'YI1
. t)].u.

]3 .9 0 t)..u.

eu.CKO(s'd.l-t.4,u. Pd.dOlr\bL
(50J.."Yt) gec"I\
u.~d.UfJ. .,

dbt.

1( .1)dl<'Ylj .

l'.eo8Be 6. lf:l]l8

u..\U}J.U

'ho"''''''1'pyI\"I:I'I:' D cUe

ClOaIOIW t. ame

t) lr\ ..1)

4 1l0j.u.

pU.CKof{d...oU. pd.3o"Yf\bt.
.9~... "\<
Wec"Yf\u .9 ~
d.1)bt coe
J.

_.
.

:-'- " -"- ,

~._ ... _

aaooJIOC

.....~~

.';.::.:~::::_._
..............,

._. . ._. .

~~n<m~;.:
~~
cm:oR:
'.-.. ~' ._ .....:

"'n) !. MYI1 ...u,u.\.bt.


ho.t-W..<.\YI1u. .u. ~I{

.,

PdJbLcKd.Yrjb.

...... paot:

..

.
~

" .- "

~.,

: nan

: Mafpoy

..._. .!

.
four@gregs~,isInet

,
,

. ...
, ,
,

_ __

l1r "ro, $1 OO)l?oHumbC$I 00


HUHO)f1, m m HOMer ero m~ wuml?um,
mr u rery u I? oml?em
ruLU COOOlJ.\eHUe 00 oLUUOKe m~ cerl?era.
110>< mo, m I? mmLi uruu mu><
)l?mu umf1 OLUUOKU.

:
JS@sim-u-c!uk.om

: 636 4652
):~

t1d.u.:Yfju ?- IiUJU."Yf\ t)oucl<

ddJe _9d...blx f./,(d."Yt). Jd."Yt)eM

S<J!d."Yt) ..-\u ..u

OIlPOCd. f;'JQ. IlpU.e.Me. . fd.do"Yt)y...


I1pU. gu.u, "m u..d..
I{'lY\\"Yt)45{. u..d.u,u.. eep..ct!

598

10

Ten~H:555~098
:
r

registration . php,

. , , ,
, .

<?php
if (isset($_POST['submit'])) (
$first_name = $_POST['firstname'];
$last_name = $_POST['lastname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$ j = $_ POST [ , j ' ] ;
$resume = $_POST['resume'];
$output_form = '';
if (emptY($first_name))
// $first_name
echo '< lss="rrr">
$output_form = 'yes';

.</>';

if (empty($last_name)) {
1/ $last_name
echo '< class="error">
$output_form = 'yes';

if (empty($email)) {
// $email
echo '< class="error">
. </>, ;
$output_form = 'yes ' ;

if (empty($phone)) (
/1 $phone
echo '< class="error">
$output_form = 'yes';

else {
$output_form

.</>';

.</>';

'yes' ;

if ($output_form == 'yes')
?>

599

registration.php,
,

. , , ,
, .
<?

if (isset($_POST['submit'])) {
$first_name = $_POST['firstname'];
$last_ name = $_POST['lastname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$job = $_POST['job'];
$resume = $_POST['resume'];
$output_form = '';
if (empty($first_name))
// $first_name
'< class="error">Bbl
$output_form = 'yes '; ' - -

.</>';

He"Yf1 .u.., m .D bt.. !. t'l"Yf1


t'l>< \ teKu U ~U, . Yf\.,
if (empty ($last_name)) { ~m o.u. . bt. dbt.Yf\b t'lyC1'f}bt.U..
// $lst_m
echo '< class="error"> .</>';
$output_form = 'yes'
,
"VI\.u. t)mbt "Vl\ t)u,ucpu.uu ~"VI\
if

(empty ( $email ))

// $email
echo '< class="error">
. < />' ;
$output_form = 'yes';

if (empty( $phone)) {
// $

600

else
$output_form

'yes' ;

if ($output_form

== 'yes')

? > fc;

}>1.9 cfJoPMb'~

1()

.. coo"Vl\e1Y\c"Vl\ue KO"VI\0POMY ~ t)."VI\ ~pec~ btU


\J.30<:!."VI\ I\:9 I\U"Vl\ e~o . ..9<V'b.euw.eu O~f4~O"Vl\KU.

"1bt. 1\UA \ . 1l0"Yf1\U "Yf10 KoKu,e \9\


1'f}..u. 1l 0 mbt. {. ~ 9re9s-~ist U Iletl.
Cu,eMpuU. \~1'f}bt.\}uU 1..bt. .bt., ..
t'l epexgC\"Yf1bt.C\"Yf1b t'lbt. U

, ,

- ,
,

KorAa

w.
,
. ,

s tr_replace ( ) , .

, ,
, ,

, ,
, . ,
,

, ,
, .

110, !l Mbl
(!'- (!, Cnlt?oKO(!,bIe

, ytJ.\.C(!,

_ _--..... nr(!,e.rKY:?


cn w, .
, ,
.

strlen (),

, . ,
, . ,

I< ,
,
, .

, ,
.

, ,

.

.

J>

601

num. m

, w
, ,
, .

, . , ,
, I( .

, PHP-. ,
~~ , , ,

, , .

- ,


, ,
.

- .
,
,
.

:n

:
rpo :

JS@sim-u-duk.om

: 6364652
>QQQ:~

Ht 8bj~a.t1'lb

Zlifl1blX ~011YOCO~

; , ; issetO emptyO

, ?

- .

: .

isset() empty().

, -

empty ( )

; ,
, ,

(707) 827-700

4FG8SXY12.

. ,
, ,

602

10

, ,

.
,
,

-.

...

_ ~

nopa6em8mb
, ,
, .

? , .

&:"'II~

I-'/dYf1b
1r}20
t)

pctgtJ.J1ct.

Mbt MO~~~. ~r.~~?~~!')?,..~.<?~I?!-. ~~p~~~:. ~.3~f.~<;\.~. !:t~~~f ."!)~~~~<1?~~ ......... .


COCYf10~ .~~~~~.~. ~..l!tlf:<f>f.'..I)p.~~.~~ ~~.~.9~~.~~? I!:.f. ?-:~~ .<?!.l~?~?:"'!'f)~ .~.<?.9..9'

603

~ ~.:. eweHue u

________________

~~

, ,
, .

cI')POKe, r~'i.(.u.

J.~.~~).~ .~-:-:4~~.4. .......... .

... 'l\.d,

...., .dU'l\.

u.bL, r,pctebt.e

~,

u. bt CK06KLl, 1)J.,

555636-4652

~.~.~~ ... .... ......... ...... ......... .

~.~?~~i?~~............ .

~~*~O .9ct !'\j 'Yf1 Ll'l\ .u.


0jO\t:> t1 CmPOKe.. G.9)j(U .
i1j. ., . W\ .ctu:m.

.~.~.~ . ~}~.!t~~2............. ..

ctu.u'Y'f} L~ ectpUtJ.H.W\O 1\0,

~.~~~~:'t:9.~;?.............. ..

KO'l\0p(e b'L :; pctcCMd.W\pugd.li)b


I<dK

. "IfI..

(555)
6364652
.....................................
.

555-636-4652

~.......... .. .......................... .

~.~.~~.~~~tl .. ............. ..

? , .

. W\
I".ct \11j
W\d.

I/pcteu.

~~~!':': !'f)f.~.~?~~~~: .~?~~ .<::v!1?~~~:. ~~.~f.~~~~ !:,:~~<;p. .:!I.~!.1~?~,......... .

coc-o~}? ::\?!.1?~.~. ~J. .\.~~.~ .~.p.~~~~ .~~~ ~~~~~. ~9~....9?~~f:l!-?:. ~.~.~?~~~~. ~?.9
~~~~~~~. p.~~':A:~~ .t:t?~<:-4' ~.<:-!l~.~~. ~ .~p.':A: .~~~~~~ .~~?~~~..~~~~~

t);~:~1:1~f :~7e~~:'~' l;'~~fi1;:J?~~&L7~~~ ......

~1~t-::~=
i~~:=-~~~g~3J!::~l;;::F!5~)f;4t~r
Mfi !' d. .o~" -Yit. ~ .dgLi.iid: .... ..............~............................ .
:7 Ul1Jl<
( \?apaHo~ 1wm\?u

m4>. I<aK um l1J,


m\?mm\?lJ.\UU I<3u u H)(~

,
, ,
.

-,

( ). -,
.

, ,

604

10

( ).

6J10
,
tl empty () isset ( ) , ,
. ,

,
. ,

. ,
, , ,

- .

### - ### - ## # #

~ !. ebt d)lll. G.9~)QLlu. ~rfdtn

. ~: 3 J.V1, ?e~u.c.

U,t...lcpfbl, u.

iJ.

I\n.u,

4- u,u.cppbL.
636-46521

"'-- 3 rI~tl'..
u,

555-636-4652
5556364652

l-lCI

~ ..~ecb..;
" ~ .,m
""e~
coo')"(jge')"(jc')"(j~~eYfl
erhI,

. ,~C<:.i.

?YfjOpou

()
, . , t)..

Me.c'Yrje.

\it{.')"(j)Q.

8~t'J'h,

Zlifl1blX ~011YOCO~
~: : , ~: ,
?

. ,

. bl,

: , ! ,

,

.

. :

~: , ,

, ,

: , !

bl

~:

##########, ,

,
,

. .

, ,

10 ?

605

.)l

w
0

. ,

. ,
,

. ( ),
.

, ,

10 .

10 . , .
- , ,
. .

~ YnYl) 34~

$ J.ct<:1.1'l'\

I{., Ci'f1PO~u..

,

, :

9
/\d{10}$/

-m "Ii'1o , cctMoe '.. btct..u., 'm


u. t):\3d.. bt. btpct.,.u. \<!{10} - -"t'I)
pct...bt.u. Ct)oco~ YKdJd"li'1b, Yl) "t'l)c:l

\d, Yl).u.u. t)epe.9 u. qxA.YPbl.x CI\OdKctx,


.,. t'\o"Ii'1 0pU.'Yf'\b 10 :\3.
606

1()

5tpaet
UCn3mcs
n

gA9

coomemcmus
g.
1118,

R u

fu . . rnuu rryru
~ruu ~c.e .:f1ruer
rn ., ~ Oe:y.YHHY~ .

, ryn cnw
n

06nlO r .

,

.
,

. -

, ,
,

. ,
,
.

607

mu R UR

wfi 0 n

\ , h

, f,: .

MemacuoA
npegoctna9tn

~ ~
.

, .

53ocm

onCb18.ffib

. \,
. .

UIa06

1)

pery

5tpaetJ9X.

\d
,

\w

: - 9. :

i'r , .

. , , .

,
,

. a-z , A-Z,-,-

Ol \d\d \d{2}.

, ), 9 ( \d).

\8

1f"'"-" '"""'", ' " " "'"" ' ''''''\''' ''''"''''''''''''' ~.. ' " _"' ..

Jl.

~,

, (),

~.

~ ~

, JcI ,

, , Oli

:.

, ,

. ,

Jl <I
,

300

II ,

d {3 } I

~,

300 .

\ s \ s \ s { 2 } .

$
' ; . h
Jl
, .

\\-1,
, ,
, \5.

lII ,

=~ ,
I. , / \ w { 7 } \
s \ d { 3 } $/ ~ 411 ~
411 '
' ~ 411.

. ,
Ii ?
. , ,

608

UJ80

1()

707-827-7000, . 1707-827-7000;'

--------

+,

5556364652
I

\d{3}\s\d{7}$1

I\d{3}\s\d{3}\s\d{4}$1

I\d{3}\d{3}-\d{4}$1

5556364652

555636-4652

I\d{3}-\d{} - \d{4}$1

555

I\d{}\s\w\w\s\w{5}$1

5556364652

I\d{10}$1

555-636-4652

NINJA

609

/\d{3}\s\d{7}$/

- - -_ __

~-

5556364652

/\d{3}\s\d{3}\s\d{4}$/

/\d{3}

\d{3} -\d{4} $/ - - _

5556364652

---+---

555636-4652

mam ct. ..u. I1u...I){)


PUCKoQ.b1.e PQaambt.: t)poge.fl<u

.d coO't)e:vnC"Yr}fue ~.1 g Yr\/;nX


DMepO f~)jct ###-###-####, ~
/\d{3}-\d{3}-\d{4}$/ -~---......

555

/\d{3}\s\w\w\s\w{5}$/

5556364652

NINJA

"",4i \" rG:Jr.~

bt.ct..u.u. coo'fl)e"t\c)'fjeye."t\ to'j

Qctu)'fj.-~u.~ u.}
/\d{10} $/

555-636-4652

..7I\ ..'.. bt~ct.u. l<}t )j{o

u,ubi., t'jO-'Yr\ e'j Yrj am1j)'fjg'f\


l\.btt1 DMep tJ..N\ Iid U .u..

610

10

upatnb sor 6eu9: UU

npuuam. UU otnepra m:. ogu..e

0msu ueU9 Pcoable


ucu..i1

pasotnbl. .um
cpuKcauueti.

m:. Koopi! umaem

memC1l5U..h\ ... .

npomUBHOM

ocmae m

cocm09UU. ..emuyum

u memcm\..

7 . .

bt.ct.u./- <:.td/-t

~ /-t<:.t "frJ.d"

tt

11'\./:.-vn tJ..J>N

I\d{3}-\d{3}-\d{4}$1

(555) 935-2659

(555)672-0953

555-343-8263

CePCPUfQ Yl1

r bL1nb 90D
pC l<oct.b1.

JQ'!)u.,

ocode.!-U-W

o.Lt.ld. tlcu. -

b'~c"Yl1yt)ctIJb

, Yr\.

Il.r.1..u. <.!

0555-441-9005

555.903.6386

555-612-8527-8724

pery9or er.

uu

npuam. uu eq6, ogu

n309 nu I'u pa.6Om. u


easCU\l1

q>UKca1Juel1,

pa.cn

eq.

memctn6U ..

ocrnasbme

cocm09UU
u

4.._ '>.\ICJ

f),

fIj
J .... ~bt.d....u..
muyl1 ~

d.. .,.,
<'!. "YI').m4
J

HecoomsemCffi6U9.

JL.

d"). f

I\d{3}-\d{3}-\d{4}$1

\J)JjLI}"

u. I1 03 0(j..u.
I<I(, )'!){ :
I<d.K u.

v..

I18\.

D(555)~59

D (555)672-0953
~

{4I{UX I<
t)O)J(-ct),!)d..

.lz.J-..
btp,d, e.u.e

'Y!lOt), .9

\J,3-'!\
u.I1 03 0\'Yf\
I<d,'Yf\

kC\ku.e-'Y!l -rr;9.

u. u,f>='-

7,no .90dd,r-Lb..:

d3.U.'!\ u.

bL,

d. . !'!\.

612

1()

"-

\1

555.903.6386

u!

..?

D555-612-852@)

ti(() (/)mrm m~Oti~ .uu

um(/) r, \?UEf ()l!u UblU


(; ti (. U -U()
(/)m r(;rm cooP,ec~e reryrti
blru u ~e meq:ti~

[)

rnaBHOe,

r n_ ryn
_ n cn .
- / \d{) - \d{} \ d { 4 } - \ d { 4 } $ / ,

, , , 555-636-4652,
.

, -

.
, ,
.

/ \

d {1 } $ /

I G\\.

J)

JG\11u.cb zooopu.'Yfj

"II')ofi\ m UjJ.pct ll..G\

~ gC"YfJ'il1u.~ ~ c'il1pol<e 10 F

.
, , .

{min,max}

, ,

,
.

_"-":--~~~==;::::::::::"'~~~~~~~l
,.

2, 3


4 : \d{2,4}$j.

l

...
CTpoI<e

~:",m" """,!!!!!".."",.I, :1,.",I'f"~m.,!J,::"",II",!!'J.,,,I,,I",,,,I,, ,I:MI!,,..,,,I."m


/ Ic. ,:I:,,,I,,,,I... ~,,I. ,"I,,,,I~,,I,, , I,"IM'". I",~,~;.,.",., .

J Th

amUqJUamop
~~_ _- - - - - - - , l3.
e'
nPf1i
on.--::J "~!
, , 'I'{'~I ;";
1~

''''''

",

L ...

, :

u1

17 ynmuu u Uem.
HOMe.ra m~" 1)'
u fl

COBepweHHO ....
n cn .
, ,

, .
, .

.

.
(), ,
.

[]. .

[0-2]

1 2.

,
.

[A-D]

4 ,

, ,

D.

CUOAbbrt1

llJ

coomemcm
ogO.y cu.o.

614

1()

ry
:

lf. ~t'pUJeHti

w6

IJ.}I\ Cl'Y\o.KU )

J

$ llr)OYt\. m ,.d,
, ... !bt.~..:.u.(
U

. , - .. IIr, :vn. _

, ,

cooY1)~kmcY1)ue ce

. , ::.- 1). l:'~ ...

[2 - 9] \ d { 2 } - \ d { 3 } - \ d { 4 } $ /

\.

\\0.9 .~~1'l\.1) u.ttbLu. ~C .U'YI\,


0M
.9 0 :>l<-.-
m lIep bt.
u. 1) u,u. .
.)/{.1) bt.i' i ~ rcppo.

.J:.

.9U4t1'\30rle.

1)

)u.'Yf\,....

.9
1ft

C'YI\POKd . ..d.
'41'\ .u.:u.x

u., -. 'Yl\..!

~r~,"''d

t).'i)(.u_ 9e ...u. g KOrlu,e .


.oyr. dbt- }6b1.u. 11\bL. 1dbLe u,u.cppbL,

..0.

g.9.U.dt)<:IJOKe Yrj .90

91s'l<}u-n...

"Yl1.9ru-llit 01'1\ t1bL~


2-f~t1\')b~ u.}l\.

(?

(}bl~~tTh,

Z4t11blX ~011fOCO~

~: ,

~: , 801l 1Iacca

, CII ?

: ,

: .

, ll

an ll ? , 1I

/[]+/

, (]

, .

, [-]


.
(0-9]

\d,

, ,
.

~: l1
on 1I Il

1Iacce?

: , ,

, [-. -]

, , ,
, , , .

~: yan, ,
: , (
, .

, ,
,

, ,
. , I

/()+/ CII <


, .

~: CII,
, , ?

: ( 1),
.

/(ll)/ .

j>

61

uI

pr n retyr ru u,
u ruu ?- ~u [
u, ra)Be ftif rac.c.amruBamb .u

u uur UUHmernremur0(?amb r1)'r (?ru


, SI moro )(?-

ll
II

BaweM

ryll ,

.
,
, ,

(.), (?), ( + ), ,
( [ ] ),

({}), , ("), ($), (1),


(/ \) (*).

,

(\).

,
, :

}mu.
,

(555)636-4652

CKO~KU. ~YVn

PdC CMd."I'I\pU.f5d."'I\bC51.
.u.u."I'I\u. .~t1t1bt..

/A(\d{3})\d{3}-\d{4}$/

. ,
:

ellepb ? 3deYl), 'fmo

(555)636-4652

616

10

.r

.?t"'i'f\O

i'\51.u. CKO~Ku..

/A\(\d{3}\)\d{3}-\d{4}$/

.....

8'u

,
?

/[3-]{4}/

/A([A-Z]\d){2}$/

. ,
,
, .

, , .

555-636-4652 555 636-4652


(555)-636-4652 (555) 636-4652

 ~

617

,
?

~ CYr\POKC\, Yr\\
u.. I"IpOI"lU.C.ou ~YKb!.. u. u..,
\ .3C\"I\e I"l"l\ I"IP0I"lu.c.Kou ~YKb!..
u. u.., I"Ipu. 3"I\OM C"I\POKC\
.\\.u.\"l\: 59, 22.
,


. ,
,
, .

, , .

555-636-4652 555 636-4652


(555)-636-4652 (555) 636-4652

." u..
u.

618

10

...

(l' uet1 KryrOM


Henra[l,UIIbI1b'X () [1, nruuu
& raombI)'. I<aKOU nrOK

& :> rflr I'ruU. u


- Un.30I'm/{

n_lO

peryn.pHble

_.

n.


w.

61'

-u prefcmat(:I1(J

preg_match()

.
-

preg_match ().
, , .
.
,

false,

true ,

'

';

} else {

620

1()

'

';

ll

- ,

, .

empty ()

pre9_match ()

, .

if (ernpty($phone))
//

$phone

echo '< class="error">


. < /> ' ;
$output_forrn
}

= 'yes';

- ,
, .

/{

empty ()

if (empty($phone))

//

echo

'<

. </>

$phone

class="error">

1;

J5@sim-u-duck.com
: 636 4652
):~

622

preg_match ()

, .

10

-- - eo.9a.
-J

r------------

BBeAeHHoro

ll

I-lOtd. "!\g

)\Gd.'1\ I-\.

n ."!\

I{GH

u. I-\. d(;:mb Ot)f

r 1

.tl )).

registration.php www.headfirstlabs

~ ~

(s t:}

(riskyjobs_title .gif riskyjobs_fireman.png). .


registration. , Ji

, f
, .

"1etlept> Q
UQ ~~ec l1r~uiu
\-e.r eetpQ. (Jfem

I1QU

. ltl
.80":111 RIIJI'II!JI!. 3 :Jcrrpomll OO'l1bl.
3aperHCIpHpyJ!ec)' cai!e

rUCKQ~aHbIX ra5Qm!

P""""&lIRe .

~ lJ
~ "
www.hdfirstl

-u preg__rep!ace()

... ~u HalJ.ley rery~r ~r>.u


~em8 cpOramo~ HOMero~ {?, r{?

Q3em, {? ca~ ())( 3 uru~ ()


~1ucaa r r~ UlJ.I xor0lJ.lo. Uy,

HeotxOVUMO vruuro{?m mu (?etl\U.

, wn ..
, 0, ,

n .
, ,
,

~ :!>,

, .
-

rg_th

preg_replace ()
()

. , ,
,

,
.

str_replace (),

, ,
, .

preg_replace ( ) :

preg_replace('/200[0-9]/', '2010',

( 10<o
coo'lY\(Se1Yjc1Yju.e

..f:{u:\ -ru<u,u.u,

2...

p're9_rep~ctce(),

m KY)f(,rlo u,cJ<cXY11b

Ci1)POI\Y 0.9~\..l
u, 3 .u.u ~.

624

1()

.9Ud.Ild.'0Ke O"Yf\
2000.90 2009.

year is

YrI ~51r..

bt.j)..u.

'he

~bt.q.u.} .9'11
U.., .

'11\ .90Q dbt.i11b


.ct..d, C"fY\POI\OU

201.0,

109.,);

..u. PC\J, 02..90.


Ci11POKct,

..

UJ 3.Quu. z
-.9L1.c\IlC\J. 0w! 2000 :.:
2009, "fY\ .ctU\. :_
"tY\ ,3ct..q C"Yr\POii::
,3 201.0;;:;,.
~9.o

,
,

phone

. ,
.

(555) 935-2659
6t1"l , ICOTOpm4 , enp~Ta .
11 pw..-D i1il 8 flQClt

(555)672-0953

.~.rR
peryiieC caJ!e

555-343-8263

_ _ _ _----.tIIoI~~ ot
_.
_._
_~
__~.

1bu1:

~~: ..

555-441-9005
orn:

:.:::_.:~;

__- _,..
..

..

555.903.6386

_._

~"-"'-" '-'~

,_..

....- .

..

..

~!~~.~_.~.~~P.~~.:....~ ......_~

555-612-8527-8724

!...... ._......... _....

=
..
~

- .~

.........-......... ........ .--- .. ,....... '""'"'d

,
,

phone

. , 0
.

(555) 935-2659
! , , .

88" pew nl1 8 lC'?

(555)672-0953

. PercpaIIII
ntiIeCr.

555-343-8263

_ _ _----,""f~:::l::: _~.~IJ_
_~-_3~.

s: ~

~::::..;.:;:::~::~

l,.-.,
. . .................
.......
.,
...
..

555.903.6386

..

12..~~~ ~.~~,.e_:

555-612-8527-8724

dLl

u.

.
_.,_

:::~r:t~~: ,: :: ,;j

555-441-9005

@t~ .

...._ ._...._ ._.....;

. ......_ . ... .._ ........ _ ........-

IlEocmoCi

4..bLu

Memo.9 d5(.

. mtw

...

Jdtod:vn51.

- - - -t::>-5 5 59352659
~:e=e~~ZpoMe
555612 09 5 ......~---~

II d Ll1\1.

u,u..

5553lt38263
555ltlr19005
5559036386
55561.28521

626

1()

\
.........- ,4


~
,

IA\(?[2-9]\d{2}\)?[-\s]\d{3}-\d{4}$1

, :

###-###-####
### ###-####

------------------~--~~--~

(###)-###-####

(###) ###-####

TaKoro

,

SQL- . , , ,

,
.

preg_replace ( ),

. ,
, .

10 - .
:

- - - - - ##########~------------------

, .
, ,

( -
($ - ). ,

rnagmuaU9

qpma

. . ,
:

01jl(bt.~(.\
I<2.d. l{(.\

,3dl(fbtct)d

~rna1

SOL-an.

f~6ct5t 6.
~

627

pregJep/ace(}

l
, ,

, ,
, .
? -

preg_replace ( ) .

, : .

pre9_replace ( )
pre9_replace ( )

.
.

Hctu:yy\u. u.bL,

###-###-####

coo~e~C1ny~ue

. JCleH.u.:mb

m ..

t)- C1lpOKO.

btct.JJ.)...

### ###-####

(###)-###-####
(###) ###-####

t~D
J3ce 3'YY)u. 9N>d.-bl. OMepo
u:md.}OYrJ$t Ilpctbru.

~":.'~':.::._;;:;:::: ..::::.~

~p~~c~:~~ t1uo.lt :::':~,~,_

b~ - _ _ . ~ _ . . _)
5559352659
5556720953
5553438263
5554419005
5559036386
5556128527

628

1()

preg_replace ( )

J ~ce mu mt>1 \?OKrf" cmrOKU


~ 10 u\?\? )(U mrS' U
\?r. n U ~cma\?umb \?mw
\?\?() HOMer m~ \? () cf70rame ~
ner\?oM ~ mt>lr)(, racCMomrWHbIX HaM~

,
,
,

, ,
,

, .
,

rn
,
.
,

preg_replace ( ) ,

.
-
, .

629

n registroticm.php

--J],
.
reg i

s tra t i

. php,

,
!>:

$pattern

'/[\(\)\-\S]/';

= ";

$replacement
$new-phone
echo

'

preg_replace($pattern, $replacement, $phone);

'

.</>';

-
. ,
, , (707) 827 -7000.
.

l , , 8.


"rrjf{~

. r

"Yll\'bt
oU "YIl

, , ro
r: (<J>FI.I)llffi!~;;1~!
ero r

u,v.CPpbt, lJ..Kd.KUX

.9ot) rlli-n) .blJ<


u.ol

, , 707.827.7000, (707)-827-7000,
, preg_replace ()

707827-7000.

630

1()

n
r~ U &&\:L

(()OLeHe JJu.l<or-u

r o/0t?Ma nu &&() \-uu )< nr&u)<


avpeco& ru ? !

~-"'-

:
: orpoy

four@gregs-liSfnet
: 555-098
:

.
~ d

f\ poJ-U-\.O u

f)"Yl\bt.
Iilij

')'!)G\ Il .

S}v\ t)et.

)l( ,

, w,
.
aI( ,
.

PHP- .
, '~) .

MbL ., "YI\ 4

YrtJ-\.U

l\Yr\"L ..\. 5l.jG\')'!).

...v IlpucymC"'I\OG\')'!)b "'l\u . Wd.


LOcalName@DOmainprefix?oomainSuffix

~ ""' J~'"bt ,",")

"--:;",,,,,,

Uj d4U"Yf).-V?U<:btx u,,.

CV1. u..tv\. I)d."Yf\ MO.)/Ge"Yf\

'!10'!1 u q.. u\ u , "fu.

~~ gOMe.o. - u-g u d u.

~LI'.........
' ". . ' ' " ' "
,

, .

.>""'"

bL. cocYf\0u.Yf\

u .-"YI'If

u..

aViator.howard@bann.
. ........ .

eroc~ty.com

-":?':- .. ,

-, ....

rocky@i-rk.iz

................................... .... ........................................................................

".,

....... ..........

631

w

,

, ,

, .

, , ,
, @, 4:
. - ,

,
- , , ,

, .

~ce 'YI\u. u.bt- MOz,yrr:

6bL- u.\,,\..bt

&

~ \,,\30d'Yl\~5l .~.
'YI\ftl.J{.U \,,\'l1\

+ /

, ,
:

4:

4: .

632

10

'!<:\C:'IY\U. .tl. UY-~.

@ ,

a'QrecOM mru nm u


HerYUHO. m eryr ~et1u

npo~epKu UOMet1HOrO , npUMepHO ,

:,uu n~m~j)'> ...


17 npocmo.

r II "

-
ero " -

AOMeHHoro

, r II
)).

~ OMeHa~
-
,

~ ~, ,

~ OMeHa~, .

. , . edu, .org, . gov, . , . ru

. . ,
.

tlG 8bl.GJilG'fh.

Zi)f1JblX ~01JrOCO~

~;

~; ,

; ,

n?

, .

oTBepryc

; ( , ,
.

99,9 % ,
%,

0,1

, , .

,
, :

n_i'm Crazyn@greg-list.net

. COOmetnCI115Ue

cerga

' : http:

/ / code. google. m//


php-email-address-validation /

KOMnpoMUCC

gy

.. COOmetnCI115yem.

U ..

nu.
~

633

, , ,

. org,

(Domain Name System,

DNS).

,
, .

. tj -


. .

i1eomorbIe U3 mu ()OMeo~ mm
mO"bKO u u OYK~. Heomorble -- u3 u UflU mrex
OYK~, u U eu.\e () u"u OyK~. f?yrue cocmos:!nl
u emr U () s:!mu Oy~. m, U"s:! r~ru
coom~emcm~us:! u ()OMeo~4'

(Domain Name System,


DNS)
,

 r ,
.

,
I- .

I-.

( ,

, ,

@), -

che ckdnsrr ( ) .

(DNS)

oreilly.
I- 208.201.239.36.

lu

checkdnsrr ( )

.
,

,
, ,

checkdnsrr ( ) ,
. , ,

, lasdj kdfsalkj af .
, checkdnsrr ( ) ,
, , ,

sdfhfdskl@lasdjkdfsalkjaf.com, .

checkdnsrr () :

checkdnsrr('headfirstlabs.com ' )
.7rn(\ Ild. t5.u.d.'Yf\ Ylj

YljD}.I\ (\, cee~

. . . . . . . . . . . . . . . . . . . . . . . . . . . . .~E~E:~~::~~ws

cn l1
l1

~ C,~Q)"(j' b")O"l)epe, .ct KOYr\0fOM


: )"(jd. ~ t)epctu...ct

Windows, .

~ 'Yr!llct.l'!) ed~e

function win_checkdnsrr ($domain, $recype= ' , )


i f (! empty ($domain
{
if ($recype==") $recype="MX";
("nslookup -t=$ $domain", $output);
foreach ($output $) {
i f (preg_match{"
$line
return true;
}

/$dmi/",

)
return false;
return false;
}

: cUCYr\C\

w'!hdows'. . .3d Yf\eM


1')

u.,)j(,.u.

~ . ~ctdol'!)bt. .ct / I'j

~ l1ct~.u. l')d,u....
~ Cu.c1'tJMbL UIl\x/Li~UX, 'Yf\.(\
.u.MKx I1d . 3 (d1),

=.

. . ~bI,).."!'\ .W!-l))

~ ~~ o.~~ cepepe . npogepKu'

I
w.u: .9oMed .

oc~o DctU, wymKLA. \10\1podyu."!'Y\e ebL~ec.~o


d.
:J.u. C'Yf\f,0Ku' $;i\ie C.fQ3~ Ij 9 .7'Yt\O~O:
u..3 u,U(\ fored.Ch.

'bt :J~trU~~ ~il~4~#5Nf\-

Server: 3.81.4.i4. reS$

..................................... ..... ......... ............. ..........

dU.i:horil:dt.ive

'

d-t

rswr: orei~y.co"!'Y\ 'Yf\d.IA: !.Ij

'

20

$'Yt'\t.f~.orei~YcO'Yf\,

635

n nQ

:
, ,

@: , ~
,

checkdnsrr ( ).

, ,

~ .

g_th

()

;'I\:'I'l\. ~u...d.lJ..
ttd O'Yl\ ym C'YI\u.e.

j4d. .9 0JIct

g Ko.~e

!>,

.. j5t...

@.

(s'btf4.u.5t.

"1\.

. '. .9 0.

dbt"Y1\b \jo'Yl\oM::i, '\


\j u.d. @
!i..9~"\ U..5l
.9 o ..


<1 !>, @,

~
, @,

checkdnsrr ()

@ .

checkdnsrr () ,
,
.

checkdnsrr () 1,

, .

636

"

1()

'u

-, ,

, .
, .

$m

i f (!preg_match('

II
II
II

$email

~>,

echo

'<

class="error">Bbl

$output_form

</p>' ;

'yes';

else
II
II

$domain
II
if

preg_replace('

>;

.. . . . ...... . . . .......... . ..... > )

echo

'<

class="error">

$output_form

.</>';

'yes';

8.l ~

637

-, ,

, .
, .

7vr)0 .d &j'..pt-t. bt.~.,r ~'19, t)PO~KU. d."tY\LI.

/ ' ctd. it)..u. tj'mbt. 1)0.9 f-ldJ.u. ..


'v
U. \i.J1.30."\..
i f (!preg_match(

II
//

J<:'.~~~-:-.~.9.-:-.~~~~~.--:-.~.9.--:-.~.\"7".\~~!!~!")~~!.:

$email

$m))

v.

~>,

//

echo

'<

class="error">Bbl

$output_form

'yes';

.</>';

:mekmpol-'-'U

5i. I'!\bl o '-Ir\08gt :1.9d\,l.1 ~~~.t~ t)gdl'!\5'


t"jo<.J-m1. \10.9 rwJ~Qtw.e....\ ){
51. 3de.bt

~ u.J.\~d Ci\ :11(C\3o.l-\.d. 1i~C"YfId5l !1\?. '::

1 se
//

//

$domain = preg_replace(

'~J~-:-.~~~~9~~J.[.~.-:-~~:-J.9:-,~,\.~\::.~!?~~J.~~(','

.. $.~!")~~~ ..... );

preg_match ()

preg_replace () ,
,

\d, \ w \ s

,
,

checkdnsrr ()

638

-
n n<
r n_ l
, , {
JI OI

- '
. ~
,

~~~~~~ ~~~~ JJ~I.

~o
I-7Uw'
~
" / 111'
_

11

HO~MY <>t1....uu ~Uc.Ot1aHHbIX

r"m.1r, ()

.........
8
'-.'

onp

~
,.... " ... .
[I,IJI ....
'

( ()m,

nmm ()1!, KomOrbIe


rl113ll.

or:

.'

,.......,

MYSQL

MySQL

wn rtl
n n
. nn .

Qntl

" ~u,cf~J\u,~~UtfI ~~\!tu,x g~lflfbJX...

U,

oOJ\eeJ

-* }

.--

Cmoume C110KOUHO.
-{){)u, u(!,uraumecb. menerb

CMompume 11 u YIIbIOHumecb.
-, (?tJl, (?lJ.IU U. Dmu,
CKrecmume l?aUJu U u U
11er(?uu \- - (?1I(?.

~r(?)(U!

.
. .

. ,
.

: , ,
, . .. . ,
,
.

, .
, ,
- (-)
?

641

ml-

n ( ):
.
,

Ife

- . -,

J\sag .

nogep

. ,

pucy

,
.


. , 4

5bltnb

nu
cna-soma.u

. i:.
~6aBbreUmu~r,vo6aBbreUmu~r,
06 rei:Jmur; 06 reiimur;
06 rei:Jmu~r, 06 rei:Jmu~r.-

aroll11 ro '

ro

: .

. .
ro JI ro u!

J[

1l.ro

.: www.frowneycentral.com
I: 999999999

~ .<>'

u..Yrj.., YeJv\ Jclm


YrjU POdO'Yl\bt, - W} Il OIld.cYrjb
d. 2QJ(\ 1l 0J(\Yrj

..900.9(\ OYrj f~d,}ll\bt.


-

4 ,
,
.

642

11

. ra.
~~~~BM u 8ro '

IJ[ IIIO.II~~~ f( io

8uuUR u 60l

" -
, -
, ,
.

, -
.

, ,
, .

\ '"n1<=1..bL
J,\ cll7j I'JU.u..
LtYr}C\p.bte ou.L"'t

CmraHHO.

1~1W1i~~~~iilllllmI~li~iI~~~~uu~u

MOOepupo&amb Ike u peumul1[U,


.\Ju& "3 KOmOPblX
.uuu{?cw.
3Hal-O,

i1u)!

llr

2008.()60Z3 11 ,44:56 999999')99

V)lllJl1l I

....,po""

00S.06-2311:4S :15 999999999 y,,.,um./c...n,..


2
m9999'W Y)lllJl1ln' I mIOp<>"""'
2008-1)6-23 11 :45:29 999999999 ,\..,
-"'El\"''''''''''
.._.(....._ ...tr.I....... 2008-06-23 11 :45:53

i d"""'II 08
...1 eom 2008-06-23 11:46:()6 999999999 YJ10L
.......""..... .
2008-06-2311:46:19 99<)999'199 :<I,U'''''''' '

~ .....,.cla.oIoate.ulll
--r- .._.~
"-'010 .

. ..........frowocyatnL<.

2()()8.06-2311:47:26 9999?9999 YaJIJI"

~4r.u., Ifflto .

t)u~\1'1 "u1j
CtjC\fi\-;)!'Jctu ..YC1'rj<1..btu

'Yf)t)\U)!'J...u
cV1bU:J.\J&l.x
peUi11 U /-{20 cllctoJJ\.

Can:otll'."'I\i"""".

~ .."", '''''I1'II.,''''ro1.<o"
I L...,I!I.."lII,.

I\'<'" 2008-06-23 11 :47:42 999999999 Y/W!.......

.......r.owaey-

; 'W"",.h"8d1ud8)m
.......h tl1uU.. ..
",.
'. .......h..tll.otIe b com

06-23 11:47:5$
2~O
~
2008-06-23 11:48:12

999999999 ,1I"'1n'

I UJ'1t'lUt1""""

99999')99~ yJ10L I

2008-06-23 11 ,50:24 11999'19999 Yan

I ",,"D"'?""""
,

2008-06.13 JI :51:20 1199999999 jI8nr


10011-06.23 J 1:51:52 999999999 _.... ! l:ll1'1~'.

. ,
-

. , .
...

. .
, r,
ro ra :

, ~

643


, ,
~
, ,
-, .

u,4U ct)C\.M-O)'fjct .

I1 . "Yt)d.Yf) UKC\Koo i'rjPy~

J\l').u."Yt) Uttt

i'rj, ci'rjo, d.. "YI'\btc <\3 ...


~o)j "Yr)ctl<!
I

___

....... . ....... ..........-...,...

.........

.:

_-...............

,,-~~

........"'---........

~~~::~
.........
:

ell......: :.8'99999999..

_".~ ~)~_$O!I

===:=="""-._
.... .......
--~

....

_- ~

:..~

olll. r.
-- _ _ _~. ' . H-.._ ....._

::~Hr:~~

... _. _

.=:J

_.. _

. _

......_

..

~;;~~ ~~~jq/

. . ii1'8.
.........

.===-.=
....;;:..."=
....=....= .=-- ...... _ ......--..........._ ...

... -

............-- ........... .........

aJ. ']{>:-U-~'""
Ilu.)J{,e.1J..

"u.-map.bt.e

ouH.bL (5o..ct
6Jl-(5u. ,...---?peu.1Y\u.zau.

...:

peAnlr: l~ ... ........ . . ... .;

r _.

~ Ct)ct.M-1\(?

~-("~~-.- .:.......

u.1\51.

' )f(,i-lO"'IY\
u. I1 0 .3 0(5"Yf\

g (5

u.t-lYf\r.d..

__
.....

............-

;5
\ 00 ;U peu:VI1u.Zd
. ~eeWl t>J-"Yl1- tju.

~eo~o.

ru:mu...

U.3-30. 'Yf\O . , '-ffi\o

rhODM\I
'1 1 'J

. u ir.
..
.... .... -....- ......
......

ou.x

l<"YI1o -lOu."'tj .9ctH.rtbte

ctbbtu.

\-

" :

Uu. POOO"Yf}.
,

<~eu ,
pei1mU1-Jr

HeoJ3X.ogu.O 5
Og .

n1-lge

nepeg

mneu

. -
-,

. ,
,
,

u u ,

. ,

.

644

11

,
-. , , ,

. .

6'nlOAo ,n

.n .n?

'----------------'


r.n:

.n 7
;

+ S?

1'--_---'

?IL-.______--'

.n,l

I .~~;

: 1...-_ _ _ _ _ _....1 ,,w",,,,,"" ~..,',",.,,,~.


nwr .n:

..

645

,
Cn0,
-. , , ,
,

. .

I<'. "JJ.

1) . bt9,.
E;'C\pu.aItWjd. gg

u.Wju.u.1< d.!J.,U.o..oU

d.Jbt" .

,7'Yf\OM
<:I ~YI{bt
Gri.'Yf\<:I.!. Jd.
u:.u5!.J\'\u.

u. 'Yf\O I<ctu.
4"!'I10.31:1"I. Jd.'Yf\pY.9JJ.'Yf\b '

Pd.<~O'Yf\J' 'Yf\
,t511 0!.w,u.2.0
!.t)Jd.i.u.

ir]'Yf\d..

646

11

OOHHblX !

li 1131 ( 1131
Tecr, , , ,

, ,

CAP"CJiA

Completely Automated Public Turing Test to ll Computers and Humans Apart

( ra

). ,

nporpa.a.

otn09

-,

wutaetn

caUm

,
. -,

poso.

, ,

UCnOAb3}'9

_ ~D4~e ..yrom.
I ~o!Jt. ierLeou.O\Je'iY\C){
- .bt .."" t\ou. . WI-'0 '-1
I IJ
~ U ert~J . ~d.J~ ep~ amI-\d' 011\ cex h,.I-X.

Tdl< Kdl{

npegtl

~l{bt .u..gert'Yf\u.cpu.d.u;..w~u.

I1,
6 : I

mecm.

r:::f33''-'-"'"' ' '"'

I ~~~

l' . "rIIO'-lI ~eHepu.pye.Mbte \JIJ I d


. 0.9a. u..'Yf\u.u.d.U~u.{.~ 110Mo~C\}O'Yrj ~1) -mekc"rll u.:Wj~ ~U= ~:I.~OM,
v

~PdJbt ? u.t\,31\.

bt. t\ 5\. d. 'Yf\el{c1Y\a.

t~~!: 'YYj\1r}. .ctj'-lU>w.~. C~C)1]e..


IJ

I'J

,eCI(O~O pact)3I-1t.\gctJJJ(

"rIIo 51.

t)j~5( J1}.,9 1l01\ e~o.

'

,
, ,

, .

, ,

,

ct\dJ;\-Yf\ I-l ..Yf\


t\ ll.l\d.I\ u..1\Llu.dU,u-W1.}

w6k'

pctJ, ~ke, 'm . }v\.Yf\, .71\0 t\\')bt1\d1\G ..d.Yf\ .


IJr1

6. --:' " ' - - - - - - - -....

ct)eLW-W 011 ..u.


Ll:mU{Qu,Ll.u. <\3bt

l.fJ{\ . IJ1\ct1\

YcnewHol

ct

I'lU.KdJ<ozo

'Yf\ ~~I~!I'~~I~,L~~~_ _ _..J ~~]


:

,~,~

,
, .
- .

1>

647

: (

tp: .. OO~,

, 8bJffi~e,~

= _ _"' __

:!~:~ ~'~!~<""_ """'' ' ' ,<_

. . ."
?

, , www.captcha.net.

. ,

- .

, ,

11

-.

. _

lO, ,

. ?

,
I( nOnblTOI(.

, , -
, .

'

, -

. ,

3 lO

? ?

;
-

( .

-, - ,
,
, . . ,

, q ,

- ,

. ,

, .

, ,

, .

- '

. ,

, .

, -

, ,

-.

X0I'0I!JO. , UQmucfuUOl-ll-i
cfl':? CAf'(k()"l-i ()u I'uve u51'l-iU
I'3l',u ero i\U.
l'.l Q3()
5rl-l l' fp:? ~e()b fp [l'l'ol'
H1MJ..,-Q, l'l? I-Ie :?

CtI rCI

, MOry
L.
,

GD (Graphic Draw,

),
GIF,]PEG PNG

, .
,

HTML.

<irng>.

U3DU3u ..

u !

, ,

.
,
, - .

, .

define (

'CAPTCHA_NUCHARS',

u'I-\.L"L ug:muv..u,U,J-LOu. d.3bL


J:;:-- ?- i5 w.c:m6 u.,~~ t)o.f1Ite

~~~:I~;'!~~~:'~!~JI"~:~~:~I<OM ____

6) i

h.3.4'Yf\ .\ 0."Yf\..u.

bt

, ,

?
:

rand ()

chr ( ) . rand ()

, , ,

. chr ()
ASCII (American Standard Code for Information
Interchange - -7 -
, , $ s s --phrase
). SII-

97- 122,

<ta~ <tZ~.

rand () ,

SII- .

//
//

.7mO'Yr)

!J,(ct

..uu \.:902.0 u./v\gd,

u.. .:.=YrjUUcJ,U;'I-l. U

<PPclJbt.

~
. (-j-, d ct . d,"Vl'\5l
o
."VI'\U.lJ,U..ct 0/ ~ 3
'J
u.f/I.fJ\J
~ \10 ..~ .;Jd.. btnOUpcteMoM.;J
,}
~{ g I{.l../.. Ui'Y\..
30. u..IJ.9 u,u.ci..

($i = : $i < CAPTCHA_NUCHARS; $i ++)


$pass-phrase . = chr (rand (97 I 122)) i

$pass--phrase = " i
for

hepeu~e)y]

~CYrj ..t.u.

cu,e.o,puu co.ptcho..php.

,. ,

chr{ )

....i'Y\. U1l0.bi.U

~1

;]


, ,

SII - .
, 97 SII-

,
,

A~.

rand( )

chr('n)

RAND_AX ( ).
v

q>yum

qeAoe uc. eue.

randO aem .u
ax~a1

~ onpeg.. guanaoe.

8'

649

i::i
,;}

u u6UR

6
,
, ,
,
60 -. ? , ,
, . ,


, 60.

ro 100 25 ,

"/ D+

Cogaue
guuux.

eui1

~em
tnb

ocyecm
uCnOAb.'308aUeJ\\

p6.Jepbt UJ4-tw.5t

tl l'
.
,
,~Rdfti-tL..... KOt-i.Cl\4.1\4 .95l 1'r,z.,
df~ ( ,CAPTCHA_WIDTH : 100);
'-hr\dbl. ~d, tteo~x0.9u..",oC1iU. '.1"><
df1 ( CAPTCHA_HEIGHT , 25);
u,""fJ.;.t.t..t .. btJ! tJ~..

Qo/
SU5uom.u .

GD,

~t>t:/I..r,.t-W..
J'j.l)Je.7Yr\ooo

. ,

, ,
, ero .
-

I<\ t))

9p'yZol.tX cpyh.J<l-)U
du.U"i!JJ{u.
-J.9GYr))( u,eYr\C\ .9>

~ d.Ju... ..Yr\I

Ll~F\..J.I.,

// : ,
$bg_color = irnagecolorallocate($irng, 255, 255, 255) ;
$text_color = irnagecolorallocate($irng, , , );
$graphic_color = irnagecolorallocate($irng , 64, 64, 64);

//
//
//

650

11

.. !

. - - ..... ,

Hooe u..30ct.u.

,
I

Q,,/u..ctIYj. .9d.U
.. Q.

du.. .
'VY\i{, Ymo~bt

3d."Yr)py.9t-W.IYj Ct)dJv\-dYf1~
Pd.CIIO3H.d.d..u.e

yf1 c'Yt\6..

..

..

651

GD

GD,

, , ,

, ,
.

imagecreatetruecolor()
, ,

......t - - -

GD. ,

, :

, ,

imagefilledrectangle () . imagecreatetruecolor ()
.

GD

WU.p,U.I-ld l~ogOz.o ~80Yf1q .t50Z0


u.~?ct.t-5l d..u
tlu.l\ct~ljuKcelklx.

, ,
.

$im~ imagecreatetruecolor(CAPTCA_WI:DH, ~I:G);


=

~ J3 Yf1d.Yf1 &btl'j.l-W.SI. -7"Yjo-o d. dWj


cOJ.9d.Ko u Ptd.l-W. '\). 100><25

...../..

~t-U<upt d.d..)"/\

u."ff\u.Ud:m U30~d.)\<'.,.v..

g COO11\eeYf1CYf1eu.u. 1./-U.Jtu. d.ux I<OKC"YTjd.K-.

K-Yl\bt .eox 0.9u. f~z.uJ-\


pjU{u,u5l &du.I(u.

imagecolorallocate()
5, . ). ,

~u.6u.)"/\u. GD . )"/\0&0. 'Yr\~bL Kpac.bt U1eeYf\:


pu.coed'Yl\b dJt-t .bt -7.'YI\1..

3btu u,eeYf1:

(0.128,

GD.

130

f\\ ~4

- ..

~)'yj UgeK)'(ju.cpuC\)1'}O

u; eWId., HOYr\~bt_u ft~l'lj b1:'f;b u.~Jo\.


ctJ. U; .)'(jC\ t)pu ebLJoe. 'l,,'( .J,{t.J,
~\l~'-II( u.())'\1I
I '.'
,
GD. d.IjPUJv\~e
,

YI<d,JC\LlSt

e~)ct Yf)l(c)'(jC\
u..:11u. \

DctJbL Cf1YlrHA.
'
\
$text_color

652

Red, Green Blue,

~~,

~ ~ ).
255.

.)"/\IJ.u.d'\

u. pct

.u.5t
. '
~

KO'YY\OP~ Y.9.)"/\
u.tJJt:Jd'\5lJ
.9d.rtkbtU \l,!).

imagecolorallocate ($img,

11

RGB

) l
GD .

, , );

d..u.. ict.., J.. u { ~ :

t')..!Il6' ct.9.9f)IJ..u u,eYf)ooQ

..,g. RG~. g<\HJ-t ct


~ cog'OI\Yll.oC'Yfjb :1Yr)UX OMlloKertYr)o
ll'Yfj .btu l~eYf).

'---Y---J

U3U30UR u !

imagesetpixel ( )
0,0 '~""~-
!
.!

l~51 ~l:.tiu....'Yf\\ {U,tU


.

,
!

(0,0)

!
!

t__'___~ ___

\ll~.-m.51 ,,",
"
51..
.. . t63 00 d...u.

I1

.du...u. du.u.1!)u. GD
\ v;.9u.4'\U. ceYr\KLJ.

'

".'.~_'~

'.N' '

LJ.'.4"!\bt j5.J.u.~\)OYr\

t,pu. ~u...uu. l1 yc:\O u. }

GD,

w,

, .

imagesetpixel ($iIg, rand~ % _D, ~% CAPCA_EIG, $graphiC1010r);

~"

1\00

/
:mu.qx.!.I{<:\)!,)OP

UJO

"""", X~ ",", ",J)(""e1WD ow

k~ "' U,30d,,.u.51. ~ .9d l-U1.OM .:\ 'Yf\U.

Q....u., g KO)yj0p0M

Ui1e>j 1

(.:mu.u

Ud'Yf\bt (;bWPdRbt .dU.bt. 06p~<>M G1U4tj~.. t)\:\.


.3M~KLJ.U. w.u.pu..I?'. u. (:r.bt LA30~r6.:.u.5l .1 ..

d.'i'!'} .ctu.'l t)v.!<.

\(}

imageline ()
,
1,1 2,2.

,
, .

Koop9.u..ct-m,b. X'i ct '1:\rwCi Yl\oYl-<u. uu.u. g .7'!'}/>'\ :\


~9u.4l'1)\ gz. &.. .d.,
u..\:.u.. CAPTCH~
~

COOYl\1>'e'Y\1c1'Yj&Y}OYr)
imageline($img,

rand() % CAPTCA_HEIGHT,
rand() % CAPTCA_HEIGHT, $graphic_color);

CAPCA_WIDH,

'--

../

Kooegu.m-mbt '! ...U '!\.IJ. ..u.u. COO'Yf\e'Y!'}c'Yf\Y)'O'\\ J(u.w,i\d.,.

lipctt'OZ.O J..l..

yz.M UJQ,..u.5l .

imagerectangle()

1,1

2,2.

~.u.,u..

..

9,

imagefilledrectangle()

i'Yf\dgrtctt)g ()

IlpLti-lL\.d.1\ 1\ ,,

imagerectangle ()

cctMbte d.,..1\bt,

/\

u. :;J,.u,u.5l
i'!'}d9ti~~drtdt)9 .~

imagefilledrectangle($img,

,.. r'-_____..

CAPTCA_WIDTH,

CAPTCA_EIGHT,

$bg_color);

GD:

D. ...
im.ageellipse()

=:>.r

....41--- w---.

C~y

, .
OI<

. /
,

imagefilledellipse(}

u.Ilt;,L -

imagefilledellipse (),
heit , imageellipse (),

u.Il 3W.5\

IlfU. C039Q!-lUu.---"""

u.30d f Q ,tW.U ,

, ,
,

-, KecMOm?71 'YfI,

, .

oKu. ~.90J-tbt.

~ imagefilledellipse($irng, , , 320, 240, $color);


(
'---V---I ~
J<u,u i'Yf\d..(\s()

u. i'Yf\dfi);~..(>;is()
Ilpu..lA.d)O"tY) 1..
. dp~YMeo"rY)bt.

u "rY)e

7iY\O

.U.U. u. et;,LC<YYrld.J

}u.Ild.. 3..dU:m

\..iX

pae.btu. .9. 6,

~o u...1\bt

u,eo"rY)~

u. a .u.

u.Ild.

..ru.d1\ ..Yf\.

imagepng( )

,
,

.
,

__. ~
--:. :-- ~

HTML-Tere <img>

. ~

~"
:':'_'w-~:.'
PNG (

'-.~v ___ ~

),

d.,,..5\

header ( ) ,

m u..1\u.u.::;:~r ~ g

-.

~J{iJ.,u..x: ,dcpu

myimage.png

,~

6 (KO"1f)OPbtU b!. u.\i(u S~d~~~eKu. 6.


.u,u Jctd-vn
true u.u. fo..fse

irnagepng($irng);

/t.-..

Jctu.Cu'OC11\u. 0ii\ "rY)oz=o-,- I-LC\/{ ~t']'

tll.1d.
654

t1

>

, ,

1111

d"'t'" .

11

'--

.11\ li d11\ .u,w Kctl.fec't1e


'W\~., .5l.3G1Yr1.. d...11\d ,5(

g.

cfx\ud.. 'Yr]z d6.Yf\d. J(LJ.,u.5{.

..'\'} u'dCl..u. li\.'\'}u., u.


'\'} t:m l1 d . dPG\\lJeP\J ":!
-3d.z.
J'
J
J V

uuu

u !

imagedestroy ( )
Y~eu.e u.3 0 \,.J..l.5l
u. d.u. pe.cypco
ce.pepC\ f) \.,
:J. 'C\C aYt\t)ctct 4~.;Yf\
f5 \ u.30~Jd.u.u., .3'1r)O XOPOWu.u \u.b


GD

np0zrau.poartu.st.

,
imagepng ( ) .

,
,
.

_ _ _-.:>:...

190. ~.u,u.u. iYf)ctI1 )}d


1u<u,u. .3\\)} i:ru.e u fct-Pse

imagedestroy ($img) ;

,3C\u.cu.ocYf\L.l )} 'Yr)OlO, f{c\I{<0


)'t). fJd llctu,L.l.
113 nasnnu

f11V'U1jUU imAuedestro''''

"

-. - -

l 11)n ..-'lL.l11).
.

KO"Y\0pbte b. .3\\,

ee. u.30d .u..


6btu- .9ct bt. \')
u-"" -z..5l.

'i'lY)o~(r.

'J

. uu
uu 'hA~my
...----

Cy\C\~i1'Yf\ecb .\

u.Il30d1\ .31\
~~u,u.) npu. pC\dO'Yf\e
_
0
KC\-:9bt. U-3 u..3 ctu.u.,

cerga ygasrum UOGpaetJ9


.,..J _.

'\

~ V!9.1\ UW<\11) 0
U.30~\...u.. Ml\opoe

imagestring ( )

u. t? u.\IlC\j.

(1-5)

011) 1 .90

Yf\ct.u.ct"Yj
u.l\\, u.t'\ ..

~ f{C\1')u.d..u.. 1i Yf\d..
u 5 COO1ie1i C1iye'Yr)

. ,""."",~_~.~_"~~~. \3.)'L!l TeKc_Tc:J

, .

lk-m ..!,U wu.\

l'I\:'IY\-m~l'l\ dJ~
WLi.'IY\, .. .dlill.

cow<. pdJMepdx.
imagestring($img, 3,75,75,

' ',

imagestringup(}

imagestring ()

,
,

,
90 .
,

imagestring ( ) .
~

655

imagettftext(}

30i

True

imagestring ( ) ,

. ,

, ,

. ,
GD, ,
, .

. gb!.0.9d Yf\eKC"V\d

imagettftext()

g kec1r\d.I-l.9d.1r\ CPOpd.1Y\e
u.t)3~)Om.. u.t"V\bt. True


, -

u ,.r'\lJ{Uj.l5{. i1Y\d.Qei.t: textO,

ll .

't'J

,J

, .

imagestring () ,

!..... ". ""." ..... .


!
X.VL~~!?~~~ textJ
W NO

w"'

l' .~

, >.>

\ . fYlu.~~ 01j J<u,u.u.

,
apYMetIa.

.F.

~ l:!,4 ~ru.r1)\ g 4llfd....t


I1))u d.u 'ljI<lJ.

11\d.~~strlll() 4d,JJ I<U41\


u, i ettf'te t()
tJpu 1s'bL meKc1i\<1 1l0ro

'1

- emc'Yf) ye'Yf) /(,.'


me~(Cl\a.

u."V\bt. '!
. .u....z

~,3t:Jd.m. l-'..."41. "t\eKG)'{j). ~ ~.ct 1'\1'\Q..

True ,

,
WWW.

fontstruct.

. -

656

11

Cnyi1m <u
imagettftex.to g rusoro
ynpaew napa.ernpa.u

sblsoguMoro mecrna
UCnS8.u-

uqrn roe .

uuUR 60J

-----

..

+ _~~

'-'~

\1.'1

i)'f)" .r\RCQi:($i)'f)3, 128, :128,128);

-, ,

, . , ($ img)

($black_color, $white_color $gray_color) .

i)'f)\~.f\t($i-, , , );

~
i"rId.g R4t($i)'f)9' 255,255,255);

r---------,

imagefilledrectangle($img, 10, 10, 90, 90, $gray_color);


imagefilledellipse($img, 50, 50, 60, 60, $white_color);
imagefilledrectangle($img, 40, 40, 60, 60, $black_color);

imageline($img, 15, 15, 50, 50, $black_color) ;


imageline ($img , 15, 85, 50, 50, $black_color) ;
imageline ($img , 50, 50, 85, 50, $black_ co1or) ;
imagefi11ede11ipse($img, 15, 15, 20, 20, $gray_color)
imagefilledellipse($img, 15, 85, 20, 20; $gray_color)
imagefilledellipse($img, 50, 50, 20, 20, $gray_color)
imagefilledellipse($img, 85, 50, 20, 20, $gray_color)

;
;
;
;

imagefilledrectangle($img, 10, 10, 90, 60, $gray_color);


imagesetpixel($img, 30, 25, $black_color);
imagesetpixel($irng, 70, 25, $black_color);
imageline($img, 35, 45, 5, 45, $black_color);
imagefilledrectangle($irng, 45, 50, 55, 90, $gray_ color);

imageellipse($img, 45, 45, 70, 70, $black_color);


imagefilledellipse($img, 75, 75, 30, 30, $gray_color);
imagesetpixel($irng, 10, 10, $black_color);
imagesetpixel($img, 80, 15, $black_color);
imagesetpixe1($irng, 20, 15, $black_ color);
imagesetpixel($irng, 90, , $black_color);
imagesetpixel($irng, 20, 80, $black_color);
imagesetpixe1($img, 45, 90, $black_color);

imagefilledrectangle($img, 25, 35, 75, 90, $black_color);


imageline($img, 10, 50, 50, 10, $black_co10r);
image1ine($img, 50, 10, 90, 50, $black_color);
imagefilledrectangle($img, 45, 65, 55, 90, $white_color);
imageline($img, , 90, 100, 90, $black_color);

657

.,..IiL
...
"

'

M~Ea[~~[

-, ,

, . ,

($ img)
($black_color, $white_color $gray_color) .
()

imagefilledrectangle($img, 10, 10, 90, 90, $gray_color);


imagefilledellipse($img, 50, 50, , , $white_color);
imagefilledrectangle($img, 40, 40, , , $black_color);

imageline($img, 15, 15, 50, 50, $black_color) ;


imageline ($img, 15, 85, 50, 50, $black_color) ;
imageline($img, 50, 50, 85, 50, $black_color) ;
imagefilledellipse($img, 15, 15, 20, 20, $gray_color)
imagefillede11ipse($img, 15, 85, 20, 20, $gray_co1or)
imagefilledellipse($img, 50, 50, 20, 20, $gray_color)
imagefilledell ipse($img, 85, 50, 20, 20, $gray_color)

;
;
;
;

imagefilledrectangle($img, 10, 10, 90, 60, $gray_color);


imagesetpixel($img, , 25, $black_color);
imagesetpixel($img, 70, 25, $black_color);
imageline($img, 35, 45, 5, 45, $black_color);
imagefilledrectangle($img, 45, 50, 55, 90, $gray_color);

imageellipse($img, 45, 45, 70, 70, $black_color);


imagefil1edel1ipse($img, 75, 75, , , $gray_color);
imagesetpixel($img, 10, 10, $black_color);
imagesetpixel($img, 80, 15, $black_color};
imagesetpixel($img, 20, 15, $black_color);
imagesetpixel($img, 90, 60, $black_color);
imagesetpixel($img, 20, 80, $black_color);
imagesetpixel($img, 45, 90, $black_color);

imagefilledrectangle($img, 25, 5, 75, 90, $black_col0r);


imageline($img, 10, 50, 50, 10, $black_color):
imageline($img, 50, 10, 90, 50, $black_color};
imagefilledrectangle($img, 45, 5, 55, 90, $white_color);
imageline($img, , 90, 100, 90, $black_color):

658

11

R  l

" JCi

captch

u,.u cC\Pi:~PhD .

"

\IYj5()'IJ... !3.'

. - ,

)'IJI(D{,t,1 " "

1,"1

~~~~:~:~:~~~~~_~:;::;~~

'"

U dr0.9\IYj

Wl

0!.

tJ

<?php
session_start();
//
def ine ( ' CAPTCHA_NUCHARS' . 6); //
define ( ' _ ' , 100); //
def ine ( , CAPTCA_HEIGHT' , 25); //
//
$pass---phrase = .. " ;
for ( $i = ; $i < CAPTCA_NUCHARS ; $i++)
$passJjhrase .= chr(rand(97, 122;

C0.3.9'~".ue J,(.Yf\.ij, ..w,ux


Jrlc\.IJSf. . Yf\. u..

g ~.Yf\u.u.dU,v...U dJ, u.u.I-'J::n.

u. "l:1l.COy!\b'~ u.,30..u.9.. .

f5I

. ,000000 bL . . \!...lYr]
U9IYjUJ,Lt~
r '! (')"

g- \".:g1J-l !),
I

//
$_SESSION [ 'paSSJjhrase' ) = sha1 ($passJjhrase) ;
.

COXpd..tkYt!b

P:\J,y '\3 \1-l&r..

:9., heo~e

pctI-l.U.1I)(;.'

g I')~.~k...

S/1I

g,

,1..

..

,. ,..',

~~'y'-\.1i

.\ ~ \" ()
q;1. !7]O~O "1"1110&'1[,
//
,~ fl'-U
~()ctu. peu-Yi1IA~ti~\ '
$ img = imagecreatetrueco10r (CAPCHA_WIDTH, CAPTCHA_HEIGHT) ~I''il~!7] 1{ . )Y'jI'). f
02

// : ,
$bg_color = imagecolorallocate ($img , 255, 255, 255) ;
//
$text_co l or = imagecolorallocate ($img, , , ) ;
//
$graphic_ color = imagecolorallocate ($ img , 64 , 64, 64) ; // -
//
imagefilledrectangle($img ,

, , CAPTCA_WIDTH, CAPTCA_HEIGHT,

$bg_color) ;

/ / ,
for ($i = ; $i < 5; $i+ +) (
image1ine($img, , rand() % CAPTCA_HEIGHT , CAPTCHA_WIDTH, rand() % CAPTCHA_HEIGHT, $graphic_color);
}

/ / ,
for ( $i = ; $i < 50; $i++ ) {
imagesetpixe1 ($img, rand () % CAPTCA_WIDTH , rand () % CAPTCA_HEIGHT , $graphic_color) ;
}

// ,
imagettftext ($img, 18, , 5, CAPTCA_HEIGHT - 5, $text_color, "Courier New Bold . ttf", $pass-phrase);
/ / PNG -

~
. 'WI~.
hdr("tt-t : image/png");
'_ _ _ _ d
d "1
,u.u. ,\'-l
imagepng ( $ img) ;
iJO !)\..
U 6 wIDe8y'""'''}
.
~
fj ,
,
!)~iG
01"0
f
, v1ll .yKC\,3C\Hu.51.
, - \u PN'"
G--u.JOpct.e,-u..\,
~ cpofctYr]e l'
"1'" 1'j .. hjY!]u. I{ < ~
~ / ~ U\l3I~...\.:~. ce
lj\'Y1'j51
u.rrJ\
d.u,
>~magedestrOy ($~mg) ;
\F~~-Lbte \)pe)i(..ae
3pd,ye.py .
i:l~~p J'\;

-}l\rtmbl.

HTTP-:'I\.
~

Ne. Bo)cf:f.tf.

coptcha.php

..

659

n captcha.php

' --

ero

captcha . php

www.headfirstlabs.com/books/hfphp).
- .
, .

, Ii .

. 3cti. 3 0 d.-..u.

COC"\I\\OU'I
1.1.< ULQeu'
th.,
" 1 " 1 V J ,,-))Ur~I<d.u.lU cppd.Jbt
(."!'\U YK f\u..~. .ctU))d.,
btSpd..bt.x d.Ubt. OdpctJOM)
.I{UJ.\.I. UI-U..I.5(.u, u "}I(CVa,.l,u,
"YY}ctl<- d.Ubt.

J.9ct .u ('I.

* ",

660

lG8

11

__

'~

CP0I4J::\".

uuUR

u !

u rooombI ce,OQflm
MeHfI ya!l1oMOl1Ime
m,m !

n
(e
. ,

GD ,

-.

. , .

.
,

-!

. ...!

.9.r d1\

IiU..iJ5L

"''II ..CiIl.. Ci 1I...... ,' 8II B......

i u."YfIdprU..-4,.

30d..u. 3.9d..!

eobi .9 0e.9e..

. . " .Ci ..Jlli8tIII CAPI'CNA , RIII.


811'1.ll SId .-

:)0 Ir\JJ.51

... cpbLed..

. \i(;1Llr\del'!\c5t

qo. ~2-.d:Yf\
~~d4bL.
POdO-m d Ii<V1KOU..

I~ .eo6x0.9ud.
I-lCl5lIi !

l:e lR.. t. "." SWOllll.

r)) n r

n nlo30en
.

_ n ,
nn.

L-
. ,

, ,

capthca. php <img>.

661

HTMl-
. ,

, ,

capthca. php

. 68.11

,.
.:

__ __
..

.,..

b:'::':~"':~~~1;

_.

. . . . . . ....................................--..............

j)bm.tw! Oc-md. 0.9I..1... --m,l! .

QA"III306. " (cuWl


r _S1 (F"e IIW .

" "'Sl iIOJI.SOBaTenlO " "eJle

. Re""ItC8111IIO< sy.

662

11

<img>.

. }

ltll ltII 6ltll lI

addscore . php
li .
i f,

, jj
,


~~,
<?php
session_start();
?>

-& -n

<htm1>
<head>
_
</title>
<tit1e>

~: type
a="text/css" href="sty1e,css />
<link re1="
sty1esheet
</head>
<body>
<2>

_
.

"IIJ.6f10cr
'1IA 7

</2>

qllh

1; '1Iii
nO,.1I30801 eJ'Ie.

<?php
php') ,
require_once ( , appvars.
'"
require_once ( 'connectvars, php ),
'f (' sset ($_POST(' submit'] (
1
( /
- (_S.
$dbc
= mysq1i_connect

) ;
_ USER .
_PASSWORO, _N

$_POST
)
($db
tr im ($ POST [ ' ' ]) ;
( / ,
l'
1 escape strlng
,
-$ OST [ 'score' ] ) ) .
=
real
I
trim ( -: ($ FILES (

$
~Sq ~ir
$ , - ' -

($~C
. - escap~_string
1 ", ">n ($. 'm

$,cre~sho, ~ y,~ C_~~~E;; [ . ,cre~n'ho' . ] [ ., : ],

'scr~enshot ' ] ( ' ] ) ) ;

$screenshot_t~pe
/

n.

3 ,jd\"""",,
:9 t-t.1Jj
. u-u.dl\jvt.
u-
,
51.

- $$-FILES [ , screenshot ' ] [ 'Slze ];


$screenshot Slze - (

.tA

/'\!. t)ce jcVJ'


u-.d .
'Vr\G cu.u.
.
,

-
q:,'V
'
-
1.131 h,..u.
i
,01",,0.

~:=

u-

//
shal ($'_POST ( 'verify' ] ) ;
(
$user-pass-p
'] __ $user-pass-phrase)
'f ($ SESSION[ 'pass-phrase
-l
r ' .. -{
se . < c1ass-
".>
echo

t)~gu."'I\.
'1

. e..ue

U:g i-l"()'lj.(ow,o
\u.u.df\J)O
LI"~~
,I. I..~t Q.-.
U
rhpdv~OU,
"

. < (> ' ;

G
'1

110 t:>dl1\:>

?>

Q)OfMbt.

"
'
=" <? h echo $_SERVER ( .
_SEL
~~~~ t="~u1ti~t/f_~.rm-d~tI~~m~~~~~~:louset="~~~~~nech~~W~AXFILESIZE;
?>" />

F'] ; ?>n>

- _
$' ?>" /><br (>
1a~e1
"
">:
</l1>
_"
"a1ue="<?php if (!empty ($) echo
'
<.
-'''
id~'n=e'
n=n=
v
. '>' '>< 1>
<lln~u~
~~~~~s>:

"
" 'd="score"<ll1:
am=
score v a1ue="<?php if (!empty ($SC01' e echo $score, '
<
<input type= text
' </l1>
<in ut type="hldden
for=

<labe1 f="sS,ht">~ t" n~me="screenshot. /><br />


'
e="file" ld="screens
veri fy"
< 11
> . fy" val
..
<
, ' v erlfy"
verl
" />
<input type=" text" h ="
=
U.
<img src= captcha.
,,!)
<hr (>
-"
t"
" submlt
' " /> 1<J
'd~........

<~~:i i~~="

<inpu'
</form>
</html>
</body>

>,: arna~~,l
= .d.1l'\
"
CA?Ct!t, f'\0.91<J1O :'

v1u="" =

'- "

30 C\),eApu.

" (>

" ~eu"'l\u.2.d

c~e!-'Apu.~_~ .u5\..:7i'1\<.I: , 3'


o e~ _\",
'' '. ~u",c~
u
1. 1\:m C:Yf\PdJ-U.
e

p~~ ,l-tU- CAflCH/t.

uj~?
D

'""1

". . -.. . ". ,.,, . .,,,,,,,."'C',,,.,"'"C,,,':UUt

663

- u addscore.php CAPTCI-i

--
r ,
lO _ .

addscore . php ,
~~,

captcha . php .
, ,
, ,
~~.

addscore . php

.
~:1>.
,

,
~~.

r"l1\

rv.\K .,

df
\lOKOU. 64. 4.
.dwu.

d,'Yf\}v\d.'Yf\u.6.u,u.u.! ~

LL 6.. r.

~~~:~~~~

iir: [99'999999
80--.
..... . -"
. ...... ....... .. !'
vv8J1 .
: ~1.~ . 8
- -"
..._ _ ....... . ~ arollJllt l\!
8: !1IooiI.'.",,",."~.~.i :; . . . Jt " lt l\1ul n

............ _-_ .............."-_..........._-~4I ........_ - " "'0'"'110 .

loci'l'jo5t...o UJ}d
u:muu.l(du,UJ

f'\3d Clt
j'r',. d..Yr\

d,f{)jOC\i'l'jUJUpOd..bt..

Cl)dM-60i'l'jd)v\ 3d,I)5t"t!

I"\Uu

u)jd,ph!.e obt:.
664

11

uuUR

u !

~~'}1t,

~: ,

Z1f11blX ~011YOCO~
~:
: . -

.g ?

oTPNG?

GD,

: . imagegif ( )

imagejpeg ()
imagepng ( ) ,
GIF JPEG
.

~:
?

: !

GD
imagecolortransparent(),

PNG

.png
.
imagepng ()


, -.

src <img>,
captcha . php

,

. ,
< img> ,
src
.

-,

-,

<img>, src

src <img>
?

OUJuoa!

,

imglrllt().

imagegif ()
imagepng ( )
imagejpeg ( ) , JPEG

, -

createtruecolorimage ()

GD

, , ,

GD -

PNG

GD

igg

( ).

,
imagedestroy ( ),
.

665

R nuu {<mmmu

<finn }'P05Hel1

<l~ npomU50nocmaetl51

, - .

nUAeJ

<tlecoornemcm5\J9))

, .

U.1

~ ,

ecoornemcmui1

KaeropUSl.

~~!3~~]

u r. nrLl;'H3KOB .<, s< _ Ll

(, 3 OHU r.rWl1 r ra)l1bIM (ru. Ml1e (ruu


kakUX-m 11u t:>< 11\?mU110m&u, U

HU UUJ( ll\?wmu, !1 (
MOUM mmmu. 17 4 ()~

U1'l'\d
u

Kd.1'I'\e.z.puu

19u, I\o'll'\ebte

. .

IIl>t)u."Yf\dlVYl\

o&,el-llid)'().b u.
0.91-\.02.0 ~32J151..9<:\'

~r

" "Yr\,

l.IJJf8, am.II

du."Yr\
d ~'i)

Kd.P'Y'urt~ c~oe20

..

Kelco~Y1\ge"V!1 "V!1u, a-r

)J\ I1~OC1l)O
'.

t)epe er=
t) PL.3.dK o.
I

~ 18 l.: lI,

.~ lll

IJ 8000<-'\"
J>.rn-

JI

~.

OcJpble

.. '" ..

prn

1 I\pU.3.dKOe
..'\'\.'Yf\~v..,

~..,v..'\~.

l\ d.'\.: Yf\
bt. U.dJ1.U
urt'Y\ept"\peYf\d.u,u.u. Yf\oGoO,
t.!.. o..u .

~
,',

ern

cooYf\gemcmy){f'l) .9pJ~
2-}

wecn

" R &<

np.aea II~ 2008 nJI .;Jie}(),~ li.

666

11

u (jOHHbIX !

(

, ~ ,
(/) , .
.
, ~ ,

, ~.
, ...
, , .

!-':::::...... : . . ::. "-.. . . ."'-.-:. . :. . - ~. j

C,-.r.t+11pa..I1..: t

C.)..:('! I~8Ic e~_

.@

< ~.. ~ . . "_. ."~ ,

f~

I~ ".....::::-..:=:"-"""
<,---d---: H ~I'" eO~,Mt._...

/'

:I

j~

1:j~~~?:~~:~~::::~~::~-=:~1
J;1tJU1...... ~olJ~n:

15

1
:

(': oc. .1I141f:

,.CtI!tfh-)I'; : 11.*1p8U :iI'~


x....... t~r~ ~Ort.P~

! .

.,...L.....,:r.811,:'1*nO' (;) :"",

,::=?:~=::;==~::~~::::, :,~!
;

~P)ca.q; <tQP~7P''11t>: n"",.:_

~ ~nr.-:'1*=:"'t ~1IW

,

, .

~~~~~.~~~~~~~_.
i '.
I!i
....._ ....... _.;~'

.iII._

<:1 .u.

/( -1\

30n


l:tl BOnOCt
eon,

IlpeodpC\3ogQ"f!1b
-Yf101\ Iler,e
~ ~ IlpU.Jd/{og
.G11)Yf1"f!1u..

pt>6
"'
<.

g .u.Wjz.:t.

u..x pqll.u.5t
1)0 K<41\e.optJ..5t.

Q am

, ! ~

667

,
. .

"j)

ynp4~ O'I\ Yrj'Yf\ ..'Yf\ CI)OCod~. I(O'Yf\0tbt.e ~


!. uCI)OJb3~d"lY\b QJl. u.3:fV1UJdu,uu ~ 1) UJlO~ ~
tlO'l\Yl\YI\u.~.
coceM et'iJlOXo~ 15:f
YI\<11( 1(<11( 1(d.:90il
;ru.3dK~ .ec~eYl\CYI\I5UU
71

UdIlQJ.

.9jfUS 1)0

1(0JlUYl\,

l.U1).pctbt.

ll.9 .!J1)

J...

.3.ct.u. ~

I{f<:90. U4tl<\30. 3
'W}LA,cl.

d:9bW. 'Yr\du, l1.. "'l\d..1\


u."'l\ .ecoo1\~e"'l\c"'l\o. --~
. .9d.t-lou. Kd'Yr\eG0puu IlpUJ.dKO
Keco01l\e"'l\c"'I\uu..

[
, ,
, , . ,

, ,
,

,
- / ~
.

~ Kd)\G.9oM MdCC\J.~e
1\Opo.o ~po5\ .f,d,.bt.
u...d.u5l c-m,lJ,
\J. ux UU.L"'t1
$graph_data

= array (

IIli(t.I.I.IIII;i;I~.I(.p- ", $valuel).


array ( "

2", $val 2) ,

~~~~~ (" 3", $vlu), . :

K<:\~90MY ..)/v\.iYI, MctcCIJ.d


../
Il e pg'olo ' coo'Y!)eiY\c'Yrjye'Y!)
,9. '!)u, zuc'Y!)O(~PctJv\bt.
668

11

.'

uuu

u !

1fG ffi~G'th,

61)tl1blX ~ol1foco~

~:

': .

~ ,

~BYXMepHOO ?

: ( . ,

, ,
,

. ,

, ,

, ,

: ,

.
,

, ,
.

bithdate

response

id~

669

~.
,
, ,
.

J<d u.ser_id
u.I10.3"Yr} I1fU.

"W\d..u.u. 3d!") !.
llf~9..u.: 3.ct.u.U
I1pU.3M l<o1;' ."Yr}~"Yr}"W\u..
I1pU. !")ou.cl(e 4u.
."Yr}"W\"Yr}u...

J<d dtr_id
u.t}O"Yr} llf.u..
!")f~..."Yr}u. I1u.,.ctl<d

Kecoo"W\e"W\ "Yr}u.. .u.


u., 1<d."Yr}.u.u.. Hd.ue.od..u.e
d."Yr}.u.u. .3uo
ll!l.u... 4u.d.u...
"W\~u,o .u."W\.ctbt.

l-U(d reSfollse_id u.t) "Y'l\.


t)pu. Cpd.e.u.U. .3.d.u.u.

t)u.,.dl(o ."Y'l\"Y'l\"Y'l\u..
f!, t)30d"Y'l\u, m3!.
'"'u."Y'I\. t)amu.,",..bL u.
"Y'l\u. 3.d.u. (KeCOO"Y'l\e"Y'l\C"Y'I\u.e!).

670

11

uuUR

u !

:
:


rpa

lC ead Arst: ,
, ,

. ?

. ,

rcrorpaa: , .
,

(JI( ead

Arst:

rcrorpoo: ,

ead Arst:

, .

?
rcorpaa: , <l>'>
.
: , .
,
II ,

, , ,

. ,
, II ,

D . ,


, , .

.

.

<lBbI ?

lC ead

first:

rcrorpaa: , ,
. ,

ead Arst:
,
- ?
rcorpaa: . , ,

. ,
,
, J

-,

Arst:

rcorpa: , -
,
, , , ,
.

... , . ,
?


, , .

IC ead

100 %: 32

50 . 50 ?

IC ead Arst: . ,
,
~ , , -
. , , ,


, ?
rcrorpao: . ,
.
, ,
.
,

IC ead Arst: ,

,?

rcrorpoa: , , .

, -,
,
.
,
<l~.

, .
IC ead first: ,
, ,
- , -
?

rrpo: , . ,
-
,
,
.

J( eod Arst: .
, ,
, .

rcorpao: . ,
.

671

Hae~opuu nu Het:oomeemt:eUR


~,

, . ,

. , , ,
: ,

. , . ,

)30 UJd.d..u l<.UI01'\cI

, ,

4lAe..oaua I{,QI{

, .

.u.x LI,G"oJJt,JY)(l\\c5t
iYrj

~.Pd,)i(,eHIJ.9, JotN duW\

d.t 41'!\UbL 4.

'I1idu.u",'1, f.)i(4~}
$query = "SELECT mr. re
3rldtU.L5l I1puJ' K O
~

mt . AS topic_nae.
..011'i~:YIi~'f\\Sv.5l, : 'Ir\a UU,\).,
"FROM mismatch_response AS mr " .

esponse,
)
"
~

~!~~~:;3~=~~~ l.i{l~ill.jiiili:i~lil.tIIijli.ilti~,il..l~IIII\.
'-h!\o d.)''I ~~J'-)l\

u '!~. COO'1Y\eYl)cYl) :::l)OlJJ,ue

"WERE mr. user_id = ."

. $_SESSION [ user_id']

'du..~\r5( :\..

"''';

r::JJ. .. u..
_
d.ccu.. .9 .ctu.u

1\ d.1\..,u.u.

, , ,

I1fUJr::JJ.u.

$user_responses.

..'Yr\1\,,\~~)<)u.u.

. ,
.

category_name

J{
J'Yr\ct1\ct

3ctI1POCd.

Lt1)

v...ct.u.

_4_----

-----'"1

.Me

1\..

I{cl. t)u."'4I<d.

..'Yljf1'Ylj'!1u..

3 MbL

I')U!d.u.

cOJ..9d.rtu.e
.geYXM~p.o.o
C\cc;"

u. "'ll...u

60 ..9C1...btu..

----..:.:.---'1 .

;::-________
$user_responses

672

11

--~':';;';'---1 ,

, ,
...

.. !

HOBoro

IIA ntI

r,

MySQL,

omOCtlTCtl.

SELECT, , ,
. ,
,
~~ :

m )f(,el ~bL-Vn
u.l-VnU.U.d.'Yf\

0r

1l 0 .30d,-Vn $!.,

I(O'Yf\0pbLU le. '!\


.-vn~"l\ Q,3

SELECT mr.response_id, mr.topic_id, mr . response,


mt.name AS topic_name, . AS eategory_name
FROM mismatch_response AS mr
INNER JOIN mismateh_topie AS mt USING (topic_id)
INNER JOIN mismateh_category AS USING (category_id)
= 3;

.,9C\rtbtx, . u. 3d.1'1 0U

<:.\l e'Y!\~ I1..u.)f(,eu..

eCOO"!Y\f)"e'V!\C"l\eu.5l.

d.'Yf\U,-m ..u,d.,u. ld. 11)0, "I\


.9d.i-u-tbte J"t\d.'Yf\d. J<:I.llpOCd.
,)O'Yt\. <:.\.bt.u' M<:.\CCU,ed,
$u.ser_resp0t)se.s, t)OK<\3<:.\HH,t,L.u.
\l.:9.u. "l\d.lU., <:.\ -'Yf\
1<<:.\1(
11)0, . bL .u.<:.\..

fd.J

nu mu


,
, ,

$user_responses.

, , ,

, .
,

$user_responses ,
$mismatch_responses

~%>,


, .

, .
r .

-m Yf\o-m . 1(0.9' 1(0Yf\opbLU. bL u.ll30u. II . bL.il g-pcu.u.,


Q u.J.<).u. -m,, Yr\ mJ-m pctJ g.l]..v. 1( #4 'j
_
I ~fu..Ql(g ...OYf\-m,-mu.u. !. Yf\ct. c03.9d.eM #4CCU.t5 ct-m,u.u,
~ J.< KO-mbt. --mu. IipU.3AKU. f1u.....:m.
$categories = array();
for ($i = ; $i < count($user_responses); $i++) {
if ($user_responses[$i] ['response'] + $mismatch_responses[$i] ['response']
$score += 1;

3) {

ll Yf\. 1(0.1( ce : l-LO,


J.ccu.~ $.iris C"'!Y14oeYf\
d"1\ 1'\0 091-LOU. I(.-vn.v.v. .
KecoO"Y1\:e"\1'\CYf\eu.e.

tfc ffiii't1b

Z4tl1JX ~Ol1fOCO~

': 3il. ,
MySQL-, -?

: .
-

,
.

': , 3
lO ,

: .
. :

n ,

, n

. , , .

, bl

...

674

11

UUUR

u !

Ci

,

~-, . ,

, .

8"I"n" 6ase ACI"I8I nl10_

lltn8II ll 81111'I811 lR'r.,

u.i1 t) QYr\.0u.i1
.."!)"Yr\G"Yr\~iOu.x
tlp,U.,3MI{O.

8COCiI1'"8,R 3R.

tid Yr\ m J/'bt t) d.e

.6'ct.u.u. ~ n..

l{aYr\e~OpLtu. h.ecoo-m,-m,"/}}t
l1 n ~llu..3I-tr. .u. 'I1
r.
t1 KctYl]ZOPu.u MeC)je
j(u. cmOM .e.COOYr\e.Yr\cm.u.U

rrp I130 AaHHblX


. d.:90U u.j UX.
r I1
~ . t\tlb Kd.meeopuu
n .
Mec.-m,e t .u.'1cm1
, ,

,
, ,

. ,
,

ro ,

.Yl\-m,cmu.U
ct.:9Du u\) .u.x, .N'b,

}-N>!W !"\.:.

1(

CdJ>.j

(W_Yf\ Yf\ctl1:J

_...
CO.3~)O 2.UCll\ozpo:bt


.

ro.

.~

m"l\ d.ccu.(S J!Yr\

.d.u..\.u 1<d."Yr\ . . fu.Ci


u. YKdJd.u.e u."Yr\5\

..ecoo"l\5e"Y!\ cmey}Otu.x
Ilu.j Ilo d.:9_0U
u.j

YI)UX 1<d.Yr\.u.u..

of5bLe .9d..bte
f-I.4lA..f5\.u.
l<a:-.j?u.Ci u. l{u. "'ll1f5d.
.Yrj;'"'ll1G"'II'}}u.x

~pu.J.Ql{og u.x

.7"'1110 LI./oI\... Yrjo, 'II'} d.M

.u. .. Jd.1-U.L5(

zucYrjozpd.bL.

,
, ,
,

u..1103~d.I-UA~ c.p~u,u.u
.d.c.pu.u &JlU.Ol\.u. 6\).

GD, .
.

675

;u


, ,
,

$categories. ,
$category_totals

/{ul')
3.:m

u.l-td,/(bt.,

~-~==~~*------------------- I-td,u..D~u..
)f(~

~d.l!')e~ofu.u.

~cd.te9ories

l1l!') Ul')

MQccue

rlecooi\el!')cl!')Y}O~UJ(
IIfUJrld. MQccu.ee

$cd.te~ory __ totd.Rs.

BHeWHOCTb

$category_totals

$categories

$category_totals,

676

11

$categories?

_ _ _, _ _ _ _ . , _ , .

_....,c~It.t' ..rt

"'~ ." II ~&JJf"

.. "".." .... --.



, ,
, . ,

, ,

-.
, .
Ho.oro A.yxepHoro . AII" " . r .
. .. :l. AII" :l r. .
. . " . . r ".
., . .lO .

tl.

. .n ., r "

lO

KaTerop'

. .

. c.n.,,: .n" .n . r

noc.neAHero .n
oAHoMepHoro

A.yxepHoro . ." r r .n

.?

! ." r", ."

. . ....

.n . r .n."

. . :l

. ..IO . r,
.n

..

.n. . . c.n

. . ..

,
,
.

-,

$category_t otal s ,

$catego ry_totals

array (array ( $mi smatch_cat egor i es

for each ($mismat c h_categories

$category)

[]

));

8' "

6.

-,

$category_totals,

. "!) :m /' .u...11'\.." ..

$category_totals

t)'\ lj.u.U '\ ctC.CU.t'd .d


u.ee"!Y) u. COUt)t() MU.o:1 C u..u.u,o.
array(array($mismatch_categories[O], ;

foreach ($mismatch_categories as

$catego~~~

_______

m .l;ltU
J"V!\d"V!\
~btt)..u.. d.rU1.0~

<.\.

etjepb !. CI')OKOU.oo
btYepl<Kymb ))'j'l} J'I}ctt)
Ie.
u. 4z ct)U.Cl<ct, OC"f1\ctu.
))'j t).uu.I')t-U<"f1\
C03.9ct.ue ZUC"f1\OZp<Vl\b!.

j
..oor.e""..." AfI-RDi lC...,.

678

11

~ :

. !

1ft bJ~iilG'th,

Z4111blX ~Ol1rOCO~

'V; ro ,

~ ro,

$mismatch_categories ?

; . , , ,

$mismatch_categories .

, ,

, . ,

$mismatch_categories, .
SELECT topic_id FROM mismatch_topic ORDER

category_id, topic_id

,
. ,J,

.
,

'V; ~O

, ?

; , . , ,

, , .

,
.

679


, ,
, .

, .


, ?
, ,
~~, ,

. , .

:

~()ab u,6I'atu.

nnolumb 4' &.

~()ab &, Kool'~ & iy()e.m~ Uc.noAb~&amb nl'u I'u.&uu 1f'U<UJC


~Aeeo& u ~c.a.

HaI'Uc.o&amb .6 f\tCllt01f' u ya~b UJC uat&Ufl.


Hal'uc.o&amb l'oyrU &OKpyr&O ru.mo'l".
Hal'uco&amb ()uana,oM ~atuQ c.At&a ru.m01f'.
JCl'um f\tc.m01f'aMY &4'6.

Ii.9\ .9U.d.liD.,30rld..
u.u.rld. 1\.

~aAUmb ~6I'atu. u, flmu.

:D.,3bL.1\. I1fU.
r--------------+-----, ~bL.30 J<.

u.u.rld. cex
IIf5uJ ..bLx

:\10
u. d."Yl'\..u ....9

rttv\u' bLu..5t }Ow,c51

. rt.t-UJ.u. w.u.pu.bt.

.u.i'r\z...bL
u. u.'~1\d.

11 ..z,.btx

}i\.1\.

680

u.i\

IIz.w<o

tJ.Wj.

11

3rld..u.. cex
bL1\ .90..bL ~bL1\

u. )!j .i\
Md.CCU.C\ ....btx.

U3QU3QUR ...

u !

functiondr aw_ bar_ graph ( $wi dth , $height , $data, $max_value , $filename) {
11
$ i mg

11

=... .. .... .. ... .... ....... ..... .... .. ... .. ($width ,

$height);

: ,

1/

$bg_ col or=... . ... . .. .. . .. .. . . . . . . .. ..... .. . . . . ... . ($img , 255 , 255, 255);

11

$text_ color =.. ... .. .... .... . ..... .. . ... ...... .. . ..... ($img , 255 , 255 , 255);
$bar_ colo r =

($img ,

//

($img , 192 , 192 , 192) ;

$bor de r _color =

1/

, , )

1/

( $img ,

, ,

$width , $height , $bg_ color);

/ /
$bar_ wi dth = $width / count ($data) * 2) + 1 ) ;
f or ( $ i =O ; $i<count($data) ; $ i ++) {
.. ... .. . ...... . ... . . .. .. . .. . . . . ..... ... .. . . ( $img, ($i * $b ar_width * 2 ) + $bar_ width , $height ,
( $i * $bar_ width * 2) + ($bar_width * 2) , $height - $height 1
( $img , 5, ($i

* $bar_ width * 2)

$_val ue)

* $data [$i ] [ 1] ) , $bar_color) ;

+ ($bar_ width ), $height - 5, $data [ $i]

$text_color) ;
/1

. .................... .. ... . .... ... ($img , , , $width - 1, $height - 1 , $border_ color) ;

11 :
f or ( $i = 1; $i <= $max_val ue ; $i++) {
($img, 5 ,

/1

$height - ( $i * ($height / $max_ value) ) , $i, $bar_col or);

( $img, $filename , 5) ;
($img) ;

': i magecreatetr ue c o l o r
, i magefil l e drect angle

imagerectangle

[],

PHP-zumbI

Maru .
draw_bar_graph ( ),
, , , ,

, . ,

GD.

.
h($ ' dth $height $data $max_va1ue, $filename) ( l$4~ t~ .o'oe. t).'tC'YI)Oe.
funct1.on draw_bar_grap
,
'
,
UJ:\..u~ KO'Yl)0POM ~\JQ\I\'t\
/ /
~
J:\pt.lCo&:.t.bL !5 -.'YI)6fJ .. ,
$img

=..

imagecreatetruecolor

ZUC"YI) p<tbt.

$width, $height) ;

'M~.It~IJ~"RRg,':
qepHOrO

C~.96.e... h-I(

/ / ~!

//
$bg_co1or =. ;

//

uj5e'l)o. I(O'l)0Pb1.e. :J.9ft1


u.t):!:\bt
() <J
: .

/ / q

imagecolorallocate

L:=:=':::::;:':;::'::'~~";";;'--""""'1w' ( $img, 192, 192, 192);

/ / -

.}:\ ~.ij.cVv\bt.

imagefilledrectang1

..

iU.C"Y!\OZoPcV'\bl

:\u.ct <:., .o"VjOu. e~o u.d.J-tU.

//

. ()

U~:\t.. ..-"!\

$img

'

$width, $height, $bg_<':o1or) ;


,

.~ -mupt. .LAl'Y\.~bt u.

$bacwidth = $width / count ($d,ata/ (* 2) ~


J\l..LA. ,3dIl.1-U-lbtx
for ( $ i = ; $ i < count($data); $~++~
II
J
.
'
($'~ * $ ar_w~' dth * 2) + $bar- width, $height,
imagef~lledrectangle
$~mg,

fbt. u,el'Y\O)/l.

~i'I.~.~~~~~R1.lth * 2), $height - $height / $max_va1ue) * $data[$i] [1]), $bar_co10r);


r - -.......- - - - - 1k

$img, 5, ($i * $bar_width * 2) + ($bar_width), $height - 5, $data[$i] [],

t-i.r.\u.d.J-tU. Gij6u, ~u.G110.G\Ji\bt

u. r11 .\.btx Cl'Y\P0I{.


/ / : np

$height -1, $border_co10r);


($ img, , , $width-l,
~

imagerectangle

/
qi;1
for ($i = 1; $i <= $max_value; $~++) {

~ \")f5l.O~..u. .
. 2U.C-mZ~

,.......-_......~--,.;'"'$ img, 5, , $height - ($i * ($height / $max_value)) , $i, $bar_co10r);


. imagestring

__

/ /

imagepng

.u...ij... c-m0I{u..

$img, $fi1ename, 5);


( $ img) ;

" ' - - (oxpctrt5LeM

._._~'IJfiII;;
..

.' u.d.t'!ClJ.. .3\ .u.u.

~d. 0Yf1 zu.Cl'Y\OZPd.Jv\br, u

cteJv\

11.

'

u.3 0 ?ct:.. .u..:.

u 3a.9aru{bt I.J..
g ~NG_?d-m u. ClT\e\jel-'.b))
4l\uSL 5 (?w.U ~?oel-'.b .

..

~. .m~ ~d..u.~ ~.~.~~.,~._._._.>.~""iI i-~....""""""~"


11

d:~G\. .ct cee.epe. l{o-mJv\ l'Y\

coxpd.KeK

cpa.u.11, .. 'dbt.1\ .9 c-mll . 3ctllU.CU..

682

11

'9: "".y ...

8bJ~fle'Jh,

NI_.,;jt~:~ t~~~py"o"", ..,-""" ro",,~

J'''_....

_d...

"'06".'

. , m
: .

,
-.

,
, . ,

. ,

_
-. ,
.

,
( -~, - m~
HTML-KOA, .

'F

'F

1i

ecntb

h()
raw_
r_grap

-.

OT~ -

, , -
-ro .

, .

. ocn~
, llb captcha.php

incl ude, include_once,

require require_once, :
, . ,

- .

. , 6,

'

, captcha . php

src

<img>, .

,
,

$_POST $_GET.

- ,


draw_bar_graph ()
, .

, i>

(480 240),

, ,

(5 -

), ,

. ,

echo

HTML-Tera <img>.

'<h4> </h4>';

3
4
4
2

--------~

~~.png
.

683

uu {(Hecoomeemcmeu.fm,

--
cr

ero

mymismatch. php
www.headfirstlabs.com/books/hfphp).

1> (

~Moe ~
(

navmenu . php).

- ~

(i ndex . php) .
~Moe 1> 13 . , !

ra.3 ,

fI ~ru! j?nj?wu

. .

.. 110 ru ~ ,

,  wum: .u ~
. ~.!
'L""'"

JDm, .''''lD'"

. I1U.JI

m !Q'1ODDI 18 1':
TarYllpOlJlCa

)J

IU1d1..,1

.r fl.1)'

6roo8

Il8..

Kapar.Ke

lJ

(\.!):l

~r-IIJO

OIJcp<I

il

JUI

tma nJ)'i

l(

..,..---I&"'_

- (. rr 5cr.a81l
..OII ..08 .. II.

. 9I1'lc:r o:r91'1'8
'AIHI-CIJA ..._ "

684

11

m. l'l1Q

l'l1ct..

:II

.,..o.'p1I'I 'lii 8"pt'

RO"tn

Iiecoo"YY}ei'] CI'l1U.U
)i l1 l:.i-l
g u.. I'I1Qu.u,bt.,

u."n!.~bL.

QQ u !

mer-, m rf1~m
fLlmrr rl1r().u~ .. 110 o/)'Ill1 ()~
r t10:JO.m . () u /, ~pe~
()~ ()f t10.~ co:J<)aemc~ & u

U:JOr.u fLlCmorraMMbI:f-

BCerO nwlt cn



. ,
~ .

,
, ,

~,

, . ,

,
.

n rr
n
r.

'.I.~WI""":'::~"'~-~
,

"k

:t....

 ~

685

v J06

,

. ,
. -
- ! user_id mismatch_user

. ,
tl,

J(Q user_iC/ )jI)J


I<J1}O'10M Yr1ctduupt. Yr1 iS"tl1o.tciJ_user.

~ mi~tch_user
:- u;;rj1~ ..; \t~fr;~~~' ~:~~,d

UJo~f"""'ue ~
Z.UC)Joz.po.bt ~
0.9'"'

pctCt) .u.51.
."t'Y\~i'l)i'l)gu.U
t)o J<d.Yr1 .UJv\
. t)~~U)J..

t1

I.

12020 ...

Ol1)(

676066...

n.

l915 ...

530560 ...

:.--~

74552 ...

dI3 ...

7c19dd ...

3d070c...

08447 ...

230dcb ...

J13

e511d7 ...

06240 ...

..t-I l"

41283 ...

l057 ...

6r

04fc20 ...
3676 ...

[1 1_1
r_E_2_. ~ .

___

686

11

~~dq~~

OaHHbIX !

c5bl~ite'J1l,

'F: -

Z41111X j:) 011f OCOj:)


PNG

GIF JPEG

'F: , 3
ro
rp ?

: , , : .

. ,

GIF PNG

, JPEG

, .

, GIF,

PNG . PNG -
, , GIF
. GIF JPEG
irnagegif () imagejpeg () .

tn.

2 . ,

50000 ,
100

.
, ,

50000

PNG ?

: imagepng ( )

.
( ) ( ).
,
, , ,

5,

( ).

, bl
bI, bl

( bl -). , bl
bl bl .

$_SESSION [ , user_id' ]

bl .
'<h4> </h4>';

draw_bar_graph(480, 240, $category_totals, 5,

' <img src='"

'myrnismatchgraph.png');

. ' myrnismatchgraph . png " alt= "


I><br 1>' ;

_ULD

"

_ULD.

687

mu

,
,

( -). ,
.

I<!:
ynp~

$_SESSION [ 'user_id' ]

echo

'<h4> </h4>

draw_bar_graph(480, 240, $category_totals, 5,

_ULAD.

--

,;

'mymismatchgraph.png');

-----

, lO
llx II II rr, lO
ll r.

~Moe ~ ,
,

. mymismatch. php - .
, , ,
.

88

11

~=~~_}: ~-;;""-:-.(

... u6oJJ!

JOCle .1.la : : l

:lfcrOrpa.'(~( . L1. If UL1


:9 ,

5Y.IYf

nn .

: ,

... ~Ioe ~.

, ,

:.1.,
.:.1. .

~:~;::.....""~&
~,..::';7'";:;._
OWI'\'I'
__
~~

f~I4('::~"

"~~"'1..;t--:

~"""

":"wo1'",*,,""I"~

.. c.~........

; : :....._ . . .I:II':=~_orJIIIJ....~

Yn ....
..g\i'\5t g i'\OM m
Ili'\u.t)...Yf\Ll .
.9 5ti'\, . t) !.

~I.III
1J",_I.. ~!1I!IItIII

.. l')ollpodOC\i'\b?

689

MySQL

rp


-
r .
r:

poccsopg

u MySOL

, : , -
, : J'

Iq>ID::.

r0n

1.

GD ,

7.

image ... textO.

9.

( ) ro.

2.
,

3. GD .
4.

11.

,
.

12.


,
.

...

5. , ,
-.

8.

10. ,
, ...
13. .

691

poccsopg
11

11

u MySOL.

PeuIeUe

11

1111

..

liI

11

11

&11

ll
II_

.

m__

__

11
llm
11

lI_.

ID
EI

692

11

11

12 f.l1f'}'h,f~J-{,JfU,, u,Jff..u,u,
u, ~,-,f.ffiu,

'*
.LleUrn~urn,

u~urn. urn

'' npUHOCUrn HO~OCrnu

rn-, u& w, rn

~cero Mupa pyu

rn~urn, HO~OCrnu caMU u"rn ...


'f;uen!

enu uu
u.

'" , -
. , , ,
,
-.
-

,
. .
-
.

693

um


, , ,
, . ,

. ,


. ,
, 4 .

"L.u nO)<"ULe.UU
uuu ruUJ.\U

uu, ::3 Utie tiaU()e..


!!:

()

aIfJJU:

Q1IPCC JICJ:I1IOoii 1IQ'1II:

oI;J!II npo101I?

1 cro Q'ICYIC1IOaDll'l

110, .J.. dbV1

. ?
()orC :

l-l jd,

l OII ~"UIII ~_1

.J11\o. u.....u,u..
. I"\Pu.e.Jld. 0:1.Jd. .

.1 D :I1IJ'a?

ll'\.:9,u,).

h.'h: u;

,... ..

. ....

.n8

dl-lU
IJ!OX' .111 e.u..u..

'IIoUl :n . '
..~OI;~. ~~tJ.l ;- v

KOCu..u..u..

.?'{ il ilen;

""""1_~'08-05-1;): .il:1

I1u..wu.p..u.,

'..

.'

. . ll
.
()
2000-07-12: ..1 H)i~ep
...
.,,
c~o)o

....

Dt 8. l'8ll h.'l\f"lll'
Ll I! IV"I bI5l)O)'f\ . :1106I00I_.,,,_

l'
, '199] 09 14'
"0
..;"
.. 'di,.'....wii........"""""' ...".., ....~
<fJ''''''''"''1'"'''1''

,)

::J.JK u.."'t\.1\,

, ,!.j rhn
"! " I <;i
m, v , - P/",,",,~'"
.1\ JDl<,1-{

. - -

i ;'

,,",.-.t!

.p~

'"

>.... -._1'
:

.>............1

"'"

37 }
O~~,~~ ,;:~/ Dlf.'l;
J!. . JlRelJ~_~~~gj~o.relll3 MCfan.1a, npmcpe l 1JJetd kUI Jr. "''''''''J"",l::!I.. n"'1I\';R?:
1969-01-21:
. .
.

. . _. . .

'

....

Dr\D"'t\Dd.5l1\.
1IJ'Ii'ICp1104 ro~ OI:I~a~"e !lllatI "..1L:
I
j
I
~..
.1l"I 81f- , !IJIIC:nn'.z
~F
1
----

"'I!jO"'l!j MoMeK"'IYj, . bt. I')OU..\JI.A

I-ld., .. d. 'YI'j(,

'-hrjo

.ct .;..

Ci'!1pdKu..u,e . u'Yl'j d.u..


1l 0 "'l!ju..i'!1u. nu..,.u.u.

w< I{.. .t...u.. Ilu..Uf:V"\U.

694

12 .

:1 . .9"'t\., Yt\, u. u.nu,u.. . .1\


d\1\1\. g u..u..x Il. ctX ,

m ~I.Au..1\ g~.11\.ll'\ "'t\o.o, 'ni . KoKu,e


KOH.up ..u."'t\ <i1...,

6-


wn
l<
, ,

PacnpocmpaHeue

, ,
-

cogI

, r
,
.

cpegu

n.eU
qxpeurU
nU5A
.
5uaus.

. \10

. GogceM
\1o.u...ct e"Yf\,

('\1 POC"Yf\ ct"

.r4!-UJ.

cctu."Yf\ct u

l\gct"Yf\u.,
. GdJ/Id. uc. eM~
fct~"Yl\...

695

RSS,

RSS

, L-

, ,

, . ,

oecnusaem

, ?

RSS -

smOCtnb

n.

RSS -

- -

uqpuu

DVD-

l\SS -

. .
,

.
, DVD-
?

RSS , , ,
, .
RSS-.i1 ,

, .

, .
, RSS-.

npOzp4JN.\d

'\.U5l .ogoc1Y\eu

I f.,1 8JI tD

g~

......

;=
,""-

"'--"".:tt:

. """-n. no:

RSS

....'1

, ,

, . - RSS-.

, - RSS-

, .
RSS- .

RSS-. , ,
.

696

12

URL,

6-

RSS -

;,

XML (eXtensibIe Markup Language;,

w (

I\SS -

RSS HTML ,

931 ,ernu

UCn,i1 gSl

RSS

XML,

OnUca.u.g cogm
. XML
. ,

npeg

,
. , HTML RSS,
,

gSl pacnpocmpaeus.
tlctu..!

He;r{

RSS, J<btct>.
XML. , XML, ..,."ezct. COOfY)e...,.,,RSS HTML, XHTML.
"""JoO..
, . RSS)- ,

! .

..,." bLctJoO
<p,rfior'lep

lif1""coom'un,m'o'amb
, ' kaKOt.-u6' 'ut, 'Ul

<> </>

; }8"'u ~o "u..
ti.I')Qu..! 1> t"1yc-m -m.. .. dbt."y!)b Il~.
u. t"15L\\cI.. tt4 "!). Il JQKPbt.(XJoOt.e.U.
.u. . ( ) ).

lifl1y~oO u; u; " ", npo6'eAOM


'aun HUKaKOrO
U
'u, "Ul "u&m,
n
() ,"'d ~o'oO ,6'.

lif' ,UlU am"u6'ymo' ' ,m, , ''"

J
.c--l1DQU. .

<br 1>

llctu.! 3.u.

ct"""ptA.dY"Yf!ct .90.

3ct}.

ctgbtl)..

'u.

:::1~i~Jl

dbt..,."b

ggubte

11

-.::1mg src aHeIt.gif />


<irng src="alien.gif" 1>

'\

1> "!)U u. "!) ? ,

XL -

I{"!) ,>.z,'jI

93bl emu.

UI\J'f\.
KQK .u.. "!)(..\

UCnJ\b3 gs

g ;N\L_9' Jfu.

oncaus gab1X.
.sorg

U .9.uHApl-ilit

11 QW1r.

Ko.gbt.~KU,

Q"!)U'jl .ol1j"!)u.bt.

"!) .u.L"'!. Qbt.u..

5Uga.

697

RSS

bJ~~'}1t,

Z1tl1blX ffi ol1l' 0coffi

~: 0 RSS
?

:
,

RSS .

,
.

RSS ,

0 ,
.

~: -

RSS?

Really
Simple Syndication,

.

RSS ( ),
caMOro ( 2.0)
Really Simple Syndication, ,

~: 3 RSS?
: RSS - . , HTML

, RSS ,
.

HTML, RSS-

, ,
.

~:
RSS?

RSS.

.
.

698

12

6-

RSS-

. , , ,
.

<?XIl

version=11.0" encoding=lutf-8"?>

m .

RSS

m,

tp://www.aliensabductedme.com/index.php?abducti
~r.nr.~~,

21

l1~~-.v.L~

00:00:0

tp://www.aliensabductedme.com/index.php?abduction_id=
BO(=K~)eceHe,

11

00:00:0

699

RSS-

RSS-
. , , ,

.7)Q c1r1PO!(Q . 1\ 1\... .7) X~L!(OYIIOD<1St !(:\Il


I

- .J

1r1 3'w) 01r1 YIIe!(cYII

<?xrnl version="l.O" encoding="utf-8"?>

KQ!(

~[-.!(.'Yf\.

.7)1r11\. (titee)
Yll.IlYII cey

bI.d. d d.d ~bL.


~Kd.3btQe1Y\ d Cd.U"lY\.

. .1\.
.

:9 llpe1r1tA.tlQ,

d.Ccou,u.u.p~ebW. 3"1Y\u.

RS

<<!~____________--~d.d~
;I=~ffi ,

tp://www.aliensabductedme.com/index.php?abduction_id=
'Vhh()''',",

21

111>1-.L-JLJIJ.L

00: 00: 00

. .>I.YII

1\ 0.u.. t . gll.

. YIIQ1\.. u. b!. . xOYllu.Ylle


Ql1.u.1r1 ce .oOC1Y\u.
110 d.1\.u...

<1~bLu O"IY\btd.)u.U

./
<l'"---

L...-_ _ _ _ _

700

12

X~ \..-"IY\z. u.ee"lY\

O"lY\"lY\"lY\~)u.U eJ.~
JCl.btQ)u.U "IY\ez. mOYlJ "IY\ez.
3d.Kpbtd.e"lY\ RSS-.90~"IY\-

. , S5-, uu, XM~

Ikero U meraMU. Ike

u .

,u, Ike, , - u S5-,


u I.--u, aK~

, - r. ,

XL-KOA ,

ero

.
, L- ,
.

RSS,

, ,

, .

,
.
L- , ,

, ,
L-

, ;\-l
RSS(L)-
.

701

6
m.etJg
,

RSS-, MySQL.
RSS-, .

, , ,

RSS-, , ,

.
,

RSS-, , I
, - .

050CIneU

yug9
, OS

gaHHble.
gocmyne

~.1

r ntl
tl

OTAenltHIt.e
,

cocaaneHHltle

XL,

n.

6-

RSS-
RSS-, ,
. , ,
, .

<~>

RSS.

, .


, .

RSS-

.
,
.

URL,

RSS-.

.

<channel></channel> <itern></itern>.
,

<channel></channel> <itern><1 itern>.


,
. ,

- ( ).

703

K~b'..u

RSS-Ql{\jJI\:m

l'r\\1\
1')0 1dU.e.U.

~'1 ~"-""-E-------'

RSS-
RSS-, ,

\ O.9.o~o ~ . , ,

1{~~d, KO"YI\Pbt.U. , .

"". gu.WI

~O~t"1f)Y ,g!'YI\u
'.9 'Yl\.u.

. <rss > 5I..'Yl\. l{op.ebt. 'YI\ezoM .9~51 R.SS-.9 0...'YI\d.


13 "'mdbbL 1'I\ .90./1... 1t"10d~d'Yl\t:>51 Me~y u.

-med';;~~~- ~ \ 'Yl\'Yl\"Yl\~Ll .3dbt}l.A 1I\. </rss>.


<r$$> ~
RSS.
, .


, .

RSS-
:
.

,
.

--1--1---

URL,

---

RSS-.

.

~"f---

<channel></channel>

<item></ item>.

<channel></channel> <item></item>.
,

. ,

<lU11t.>

- ( ).
~
___ eou. <titRe) , (~it)k >. <~u.bDC\i:e) u. <descriftiot

Jt:..

u.t) ram . M~y "'!\e.C\u. (ii:"'!\) u.


llu.lU. ."'!\u..

704

12

lii:"'!\ >

RSS

JVilJil

, L- , ,

Q 4 - . L-.
m ,
L-. , RSS-
,

, , (),
.

\.,
ccbuJl<C\, ..9C\i1C\

3c.t.I(,bknQ,n,u\

u Jbt -

l1,'dU I< C\u,uu


u Ol)ucC\.ue

i10 .-bL

1(c\.ctJlC\. MeCi1e

..9\..

.i1U 5l.}QVI\5{

.i1\\

11 0"Yrl - du..

5I.5l.'I'C1YI1~5I. e~o
t) O"I'I)Ol(C\Mu.

aliens_abduction. L- RSS-Tea <i tem>


, RSS .

aliens_abduction

14

200807-05


...

nrte

...

705

,
aliens_abduction. L-

RSS-Tera <itern>
RSS .

aliens_abduction

14

2008-07-05


" ...

. ...--JC

~ce .9C\.bt.e 1')0 l<r-. Kooc-u.

rtd.X.9-mS{ 'mi{bt(1)1~u.

<ite'llj >

.(.ti~lt\.>. ............. ~.03.~!<.r~~~19t;:"\.~l.i"j;t:.Yh?:'Ojeza.u.. ............... ? ......

.:. 01Y\Kpl:?C\)Ow,u.
u. 3d.rbtg\)6tJ. -:"ew.u.
<1:ii;e> (/tii)e.> . (~II')/k> 11'1 .J.
<Jillk >, <pu.bDC\te.)( pu.oiIc1 ~~ >

....<:t~ti..>.I.l1w.1.~lt\~~....~~.l1...~.l)."... (J.titR~>...... 34)~.Yfld.u. kct:9 0 u.

:/
k

11.

11.

ph

Koxpe'Yl\.ou .o~OC1Y\u.

... .~d.\t.1k). ht:t j'WW.'"u;t-t.l~n~~hdI,l.G:t~d:'l1l~.~9:m/.ll1d~1 p...~b.d!J..Y.tl9.t)_. .........

.i~~1~if:n;i~';;;;;':05~;;;m :2080;;;, ~bD;l;; ......... :::..... r~'!;~~~~

... "~~~~'~r;' ti'~~ ~'o~"~~~~~'~'M~~' g'~~' a~~~~'~"""""""""""""" r!e~~~ 5:c~~~~~


.~303i:{Ii~Q6f{)(j' c'YriQI.f,(ijO::: (/ {'sti ptiOI'\) .................... ~r..u. YKa..
.
.90t)YCKc1e-5t

J-tc\I')U1JJ.

(/lteYf\)

ffi.')'h,

..7'tY\OGO

~\

f< <j~ubd'dte >

Z4f1JblX ~01JiOCO~
V!)f>.
1l. XML en , . XML
.

UJlU

, .

. RSS <pubDate>,

D -

1.

; . 1 '; Mory ?
.

XML , .

RSS

; . ,
RSS 2.0 1

, .

~.

, <ig>,

XML?

<lchannel>. :

- ? on

; ,
XML
(\r),
:

<irnage>

(\),

(\t) (' ').


XML
,

XML,

, L-,
, , RSS-.
, ,

1

706

12

1 <channel>

<l>htt://www.lisbdutdrn.m/fg . jpg</url>

<title>My dog Fang</title>


<link>http://www.aliensabductedrne.com</link>
</irnage>

RSS 2.0 1 1.
<img> .

L-

,
L- XML-KQ,

0 RSS- .

RSS:
:



Arst: , , ,
,
. ?

Head First: .
HTML?

, ,

RSS: ,
XML,
.
HTML

... ,

, :

RSS: , ,


~~.

, .
, .

Head Arst:

4 ~

, ?

RSS:

, , ,

. ,


, ,
-
,
.

ead

. ,
.

Arst: .

RSS: , .
m

Arst:
,
RSS-. ?

RSS: . ,
,
RSS-.
,

( ) .

RSS- ,
L-.
ead Arst:
RSS- -

HTML,

, , ,

RSS: .
HTML,

. .

, .

: .

, ,
,

ead First:
?

RSS:

, ,
.
,

,
, ,
.

, -, ,

,

.

ccma -.

Head First: ,

-
,

-.

RSS: ,

Head Arst: .

,
,

RSS:

.
.:t,.'I ,

II .

- . :

, .
,
.
.

ead Arst: .
. ,
.

RSS: .

707

Q RSS-QQ

il 3il

RSS -

RSS"AOKVMeHTiI

, , ,

RSS- ,

.
RSS-
. ,


XML-.

Onf'e'aeAatut muna ()1 XMk


~ 31.-

<?php header ( 'Content-ype: textlxml'); ?>

RSS-)'."\CI. ~
p\bt

.90.!.

)'KC\Jd."YY\b -

Co,()aut ()upa<mu&bI XML" ,&di , , ()1

&tmG XML--()atm.

"\!') #\ L.

<?php echo '<?xml version="l.O" encoding="utf-8"?>'; ?>

Co,()aut Gu<( S5-Ko()a, ) KOmOf'orO Ht ),

c.oJCf'aatHbIt &6,,,- 3 mtr <rsS) u Uf'uu "<rss version="2.0">


<channel>
<title> .. .
<link> .. .
<description> ...
<language> ...

1:::.---

rr!-m . 3d.U.U.-m o-m d..bt.x:


d....btx g ~d.. . ..d. IJ..
IJ. 'fI\o'fl\ . d.. ~.'fI\d..

"bInoAHatut ,anf'oc.a 6a,t )" al.ims_ a"dudion () ..,&tatu


Uf'uuu )(uatuu u<uu nf'UUleAbau.
abduction_id
.

f~rst_name

las t _ name

, ....-- lpe~e

alien_description

..u.d.'fI\
RSS-
."!)u., 4,.

.3u.

l1f')(()atut & UUAt tpt) ()aHbIt f't)1Abmama ,anf'oc.a


u c.o,()aut S5-Ko()a () ()i1 HO&OGmU.
<item>
<title>...
~
<link>. . .
<pubDate>. . .
<description> ...
</item>

:4.._

JflIO"YY\K0.9 .9 IJ.-.9d.bt.

UJbt. UJ ~bt.

I{d..90U .ooc-..

J<.l.t\pocIJ."Y!)b

d..k.btx M~SQ.L
u..cpop..a\J,IJ.)
\10l.l.J.

KOC..u. UL.t

11 L.tu,a.u...

Co,()aut c.mu<or S5-Ko()a, Hw6)(oC)UMO(O () U


(), & UGAt,f'&u)( mtro& </channd.) u </rsS).
</channel>
</rss>

708

12

ad.Je

6-u

u MyOOL~
8 RSS-

J\LI

(newsfeed.php) ~:C~b
8 ,

Rs s- .

<?php header ( 'Content-ype: text/xml'); ?>


echo '<?xml version="l.O" encoding="utf-B"?>'; ?>
<rss version=" 2 . " >

<titl> m .

RSS</title>

.................. http://aliensabductedme.com/ .................. .


<dsriti> m,
.</dsriti>

......................... ru-ru ......................... .


<?php
require_once('connectvars.php');
/ /
$dbc = mYsql i_connect (DB_HOST, DB_USER, DB_PASSWORD,

DB_NAE);

/ / m ySQL
$query = "SELECT abduction_id, first-flame, last_name, " .
"DATE_FORAT{when_it_happened, '%, %d % % %') AS when_it_happene<t-rfc, "
"alien_description, what_they_did "
"FROM aliens_abduction .
"ORDER when_i t_happened ............... " ;
$data = mysqli_query ($dbc, $query);
/ / np np
while ($row = mYsqli_fetch_array{$data {
/ / RSS-
echo'

RSS-

,;

echo' <title>' . $row['first_name'] . ' ' . $row['last_name'] . ' - ' .


substr($row[ 'alien_description'], , 32) . ' . </title>';
echo' <link>http://www.aliensabductedme.com/index.php?abduction_id='
$row[ ,

'] . '</link>';

echo ' ...................... .' . $row[ 'when_it_happened_rfc'] . ' , . date

('')

,;

echo' <description>' . $row[ 'what_they_did'] . '</description>';


echo '</item>';
}

?>
</channel>

709

& MySQL & !

u M~~

J\LI

8 RSS-
(newsfeed.php) ~

R8ss ,

<?php header ( 'Content-ype: text/xm1'); ?> --=<::::---~~~~Pv:~~~o~-:?"~10~:rsion="1.0" encoding="utf-8"?>'; ?>


<channel>

- .

-, J(d.!<

g \Jd.

bL !I10Jg<V1~

btd. !Jd.lJ.5{
~)J)O"Yl1 Jd..f5' ll. 1'l'l1'l'l!11

~~u.. /(.-d. Kd.1{ XfVlL.

<tit1> . RSS</t~t1e>

<. ri=::~::~::=:=:~:j:iJ _ ~pa

.</dsriti>

<language>

u-ru ...

(::&~:::::~jl

<?php
require_once(connectvars.php);
/ /
$dbc = mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD,

DB_NAE)

/ / MySQL
$query = "SELECT abduction_id, first_name, 1ast_name, " .
"DATE_FORAT(when_it_happened, '%, %d % % %') when_it_happened_rfc, "
"a1ien_description, what_they_did "
"FROM a1iens_abduction " .

/ /
whi 1 ($row = mysqli_fetch_array ($data)) {
/ / RSS-

RSS-

echo'
echo' <tl
$row['first_name'] . . $row['last_name'] . - ' .
substr($row['alien_description'], , 32). ... </tit1e>;
echo' <link>http://www.a1iensabductedme.com/index.php?abduction_id='
] . <!link>' ;

$row['
echo'
echo
echo

:.1

."I!!".~ .

$row[ 'what_they_did'] . '</description>';

1;

</pubDate>
. JJ4 . . I1.

?>
</channe1>

(.i:'ji,B>

.1
</hannl>

710

72

'.

~
rBB>

..............

..............

-",

n n .
n

RSS))

n n n )).


~ .

news f eed . php

RSS

www.headfirstlabs.com/books/hfphp).

- .

,
RSS-, ,

, .
,
~ .

,""

*,'"

,,7"'?~,.~

,~; ~

~,

.%"'-:'~ ~

.,

'''

.;.:

.,..<{

. RS$ .
I1 . bUl opan .

...

,,?'

ro:-..

10 arycra 13:00

6
'~

.......

..

11 IOl1 13:00
,

ron rpa.. .: ..

atep. I1 plOlii ... 5 l1 13:00


.IIO ~ ...

c:rant

.. ...

. ...

...

,,",potIb :

... ~~:;;:~

~ra . an n ... 21 IIII 13:00


an ... ...
. 3en. weCl ynan_...

16 13:00

an rpa ... ...

~fi()u
u,

I1 rpoii ...

...

12 13:00

...

ernuu

eiic:
ttOSn' .

? ?21

13:00

cr.
, news f eed . php - PHP-.
,
, ,
RSS- L-.

,
-.

URL.

- ,
. :
RSS-,

newsfeed. php.

711

nQ RSS-

RSS-n

RSS-, .

"

R ~
1~

RSS- , ,
. e~ ,

cmagaptnHbIi1
9. UCn.J\b06a.'Ue

CI1la5

,omoporo n.ern

RSS-

n5m9.

(index. php).

<>

< href=IIt11_">
<img st~Oj~:&~:;.j'rtil-lign: top; border :n"
src="IIII " lt="
,

RSS-" I>u.l1 !.Q .Q RSS-QIi.d.

~s-.

< I >
< Ip>

.9 ..u"'l\'j I(QI( UJ0d"PQ)/(,el't.Ue

Q, "'I!'IQK u 1r)eKc'Y!1
OI'\UCQ.u5!..


~. . ( ,.,. II!IIIJIO>I'I ><IJIi!I]? . """""' ... OJ!IIIIl uy ....?
(.""1" ')')o~t!

3<W1e'Y!1.Q5!.

.2008-08-10: i"hl1 !>

.Ul1 l:1..l(d

ouo :

.Q .M.oa

. n ", ... _
2008-07-11: .: ~~I"'()
.

i'i 1111:

1'1 u..u
r\ocMu.4l(

45

I'

.2008-07-05:
-- 1111:

11 uu,l:

1'1 0UQU .

11 .9 0'!1d. e""r}
110'!1U'!1..

oxiti :
.

12

ll' r8 ..

-r
. ll ...... u :

.CnW",IY11< _...

II:
. M",~elle eyt<?,," IOII1>:;m &11I& pn.t a

~2Ii8-05~15: ClL11I Il
1 .

CI')OCo~ .90C""r}.'jl1d
1{ RSS-Q.Q.

.. ll ..."R u:

2008-06-21: .,ii

'll -:

dbl.c""r} ebl.u.

iill ...... :

c""r} pa..ue

712

: Je Je Cl weJl:

il::
, ~

:tr?

--
rII wll
ll II. ll

R55

IIJ

wll ll II.

index. php

~ ~

RSS-.

RSS rssicon. png

www.headfirstlabs.com/books/hfphp.

index.php rssicon.png -

. ,
RSS-.

um Ike ~mu

L1.\u "UL1.\u,

eL1.\e &UU ra,

& &r ,

& ~ L1.\u

&u u

[u-u umu.

uHmerecHbI.

md R.SS

.obLe d.u..

t)u.l-WStx
.u.UJ.A.u.

t1u.u,au.

dbu1u. i1\dt-d
t'\rtu.u.d. u. u.
. nu.x u.i1\

.ll i1\.;u-
t'\oceu1p.i1\b CdUYI\

. yro8 ..

IOt l1: OI"pD ...

. IIC .... .. .
en 8 ... etn.lC ~.. .
. en8, wn...,.
. O<J>O ..
88An. ...

21

2008 .

15 2008 .

12

IlIO

2000 (.

14 1991 .

01;(10
01:00
01.00
01:00

u.u.

nuu,bt.
t)u.du. .."

mr, ma U m

, Komot')'1O &uu
caume You1u\?e Vfdeo~

, 1l0.l\.bLu. u.l\<11\ .oocl\ea


C<1l\<1 ..u.u Ilu.u,bt.
110Ud.u. )'), d.l\, m .

u. m Zd Cd{l'Yl\e 'iouTube

Video .

713

R OY~Ha

i80lliJ "1'"
RSS- uu
, , ,
. ?

u ~ ,
. .

, uu
, .

CI

tleJ"!I8) !

(
. 11)\11),

'iYrjo, gJ.

u. t]OC11)C\gu.~

11)041<.:;1

g ~pou,ecce

110u.ci(og ..\.

714

12

6-

,*

r ' no1tro~i1,1h.G 1>]


~

1focompumt &u()w 9 (}. www_youtu"t.com/us/aUensa"dudedmt.

1focompumt HtcOAbKO &u)t0)8nuQ nJCuttluu Utcuu npUUleAbaU, KomOpblt


Ul _ &bI )atmt, 6, n,atltt ~muJC &u()w, -

~o ~M~

f'(1, m lie nreraclio, u


r nrocMamru(l,amb (l,unuu
lienocri)cm(l,e/ilio lia l<Duu nruUJ
nULJ.Iu e/i>' (l,Mecmo moro, m ru(l,m
Youl'uj,e:? ~ m LJ.Im(l,o(l,
n, nru KomOrOM nrocmo mr(l, cmrauy
u nrmru(l, , m lia(i()e/io e/i.
3 m m...

715

U3&ne'leHUe coi)epiKDHUR- 3ffl0 C08CeM He mo, ttmo pacnpocmpaHeHUe cooepMaHUR

IJBJJe'leHHe coAepJHaHHH !!! APVrHx eeG-pecypcoe


OcHOBHaR 11.u,e.s~

RSS 3aKJIIO'IaeTC.H B TOM, 'ITO Bbi pacnpoCTpaH.HeTe co.u,ep)KaHI1e caoero caiha

cpe.u,11

llOJlb30BaTeJieM, TaK 'ITO y HI1X He B03HI1KaeT He06XO.U,I1MOCTI1 llOCTO.SIHHO llOCeiiiaTb Barn CaMT
B paclJeTe Ha TO, 'iTO TaM no.HBI1JIOCh Hosoe co.u,ep)KaHI1e. KaK y6e.u,I1JIC.H Oy3H, 3TO 3Ha'ii1TeJihHO 6oJiee
y.u,o6HbiM cnoco6 CJie.U.11Tb 3a co.u,ep)KaHI1eM ero caiiTa. Hoy Me.u,aJII1 <~pacnpoCTpaHemte 11H<f>opMaU1111~
eCTb 11 .u,pyraR CTOpOHa, 11 OHa BKJIIO'iaeT H3BJielJeHHe CO,ll.ep3CaHHJI .U.pyroro

cam 11 pa3MeiiieHI1e

ero Ha caoeM. Bhi CTaHOBI1Tech noTpe6meJieM, a TO apeM.s~ KaK 3TOT .u.pyroiinpoaaii.u,epoM. B cJiyqae noKaJa Bl1.u,eo3anHceii caiiTa YouTube Ha caiiTe
Oy3Ha You Tube CTaHOBHTC.H npoaaii.u,epoM.

CaiiT YouTube _
3TO npoaaiAep
0

BHA803GRHC8H.
npH110lK8HH8 <<KOCMH118CKH8
npHW811b"W ROXHII.\GIIH M&H 3TO nOYp86HT811b BHA803GRHC8M.

KocMnlfecKue npnmeJibl{bi noxumanu Mens


IlpHBCTC1B}'CM

~ Clanomasutcb.s.t Elbl C BHC3CMHbiMHI.\HIIHIIK1aJ.tKID4H? Bac DO>HUaiDI? He ~JlHBW ~

~V>F,,......, ....._

-CHH)'IO ........,...., -~HI2

Coo6uorre oo :noM!

flOCJJe,llHJie coo6JQeHIIR 0 DOJ.HieHHRI ICOCMJIW(XWMJI DplllleJD.QaM:

2008-08-10: Meiiulo.~L:~ Peccuep


lloDUQell Ha:

ORHcaHHe KocMM-.cecJ<HI npNwe.m.Qe&:

3'01C8
..... . 0HH GWJH & Kopa6ne pa:~MepoM c ll)'H)' ..
2008-07-ll: l\1HKKH MaiiKoHc

hOsawett a8: , OnCi:Hiie Koctni'lecKNI npame.~aiiea:


...'.. ~..~l'pOMHL.I~. ~._I_"OJIOBaMH .

45 ~Ji"Yf

200~~7~5:
llOIJOQeH Ha:
. 2 '18ca .. .. .. .....

II11m Barnep

OnacaHHr XOCMHWCkJU npmem.uea:


B He6c: IICliWXJtYntpadi clleT...

2008::(16~21: lieJUIIalfeou

("iiouuleit Ha: ~ ODilcaHwe troCMH"wcKHx npawem.uea:


..~.!f.~ Heli:~ . ....i .~~~~..He)'K1110_~-~ - IJOAOH~.~- ~C)ro-~ -~- p~~
2008~5-:15:

: fiOXJOQeH

I .11cm

u :

C u.-1H .ll;c\onc

On~~:Ainte KOC:MH'IJ:l
..._JeneHLJe, cwe,,.10

liiY0_9eCb _90JI.)fC.eH. dbt1T\b


5l.f11bu< _9JI5l u..9eo!

111

,llu.jdUH. z.Jld.H.Ou C1T\pctH.U.u,bt npu.Jio.)f(,eKJJ-St KocMu.~cKu.e


npu.u.te.Jlbu,bt noxu.UJ,dJIU. MeH.5l .9oJJ.)fC.eH. dbt1T\b cJ1eZKd
l.tJMeH.eH. _91151. 1l'\OZ0, '-hT\Odbt llOMeC~U.1T\b H.d H.ee
pejj.llb1T\d1T\bt \lOU.CKd u._9eOjdi)U.CeU..
O'ieHh aa)KHO noHHMaTh, 'iTO Oy3H xo'ieT He npocTo BCTaBI1Tb
KaKyiO-TO BH.u,eOJanHcb c You Tube JfJIH mnepccbiJIKY Ha Hee. 3To c.u,eJiaTh
.u,oCTaTO'iHO npocTo KOnHpoaaHHeM HTML-Ko.u,a c YouTube. Oy3H xo'IeT

~_9e0jd\lU.CU.,IlOJljYe~

npouaoo.u.uT& noncK BH.n;e03an11ceii Ha YouTube If noKaJbiBaTh Ha csoeii

pejj.llb"!T\d1Tle nou.cKd

CTpaHHUe pe3yJibTaTbl 3TOfO ll011CKa. flo3TOMY npHJIO)KeHHIO <~KOCMJf'IeCKJfe

noxu.UJ,el-lliil KocMu.'lecKu.MU.
npu.u.te.lbi.J,ci.MU M cail1!'le
.u,aHHhtX c caiiTa You Tube 11 BhiBO.U.11Tb pe3yJihTaTbi 3THX Janpocoa
~ou.Tu.be.nere.9a~c51.
a .U.11HaMH'IeCKOM pe)KHMe. 3To no3BOJIHT Oy3HY If ero JierHoHy HCKaTeJieii
M CdU1T\ Oy.~M u. KJJlO'ld~C5t
<l>3Hra noMHHJTHO cJie.U.HTh Ja npHCbiJiaeMhiMH Ha YouTube Blf,ll.eoJanHC.RMH
co.9ep.)f(,dl-llie zlldH.oil
npHWeJibUbl llOXI1lllaJII1 MeH.H He06XO.U,IfMO .U,eJiaTb 3anpOCbl Ha llOJIJ1jeHJfe

0 llOX11IIIeHI1.SIX KOCMH'IeCK11MI1 npHllleJibQaMJf.

716

lnQBQ

12

C1T\fdl-lliu,bt.

pacnpocmpaHeHue uHt#JopMDf.4UU u se6-cepsucw

PacnpoctpaHeHHe BHAeoJanHceA caAta YouTube


l{JUI Taro qTo6bl IIOJI)"'aTb BH,ZJ;e03amiCH C calha You Tube, Mbl L(QJI)I(Hbl TOqHo

PacnpocmpaHeHUe

3HaTb, KaK You Tube rrpeAOCTaBJIReT CBOH BHAe03aiiHCH AJIR pacrrpoCTpaHeHHR.


3To ocymecTBJIReTcR qepe3 rrpoueAypy o6MeHa ~3arrpoc/oTBen, B KOTopoti: Bbi AeJiaeTe

sugeooanucen
c cepsepa YouTube

3anpoc Ha orrpeAeJieHHbie BH,ZJ;e03arrHCH H 3aTeM rroJiyqaeTe HH<J>opMaumo o6 3THX


BH,ZJ;eo3aiiHCRX B BHAe OTBeTa cepBepa You Tube. Barne rrpHJIO)KeHHe oTBeTCTBeHHO KaK
3a COCTaBJieHHe 3arrpoca B <J>opMaTe, IIOHRTHOM cepBepy You Tube, TaK H 3a o6pa60TKy
pe3yJibTaTa, KOTOpaR BKJIJOqaeT Bbi60pKy B OTBeTe L(aHHbiX L(JIR IIOJiyqeHHR

SK.AlOl.laetn

coctnasAeHUe

orrpeL(eJieHHbiX He06XOL\HMbiX BaM BHL(eO (3afOJIOBOK, RpJibiK BHL(eO, nmepCCbiJIKa H T. L\.).


l{aJiee CJieL(yiOT 3Taiibl, KOTOpbie He06XOL\HMO IIpOHTH rrpH H3BJieqeHHH BHL(e03aiiHCeti:
c cepBepa You Tube H BbiBOAe HX Ha Be6-cTpaHHUy.

~ 3ct.ne>oc Yac"VI\o

Coc.ma&Aatut. ,anpoc.a Ha &uaeo,anu'u


You1Ul7e..
Omnpa&Aatut. ,anpoc.a Ha You1Ul7e..

cpbpMe UR\...

aanpocos
u ospasotnKy
omsemos.

Cepep 'louTuhe
u.cno.nbJye"Yrl XML
0 "Yrl?e"'IT\ax H.d. Janpocbr.
?u..9eoJanu.ceu.

11oArtatut. om You1'Ul7t. om&t.ma, ~at.pM<a~Mt.fU uHtopMauuto o &uaeo,anu,fQC.


06'palomKa ()aHHbiJC om&t.ma u topumupo&aHut. uJC &&uat.
HfM~Koaa.

Be6-cepaep
YouTube

PH? -cu,eH.O.pu.u
0anpawu.ae"'IT\ y cepepa ~
'touTube u..9eo..9aH.J-(bte::::.;- - - . . .

~ .9ono11K.eH.Ue K ,3ctnpocd.M K cepepy


ddJ .9aKHbtx: MySO.L H.d. rtOJlyYet-tu.e
w-t.cpop.M4UJ.AU. o noxu.~e!-U.J..5tx KOc.Mu.YecKu.MU.
npu.weflb~u. cu,eH.O.pu.u PH? 'VY\enepb 'VY\dKJi<-e
o~pctact'VY\btcte"'T\ O'VY\e'VY\br., co.9epJK,ct~u.e
u..9eo0anu.cu., nollyYeH.J-lbt.e c cepepa 'touTube.
Bbl3oecb

717

sseileHue s 3anpoc REST

COJAaHHe BHAeoJanpoca K cep&epy YouTube

lfe 8&J~ie'th.

Z1f'\lb1X ~0'\lfOCO~

TionyqenHe BH,lleo3anHceH: c cepBepa You Tube H .uo6aBJieHHe HX K BarneH:


Be6-CTpaHHI..{e HaqJ-IuaeTcR c 3anpoca. CepBep You Tube O:IKH,llaeT, 'ITO 3anpoc ...Ha BH,lleo3anHcH 6y.ueT c.uenaH KaK 3anpoc REST, RBJIRIOIIIHHCR cneUHaJibHbiM
URL, KOTOpbiH YKa3biBaeT Ha onpe.ueneHHbiH pecypc, HanpHMep, co.uep:IKaiiiHH
BH,lleo.uaHHbie. Bbi cocTaBJIReTe URL c YKa3aHHeM HY:IKHOH BaM BH,lleo3anHcH,
H cepBep You Tube B03BpamaeT BaM HHcpopMaUHIO o6 3Toii BH,lleo3anHcH
B BH,lle XML-.uoKyMeHTa.

'9;

Or KaKI1x enos npoi1CXOA11T


a66pea11arypa REST?

0;

REpresentational State Transfer


(nepeAa4a COCTORHI1R npeACTaBneH11R).
3ro, onpeAeneHHO, OAHa 113 rex
a66pea11aryp, Koropble 3By4ar
ManonOHRTHO 11 04eHb TeXHI14eCKI1.
)leTaJIH URL .llJIR 3anpoca K cepBepy You Tube onpe.ueJIRIOTCR KOHKpeTHbiMH
Ba~~<HaR AflR paccMarp11BaeMoro cny4aR
BH,ll03allHCRMH, K KOTOpbiM Bbl XOTHTe nOJIY"<J:HTb ,llOCTyn. HanpHMep,
oco6eHHOCTb apxl1reKrypbl REST
Bbl MO:IKeTe 3anpOCHTb JII06HMbie BH,ll03allHCH onpe,lleJieHHOfO llOJib30BaTeJIR.
3aKnl04aercR BroM, 4TO ae6-pecypc
B cnyqae Oy3Ha HaHJIY'IIIIHM cnoco6oM 6biJIO 6hi, cKopee Bcero, ocymecTBHTb
AOcryneH 4epe3 yHHKanbHbiM URL.
nOHCK no KJIIO'IeBbiM CJIOBaM cpe,llH BCeX BH,lle03anHCeH, ,llOCTynHbiX Ha cepBepe 3ro 03Ha4aer, 4TO Bbl MOII<ere nony411Tb
YouTube. URL, Heo6xo.UHMhie .UJIR Bcex 3THX THnOB 3anpocoB REST,
Aocryn KAaHHbiM,noAAepii<11BaiOIJ111M
6y.uyT HeMHOro OTJIH'IaThCR .upyr OT .upyra, HO 6a30BbiH URL Bcer.ua 6y.ueT
3ry apxHreKrypy, npocro 4epe3 3ror
Ha'IHHaTbCR TaK:
~ 7molft &~Jobtu VR\..
URL. B cny4ae nony4eHI1R BI1Aeo3an11ce~
uciw.llbJ)Ie"Yr\C5l. S;1st coC"Yr\ctJlet-lU5l c cepaepa YouTube 3TO 03Ha4aer, 4TO
http: II gdata. you tube. com/ feeds/ api I
cex jdnpoco KIST K cepepy
Bbl MOII<ere Aenarb ace aaw11 3anpocbl
'touTube.
4epe3 URL, KoropbiM coAep11<11T

3anpoc BH,ZJ;eoaanHce:H no HMeHH DOJib30B