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

.

scanned and converted to PDF including Bookmarks


by HupBaH9I

2004

004.92
32.973.26-018.2
96

96

: / . . .:
, 2004. 237 .
ISBN 985-475-050-7.

Web-. ,
,
, , ,
, -.
, .
,
.
,
, .
004.92
32.973.26-018.2

ISBN 985-475-050-7

,, 2004
. , 2004

II
Web-

14

15

. . 16

Web-

21

31

III

36

36

39

Apache
Apache.

41
.

42

44

44

50

51

54

54

HTTP-

54

54

54

HTTP-cookie

55

55

55

56

56

,
.

. . . 59

. . . . 62

.63

68

71

74

78

IV

80

80

83

. . .

88

89

91

HTML-

94

96

. . .

99

103

104



, ,

107
.

114

115

115

. . . . 117
. 119

121

125

130

.134

134

. . . . 144

165

-.

170

170
. . . . . '

177

190

194

: ?

194

195

195

HTTP-

197

198

199

205

1. HTML CSS

205

2.

206

3.

208

4. Cookie

233

5. POST GET . . 235


6. Unix

236

.
, Internet Explorer , . ,
, ,
. HTML
(. 1)
(, ), ..
HTML-. Internet Explorer, Microsoft
.
(
, ), - .
, , . , - .
( ) , -
. ,
,

,
.
, , , ,

. , , -
(, ..). , , .
, . . , ,
. ,
, .
,
.
, . , ,
,
, .
, ? inter net
( ). ,
- ,
. .
, . ? , , ,
(, ),
.
- ,
,
.

: , , GPRS .. , . , ,
. ,
, ,
,
. , ,
.
. , 1969 .
.

. ,
.
- .
.
,
. , 10 %
( 580 ) .
, , 2005 1
.
,
, . 70 % . ,
, .
, , . -

10

, , ..
, , .
. , ,
. , , WWW (World Wide Web,
). 1992 -
(CERN), (). 1993 WWW 200 Web-,
1995 6,5 .
36 Web-, .

, .

.
,
, ,
.
HTML (HyperText Markup Language).
, ,
( , , ,
..), . HTML 1.
URL
(Uniform Resource Locator, ). ,
. URL ,
, ,
.
URL :
http://www.wnk.biz/some_directory/index.html

11

. h t t p : / /
, .
h t t p : // HTTP (. ).
www.wnk.biz .
,
: com
, edu , gov
, mil , n e t , org . , ,
, . ,
by , ru , ua , pl ..
.
.
, . , : i n f o ,
b i z - ..
s o m e _ d i r e c t o r y
( some_directory) , .
index html.
, , , , , .
, 192.128.45.194.
IP- , ,
IP- .
-, . : , , , ,
.. , , . , , .

12

. , .
? .
. -, . ,
,

. -, . , , , .
.
.
. -, ( , ).
, , . ,
.
2000 . - , ,
. . , , ,
- - -. ,
.
, - , .
? , . ,
486, ,
. -

13

, . , , , .
Pentuim ,
.
. ,
( )
( ), ,
. ,
.
: , , .
.
, ,
. , , .
, .
, .
, , . , .
, ,
,
,
. ,
, .
. , .

II


Web-

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

, ...

15

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

, ...
, , , , . ?
. ,
. , - ,
- , !
. , ,
(, ,
..), , !
, , . , .
, , , .. . ,
. , ,
. , , , Pentium-I
Windows 98. ? ,
. , ,
.
. -
, -
- .

16

Web-

, , , .
, . ,
Pentium-I .
Windows XP NTFS. : , (
- , ). .
,
,
.
. , Windows 98 , . , , , CD-RW , , .
, ? , . .
- . CD-RW flash-.
CD, (,
) USB flash-. : flash-.


!
(
1988 , ,

, - , ?), ,
? , -

17

, .
,
, . ,
. ( 1980- ) , . , -
. ,
- .
, , ,
. . ,
, ?
, ... . , , .

, , . ? , , .
, , . : ? ,
, , .
, . , , .
( )
. , , 220 ,
, .

18

Web-

, ,
. , .
-, . , - ,
. 70 , ,

4 . ( ) .
, , . ,
.
- . ,
( )
. (
) . , ,
. , , . .
, ,
, , . ,

( , ). , , , .

,
.
.
, . , . , .
, .

19

, , .
, . , , .
( ) , , .. (). ,
, . ( ) , .
,
.
: , (
) . ,
:-) ,
.
, . , ,
.
. , . ,
17- ,
19-. , :

.
85 , 100 . ,
1024 768,
100 .
100 ! , 100
, , , , . .
. ,
.

20

Web-


. , , , . ,
, .
, ,
. .
, , . , : , ,
, .
, , , , . , , . , .
, .. .
, .., .
, , , . (
, , ...)
, ( )
. , 510 . ,
, .
, ,

. . , ,
. -

Web-

21

. ,
.
( , , , ).
. ,
. ( ) , ,
. .
, . ,
.
.
.
, , ,
( , ).
. .

Web-
Web- . , ,
. Internet Explorer. ,

. ,
, 90 %. , -, , , Netscape Navigator
Opera.
, , .

22

Web-

. , , .
, . ,
, . , -.
. , - .
, .
Internet Explorer, , . , , .
FTP-.
, ,
.
CuteHTML CuteFTP (. 1), , , (
).
CuteFTP FTP-,
Windows Commander, (. 2).
.
.
, ,

. ? ,
, , . .
.

Web-

. 1. CuteHTML

. 2. Windows Commander
FTP-

23

Web-

24

.
, , .

,
subst.exe ( Windows}. . ,
C:\internef\, , . : subst
: C:\internet. , C:\internet\, .. , . , , internet, . ,
. , , . subst E: /d. B , , C:\internet\, .
, , usr.
.
. , , ?
(.. ) -.
: . , ,
,

. ,
.

( ), , .
, , . ,

Web-

25


.
.
( ) ,
,
FTP. .
Apache.
h t t p : / / a p a c h e . o r g (. 3)
.

Puc. 3. http://apache.org

http://httpd.apache.org/download.cgi.
(. .)

26

Web-

,
, - .

. . , -, , Windows,
Unix FreeBSD. Apache ,
, .
, . Windows - .
h t t p : / / a p a c h e . o r g
PGP3 ,
. . , Windows (. 4).
? .
, .
(. 5).
Next .
, , ,
.
Next ,
(. 6).
-. . usr:
E:/usr/apache/.
1

- , . {. .)
PGP (Pretty Good Privacy, )
,
,
, .
{. .)

Web-

27

. 4. Apache

, , , . , , .
Apache .
Next, ( Typical) Next,
.
.

Finish, .

28

Web-

. 5. Apache

, , . , ,
, apache.exe.
(. 7).
Apache-. . , Apache apache.exe -k
start, apache.exe -k restart, apache.exe -k shutdown. Apache
.

( ),
. - Apache Manager
Windows. ,

Web-

Puc. 6. Apache

Puc. 7. Apache-

29

30

Web-

, Apache (. 8).

. 8. Apache-cepepa Apache Manager

,
, (. 9).

. 9. Apache-cepepa
Apache Manager

, NTFS
Apache Manager . , , .
Apache 2 -,
.
(. 10).
? - Running all Apache services
( - ), .

31

Puc. 10. () () Apache


-


Apache - .
,
- , , , - , . ,
.
. . e:/usr/apache/conf/. httpd.conf. , ,
.
: Apache . .


,
- : ?
? , . . -

32

Web-

,
, .
, ..
.
, , . , . , , ?
.
, .
, ,
. , ,
.
: , , , , ,
, . ,
, , . , , ,
.
.
- ( , ) . ,
,
.
. ,

33

. ,
, .
? ,
, .
, log-.
, . log- , , , FTP.
, .
100 , .
, , , .

. , , , , , -.
, ,
.
,
. -
. . , , ,
.
, -
. ,
, .
-. - , ,
. (. .)

34

Web-

, , .
, . , ,
.

, .. .
, , FTP- .. ,
.
, , . , ,
, , .
, , , .
, .
, ,
, .
, -, , , , -.
, .
, . ,
, -
. . , - , .

. ,
- ,
,

35

(, Webmoney), ,
, .
, Webmoney.
, ,
,
. :
( )
.
, , , .
, (
) . , ,
.
: Webmoney .
.
, .
.
: ,
- . ,
.
, , .

III


1994 .
(Rasmus Lerdorf) (. 11)
, , .

. 11.

,
.

37

CGI- ,
Perl, .
( , CGI-)
.
CGI-, , . , ,
. C/C++, Fortran, Perl, TCL, Unix Schell, Visual Basic,
Apple Script .
Perl, .
, CGI- ( ), ,
, .
,
, . , - ,
, 1995 , Personal Home Page Tools (
).
.
, ,
,
, , , ..
1995 ,
.
. , , .
,

CGI (Common Gateway Interface, ) ,
. (. .)
5.0 beta 4. (. .)

38

, HTML-.

. , , .
-, ,
, , JavaScript, (, , -). . CGI-, Perl.
CGI, -
HTML-,
CGI. , - . , , ,
Basic Yamaha.
, . ,
GI-, ( ,
) . ,
, .
. ,
-
4.1 . ,
. , , ( ,
), . , , , . (. .)

39

. 2000 2,5 .


.
h t t p : / / w w w . p h p . n e t downloads
(. 12).

. 12. www.php.net

, Windows Binaries (. 13).


, , -. , ,

40

, .

. 13. www.php.net

, , . , , zip.
- (. 14).
Next, Standard.
. ,
usr. e:\usr\php\ . SMTP-
. -. , -

41

. , .

. 14.

, .
, Apache. - ,
.

Apache -.
Apache
Apache httpd.conf
E:/usr/apache/conf ,
Word.

42

, , #.
. , ,
Apache.
:
#AddType application/x-httpd-php .php
( # ). , .
php.
:
ScriptAlias /_php/ " /"
Action application/x-httpd-php "/_php/php.exe"

e:/usr/php/. He
, .
(php.exe) -
.
Apache. , , . .
.
Apache
, ,

. -
,
, . ,
.
httpd.conf
:
<VirtualHost 127.0.0.1>
ServerAdmin admin@servername.com


ServerName

43

www.servername.com

DirectoryIndex index.php3 index.phtml index.php


index.htm index. html index.shtml index.shtm
DocumentRoot " e : / u s r / p u b l i c _ h t m l / h o s t / v i r t u a l "
ScriptAlias
cgi-bin/"

/cgi-bin/

"e:/usr/public_html/host/virtual/

ErrorLog e : /usr/public_html/host/virtual/logs/error. log


CustomLog
common

e:/usr/public_html/host/virtual/logs/access.log

</VirtualHost>
VirtualHost
ServerAdmin
ServerName

127.0.0.2>
admin@my-site.com
www.my-site.com

DirectoryIndex index.php3 index.phtml index.php index.htm


index.html index.shtml index.shtm
DocumentRoot " e : / u s r / p u b l i c _ h t m l / h o s t / s t a r t "
ScriptAlias /cgi-bin/
cgi-bin/"
ErrorLog
CustomLog
common

"e :/usr/public_html/host/virtual/

e:/usr/public_html/host/virtual/logs/error.log
e:/usr/public_html/host/virtual/logs/access.log

</VirtualHost>
, .
. V i r t u a l H o s t
IP-, . . DocumentRoot , .

44

virtual LOG
log- Apache. ,
Apache .

log-, . , . , . Log-
, , , .
, Apache. .

, - . d:/usr/public_html/host/virtual test.php :
<? p h p i n f o ( ) ; ?>
: h t t p : / / 1 2 7 . 0 . 0 . 1 / t e s t . p h p .

, phpinfo () (. 15).
, .

, . zip . . extensions .
,
, ..
,
, .

45

. 15. ,
phpinfo()

.
php.ini.
, . , , .
, php.ini-recommended php.ini. , ,
, , Apache, .
? E r r o r h a n d l i n g and logging
(. 16).

46

, .
, , . .

Puc. 16. Error handling and logging php.ini

e r r o r _ r e p o r t i n g = E_ALL.
, , , . , (. ). ,
, , ,
. , :
e r r o r _ r e p o r t i n g = E_WARNING. . 1

47

: .
1. PHP

_ERROR

E_WARNING

( )

_PARSE

E_NOTICE

16

E_CORE_ERROR

32

E_CORE_WARNING

( )

64

E_COMPILE_ERROR

128

E_COMPILE_WARNING

( )

256

E_USER_ERROR

512

E_USER_WARNING

1024

E_USER_NOTICE

2047

E_ALL


( , )

display_errors = Off
On, , , , log-.
.

48

Data Handling r e g i s t e r _ g l o b a l s =
Off On (. 17).

, .

. 17. php.ini

,
. e x t e n s i o n _ d i r .
, , . ,
, , . , TEMP , .
{. .)

49

,
.

php.ini
, Windows ( ,
). .
Apache.
,
.
, .
.
, , : name.phtml?a=l&b=2,
$ $b.
. , , 4.1, ,
,

. , , - .
r e g i s t e r _ g l o b a l s
php.ini. r e g i s t e r _ g l o b a l s = On,
. r e g i s t e r _ g l o b a l s = Off, , ,
.
. .

50


, , .
.
, ,

. .
,
php.ini, ( , ,
), hosts, E:\WINDOWS\system32\drivers\etc
(. 18). Windows,
. Windows, , .

. 18. hosts

hosts :

51

127.0.0.1 localhost
127.0.0.6 204040
127.0.0.2 virtual
127.0.0.3 price
127.0.0.4 start
127.0.0.5 test
, ,
.
. , , .
, ,
. - , ,
httpd.conf, e:/usr/apache/conf.
, , Word, (. 19),
.
php.ini,
.
,
, ,
, DOS- Apache, ,
.
, , .


, . Perl. , ,
. ,

52

. 19. httpd.conf
PHP
. . , .

.
2.
, ( CGI, log, , , ),
.
, .

, -, phtml, php3, php. , ,


phtml.
<?php ?>.
, /*, */ ,
//
. , ,
.

. HTML
,
, , .
. ,
, . :
<? phpinfo(); ?>

phtml , 1 2 7 . 0 . 0 . 1 /
.phtml. ? ?
Phpinfo .
, .. . FTP.
3 .

54



Web-,
, .

: Oracle, Adabas D, Sybase, FilePro, mSQL, Velocis, MySQL,
Informix, Solid, dBase, ODBC, Unix dbm, PostgreSQL. .
, ,
. , , ,

, .
.
HTTP-
, , Apache.

, ,
.

.

HTML-, GIF, JPEG PNG.
GD.

.
, , , , -

55

.. , ,
, .
HTTP-cookie
Cookie (
4 ) , ,
(. 4). cookie, setcookie(). Cookie HTTP-,
setcookie {) ,
- ,
. cookie, , -.

. , . , .

, .

( ,
, )
, , .
, , ,

.
.

56


. , . .
.
, ,
, - , ,

, , .
.
,
,
(
, ) .


.
:
<?php
echo ", !";

:
<?php. <?, .
,
? , .

57

HTML-, ,
, !.
echo,
.
, .
, .
,
(, ). $,
. , , . , _ ( )
.

(.. ECHO
, echo),
(.. $os $OS ).
,
, , , .
, Pascal
Visual Basic, . , , .

, . ,

58


.
, .
, (
). ,
, . : @,
. : @$name; if (@$name) .. php.ini
(. ).

. , $ = 5. , $, , 5. :
1 <?php
2 $name = 6;
3 $hl2 = 4.89;
4 $file_type = "path/index.phtml";
5 $os = "PHP !";
6 ?>
$name 6, .
$hl2
4.89, .

. , ( ), .

59


,
.
,
. :
<?php
$ = 5;
$b = 3;
$ = 4;
$d = $ + $b - $;
echo

$d;

?>

4,
, , ,
.
.
. , $++; $
.

: $ = $b = 4; $ $b . :
<?php

$b = $ = 5; /* $ $b */

60

$ = $++; /* , $
$ {5) , $
*/
$ = $d = ++$b; /* , $d $ $b,
, .. $d $ 6 */
$f = 2 * ($d++); /* $f $d , ..
2 * = 12, $d */
$g - 2 * (++$); /* $g $ , ..
2 * 7 = 14 */
$h = $g += 10; /* $g
10, 24,
$h */
?>

,
. : .
1, 2, 3, 4, 5, .. ,
. :
<?php
$i = 1; // $i 1
echo $i; // $i
$i++;

//

echo " ".$i; // ,


//

$i + +;
echo " ".$i;

61

$i++;
echo " ".$i;
$i++;
echo " ". $i;
?>
, , , .

$i++,
$i = $ + 1;. , ,
.
( ) 1 2 3 4 5.
,
,
HTML- <br>. echo " < b r > " . $ i ; .
.
:
;
$i 1;
$i ;
$i ;
$i ;
, ;
.
, . ,
.
, HTML-:
!
HTML-.
1

(. ),
.

62


: .
:
if ( ) { } e l s e { }
,
. ( , ) :
() if () () { ,
} () e l s e { ,
}
, , .
, .
, .

. . , , .

. ,
.

-
(, ), , .
, ,
.

63

,
. .
:
<?php
$ = 5;
$b = 9;
if ( $ == $b ) { echo $b - $; } else { echo $b.$a; }
?>

, .

, .
,
!
-.
95, $
$b, echo $ b . $ a ; (
, , ) . ,
.
! =,
,
( or, and, >, <= ..).


. while, do...while, for foreach.

64

, - .
. :
;
;
;
, ;
( );
.
.
, :
<?php
$i = 0;
$n = 10;
while ($i <= $n):
echo $i."<br>\n";
$i++;
endwhile;
?>
. $i , , $n . w h i l e (),
, . , $i <= $n.

65

, . ( ).
, $i, , ( ), , , ( ).
endwhile .
, ,
10. , echo $i
HTML- <br>.
, .
<?php
$i = 0;
while ($i <= 10)
{
echo $i++."<br>\n";
}
?>
, ,
.
, .
, do...while. , while
, ,
, . , do...while
, w h i l e ( -

66

while, ,
). do...while
:
<?php
$i = 0;
do
{
echo $i."<br>\n";
$i++;
}
while ($i <= 10);
?>
for. :
for (exprl; expr2; r) { }
(expr1) .
r2. ( t r u e ) ,
() (). ( f a l s e ) , . r.
. r2 , ( , ). ,
, , break , for.
break, , . :

67

$ = 0;
while ($a < 5) {
if ($arr[$a] == "stop")
{
break; /* ,
$rr[] stop */
}
$++;
}
c o n t i n u e ,
. :
while (list($key,$value) = each($arr))
if

($key 2)

continue;
}


for:
/* 1 */
for

($i = 1;

{ print $i;

$i <= 10;

$i++)

/* 2 */
for
{

($i

if

= 1;;$i++)

{$i > 10)

{ break;

} print $i;

/* 3 */
$i = 1; for (;;)
{ if

($i > 10)

{ break;

} print $i;

$i++;

68
/* 4 */

for ($i = 1; $i <= 10; p r i n t $i, $i++)

- .


date. : $date = d a t e ("") ;
,
. :
"am" "pm";
"AM" "PM";
d , , ( ), .. 01 31;
D , , , " F r i " ;
F , , , " J a n u a r y " ;
h , , 12- , ;
H , , 24- , ;
i , , , ., "00" "59";
j , , ;
1 ( L) , , ,
"Friday";
L , , .. " 0 " " 1 " ;
m , , .. " 0 1 " "12";
, , , " J a n " ;
n , , , .. " 1 " "12";
. AM (Ante Meridiem) , PM (Post Meridiem) . (. .)

69

, , "+0200";
s , , , .. "" " 5 9 " ;
s , , ,
" t h " , "nd";
t , .. " 2 8 " " 3 1 " ;
U Unix, .. 1 1970 ;
Y , , ;
w , , "" ;
Y , , "1999";
, , , " 9 9 " ;
z , , "299".


, d D.
. . ,
JavaScript,
( ,
, ).
, , ,
Windows,
, ( ) . , :
<?php
$h = d a t e ( " H " ) ;
if ($h >= 5 && $h <= 11) e c h o " ! " ;
, second (), seventh (). (. .)

70

if ($h >= 12 && $h <= 18) echo "!";


if ($h >= 19 && $h <= 24) echo " !";
if ($h >= 1 && $h <= 4) echo " !";
?>
,
:-)

d a t e ( " H " ) ,
, , ,
.
,
,
. ,
, , .
, , , ,
. . :
$time = d a t e ( " H : i " ) ;
$time1 = d a t e ( " H " ) ;
$time2 = d a t e ( " i " ) ;
$time_s = 7;
$timel = $timel + $time_s;
if ($timel >= 24) { $timel = $timel - 24; }
$time = "$timel:$time2";
, ,

. $time_s
.

71

, ,
, . . . ,
, .
, , , , , .
, , , , , , 3423.
, , . , $[ 0 ] ,
$[ 1 ] , $[ 2]
.. $ [ 8 ] .
: 9,
8. ,
, .
, : $
[]. , . , ,
. ,
, ,
.
:
<?php
[ ] = 1;
[] = 67456;

[]

=0 " " ;

?>

$ 0,
1 2 1, 67456 . echo $ [ 2 ] ; .

72

.

,
(, , , , ,
), .
,
$ [ ] , $ [ 0 ] , $ [ 1 ] , $ [2] ..
.
. . ,
, , , , .

. :
$[ ]

[ 0 ] ;

$[ ]

[ 0 ] ;

$[ ]

[ 0 ] ;

,
: , ,
, , ..
, .
,
.
. :
<php
$ = f i l e (" ");
?>

$
, , .

73

. , " h t t p : //...", , . .
. (, )
SafeMode, , .
, ?
.
, .
.
end ( ) , next ( ) , p r e v () r e s e t () . .
end ()
, next ()
(.. )
f a l s e , . , f a l s e
.
p r e v ()
(.. ) f a l s e , . ,
f a l s e .
r e s e t <)
.
c u r r e n t {) ,
. .
, c u r r e n t () f a l s e .
(0 ),
f a l s e .
s o r t () ,
, , .

74

r s o r t ( ) (
).
, , . - .

.


, (
). .
. .
, , , .
,
. , , ( ). . :
<?php
$str = ",";
$sto = "";

$qwe = " ! " ;


$mir = $ s t r . " " . $ s t o ;
echo $mir.$qwe;
?>


, , .
, . , -

75

.
, , , , ,

.
, ,
, ,
, , .

, ( ) .
, , . : chop ( s t r ) ;
:
$str = chop ($str);
$ s t r .
,
, trim ( s t r ) ; :
$ s t r = trim ( $ s t r ) ;
,
ltrim ().
.
u c f i r s t () , , .

ucwords ( s t r ) ; , . . ,
. ,

. s t r t o l o w e r ( s t r ) ; (

76

) s t r t o u p p e r ( s t r ) ; ( ). , .


.

.
. .
, -
. ,
? , . , , HTML-
:
<input maxlength="100" name="form">
form 100. . ,
,
, .
.
(
), 100 ,
HTML .
, (
),
.
, ,
.
- s u b s t r i n g
( s t r i n g , s t a r t , l e n g t h ) . :

77

$form = substr($form,0,99);

, 100 ( 99,
). ,
.
, substr . s t r i n g , s t a r t () length ().
s t a r t , , s t a r t s t r i n g .
:
$form = s u b s t r ( " a b c d e f " , 1 ) ; // "bcdef"
$form = s u b s t r ( " a b c d e f " , 1, 3 ) ; // "bed"

s t a r t ,
, s t a r t
string. :
$rest = substr ("abcdef",

-1);

// "f"

$rest = substr ("abcdef", -2); // "ef"


$rest = substr("abcdef", -3, 1); // "d"

length , length
s t a r t . (
),
s t a r t .
length ,
length s t r i n g .
, s t a r t . :
$rest = substr("abcdef", - 1 , -1) ; // "bede"
.

78

,
, . s t r _ r e p l a c e ( n e e d l e , s t r ,
haystack) ;, needle, haystack, s t r :
$str = str_replace("", "\n", $str);
//
$str = str_replace("red", "black", $str);
/ /
. ,
.
- ,
e r e g _ r e p l a c e {),
. , , ,
.

, 4.0.
, POST GET.
SID.
, . cookie . SID
, .. ,
. tmp ,
( cookie).

79

cookie , SID ,
GET POST, .
. , .
3.

IV


: ,
. :
1 <?php
2 $w = "4"; //
3 $ = "6"; //
4 if ( $w == $ )
5 {
6 echo $w + $e; // ,
7 exit;
8 }
9 if ( $w > $ ) { echo $w; } else { echo $e; }
10 //
11 exit;
12 ?>
. ( 23). , ( 4). if. ,
, $w
$. , .

. , ,
, .
, .
, ,
echo ( 6), , e x i t . ,
,
11, . , .
, (
, ) , , ( 9). ,
, ,
.
, $w > $, $w, .
, ,
$w <= $, e l s e {
echo $e; }. ( 4), , $w < $.
e x i t 7, ,
, , $.
, .
,
,
, -- switch. ,
:

82

<?
function date_format($date)
// $date
{
$year = substr($date, 0, 4 ) ;
// $r
/ / $date
$month = substr($date, 4, 2};
// $month
$day = substr ($date, 6, 2};
switch ($month)
// switch($month) :
// $month
// case :
{
case 01: $month = ""; break;
case 02: $month = ""; break;
case 03: $month - ""; break;
case 04: $month = ""; break;
case 05: $month = ""; break;
case 06: $month = ""; break;
case 07: $month = ""; break;
case 08: $month = ""; break;
case 09: $month = ""; break;
case 10: $month = ""; break;
case 11: $month = ""; break; .

83

case 12: $month = ""; break;


}

$date = "$day $month $year . " ;


echo $date;
}
$date = date("Ymd");
// date()
date_format ($date) ;
// date_format ()
?>
.


, ,
. ,
, .
, (,
)
.
,
.
require () include (). . :
include ("text.phtml"). , require () (
, a include ()

84

, ,
. <?php ... ?>.
.
, ,
. i n c l u d e (),

.
, i n c l u d e ().
r e q u i r e () . , . ,
r e q u i r e () . r e q u i r e () , i n c l u d e ().

, . ,
h t t p : //, .
, &, ?, %.
-. , : ?=,
,
.
, h t t p : / / n a m e . c o m / i n d e x . p h t m l ? l e x = 7 index.phtml. ,

$1 7. . GET.
, , POST (. 5).
,
&. , -

85

.
.
: h t t p : / / /
i n d e x . p h t m l ? l i n k = l
, index.phtml.
:
<html>
... ...
<?php
$url = "";
if (Slink == 1) { $url = "name1.phtml"; }
if ($link == 2} { $url = "name2.phtml"; }
if ($link == 3) { $url = "name.phtml"; }
if ($link == 4) { $url = "name4.phtml"; }
if ($url == "") { $url = "error.phtml"; }
include ($url);

... ...
</html>
, if ( $ u r l
== "") { $ u r l = " e r r o r . p h t m l " ; } , .
error.phtml. - ,
index.phtml .
, , . -
, .

86

,
.
, :
<html>

... ...
<?php
include ("name".$link. ".phtml");
?>
... ...
</html>
, ,
name.phtml.
. ,
.
.
.
: h t t p : / / /
index.phtml?patch/name.phtml. p a t c h /
name .phtml ,
$QUERY_STRING. :
$add = $QUERY_STRING

index.phtml , . ( ),
$add ,
,
http://www.my_site.com/page_l/info.html. , page_l/info.html.
{. .)

87

. main.phtml.
:
<html>
... ...
<?php
$add = $QUERY_STRING;
if

($add == "")

include

$add = " m a i n . p h t m l " ;

($url);

?>
... ...
</html>

. if ($add == "") {
$add = "main.phtml"; } ( ) : if (!$add) {
$add = "main.phtml"; } . , . , ,
.
, ,
,
.
, .
.
, ,
- , .
, ,
.

88


,
. , ,
.
( , ) :
1 <>
2 <?php
3 $filename = "counter.dat";
4 $fp = @fopen($filename,"r"};
5 if ($fp)
6 {
7 $counter = fgets ($fp,10);
8 fclose($fp);
9 } else { $counter = 0; }
10 $counter++;
11 echo $counter;
12 $fp = @fopen($filename,"w");
13 if {$fp}
14 {
15 $counter = fputs{$fp,$counter};
16 fclose($fp);
17 }
18 ?></p>
, , counter.dat, , .

89

.
1. HTML- <>.
2. .
3. , .
4. , .
56. , .
7. , 10 $counter.
8. .
9. , .
10. .
11. .
12. .
1315. , .
16.


, . ? . ,
.

, :

90

<form method="POST" action="action.phtml">


<p><input type="text" name="email" size="20">
<br><input type="text" name="name" size="20">
<br><textarea rows="2" name="txt" cols="20"x/textarea>
<br><input type="submit" value="" name="Bl">
<input type="reset" value="" name="B2"</p></form>
HTML- ,
(. 20).

. 20.
, , action.phtm.
email, ,
. name,
, . , , ,
. ,
txt. .
, ,
,

91

.
, , , action.phtm. - :
<?php mail{$email,

$name,

$txt);

?>

, , , ,
. , .
$email, $name, $ t x t .
, ,
. ,
,
POST. ,
GET.
. (GET) , (POST) .


, . , , , , .
,
, ,
, , , , .. , mail.
:
mail ( $email, " ", $str, "From: ") ;

92

, , (
). $ s t r , $email. ,
.

,
, .. , .
:
<?php
$host = gethostbyaddr($REMOTE_ADDR);
$ip = getenv("REMOTE_ADDR");
$date = date("d M Y, H:i:s");
$str = ("
$date
$host
IP- - $ip
");
mail ( $email, "", $ s t r , "From:" );
?>
,
IP, $REMOTE_ADDR. IP
. , $email.

93

, , .
-,
( , IP-)
.
(, ):
$filename = " d a t a . t x t " ;
$fp = @fopen($filename,"r");
if ( !$fp )
{
@mail( $email,
$filename!");

"!",

"

}
, @,
,
. , :
if

(@mail(

$email,

"",

$str))

{ ... , ... }
else

{ ... , ( , ,
..) . . . }
$email , , , ,
.

94

HTML-
HTML-
, , ,
.
, . , , HTML.
, , . :
<?

$header="Content-Type: text/html; charset=windows-1251\n";


m a i l ( " , ","
","
<h1> HTML-.</hl>
<> <br>
<hr>
<table><tr><td>Bo, </td>
<td></td></tr></table>

<hr>

",$header);

?>

, $header
Content-Type: t e x t / h t m l ;
HTML-. ,
. , , .

HTML-

95

,
:
$to = ", ";
$subject = " ";
$text = " ";
$from = " ";
$kodir = " ";

// $kodir = "windows-1251";
// $kodir = "koi8-r";

$header = "From: $from\nReply-To: $from\n";


$header .= "MIME-Version:

1.0\n";

$header .= "Content-Type: text/plain; charset=$kodir\n";

$header .= "Content-Transfer-Encoding: 8bit\n\n";


$header .= "$text\n";
mail($to,

$subject,

$text,

$header);

,
. ?
. , .
, HTML-. .

96

-
.
:
<?php

//
$q[] = "";
$q[] = "";
$q[] = "";
$q[] = "";
$q[] = "";
$q[] = "";
$q[] = "";
$q[] = "";
$q[] = "";
$q[]
$q[]
$q[]
$q[]

=
=
=
=

"";
"";
"";
"";

//
$[0] = "";
$[1] = "";
$[2] = "";
$[3] = "";
$[4] = "";
$[5] = "";
$[6] = "";
//
$m
if
if
if
if
if
if


= date("m");
($m == "01") $m
($m == "02") $m
($m == "03") $m
($m == "04") $m
($m == "05") $m
($m == "06") $m

=
=
=
=
=
=

1;
2;
3;
4;
5;
6;

-
if
if
if

97

($m == "07") $m = 7;
($m == "08") $m = 8;
($m == "09") $m = 9;

//
$we = d a t e ( " w " ) ;
//
$chislo = date("d") ;
// $
$den_nedeli = $e [$we];
//
// $q
$mesyac = $q[$m];

echo " " . $ c h i s l o . " " . $ m e s y a c " ,


?>

" . $den_nedeli;

,
, . , .
,
. , .
,
. ,
(
).

, , , , . , .
.
.

98

, , . . ,
, .
. , , .
, .
10,
(.. 02), .
, ,
. . ,
,
( ),
.
.
, ,
. $ . ,
,
.
, .
, , .
.
, .
.

99



,
.
.
, URL. . ,
urlfile.txt.
.
, .
counter.txt.
urlfile.txt counter.txt
, ,
.
log.phtml,
index.phtml. ( count), .
, .
log.phtml :
<?

if($QUERY_STRING ! = " " )


{ $ u r l = $ P H P _ S E L F . ' ? ' . $QUERY_STRING; }

e l s e { $ u r l = $PHP_SELF; }

,
$ P H P _ S E L F .
, ,

100


$QUERY_STRING. ,
$QUERY_STRING ,
$PHP_SELF, , .
:
$add = $DOCUMENTROOT."/count/urlfile.txt";
$adds = $DOCUMENTROOT."/count/counter.txt";
$li = file($add);
$a = count($li);
, .
$DOCUMENT_ROOT , , , .
$li . , , , .
:
$i = 0; $w = -1;
while {$i <= $a):
$tmp = trim(str_replace ("\n","", $li[$i]));
if ($tmp == $url) { $w = $i; $i = $a++; }
$i++;
endwhile;
. , , . :


if

101

($w == -1)

{
$fp = fopen{$add, "a+");
if ($fp) { $fw = fwrite($fp, $url."\n"); fclose($fp);
}
$fp = fopen($adds,

"a+");

if ($fp) { $fw = fwrite{$fp, " 0 " . " \ n " ) ; fclose ($fp); }


$w = $a++;
}
, ,
.
,
, $w .
, : , , , $w
.
:
$ = f i l e ( $ a d d s ) ;
$co[$w] = t r i m ( s t r _ r e p l a c e ( " \ n " , " " , $ c o [ $ w ] ) ) ;
$co[$w]++; $ c o u n t = $ c o [ $ w ] ;
$co[$w] = $ c o [ $ w ] . " \ n " ;
$
. $count ,
.
, ,
, ,

102

. ,
. , , , , .
.
:
$ = implode ("", $);
$fp = fopen($adds, " w " ) ;
if ($fp) { $fw = fwrite($fp, $p) ; fclose ($fp); }
, $ . ,
, . :
?>
,
log.phtml.
, .
, , index.phtml
:
<? i n c l u d e ($DOCUMENT_ROOT."/count/log.phtml"); ?>
.
,
. :
<table align="center" border="l">
<?
$add = $ DOCUMENT_ROOT."/count/urlfile.txt";
$adds = $DOCUMENT_ROOT."/count/counter.txt";
$li = file($add);

103

$ = file($adds);
$ = count($li);
.
log.phtml.
. , HTML:
$i = 0; $w = 0;
while ($i < $a):
echo "<tr><td>.
<a href=$li[$i]>$li[$i]</a>
</td><td>$co[$i]</td></tr>";
$i++;
endwhile;
?></table>
. !
, :
<? i n c l u d e ($DOCUMENT_ROOT. " / c o u n t / l o g . p h t m l " ) ; ?>
(
),
,
.


,
, .

104

cookie
(, 4).
, .
, , :
$ = mktime(0,0,0,1,1,2022);
if (isset ($name)) { setcookie ("name "', "0", $y) ; }
else { $name++; setcookie("name ", $name, $y); }
?>
. cookie $name , .
cookie .
. :
<> - <? echo $name; ?></p>
, ,
.

cookie . , cookie .
cookie.


, ,
. , ,
. .
, . :
http://virtual.brest.by/php/ http://20404 0.com.

105


. , Excel, , .
. .
. ,
http://home.name ( , ,
). , .
, ,
(http://virtual.brest.by/php/ http://204040.com)
: http://home.name/reg.phtml?id=l http://home.name/
reg.phtml?id=2.
? , ,
, $id, ,
.
, . ,
, , .
:
<?
$u[0] = "http://home.name";
$u[1] = "http://virtual.brest.by/php/";
$u[2] = "http://204040.com";
,
. ,
. $id,
home.name. ,
.
:
$add = "log.txt";
$sl = file($add);

106


. $id :
if ($id < 1 or $id >= count ($u) ) { $id = 0; }
, .
:
$url = $u[$id];
$temp = t r i m ( s t r _ r e p l a c e {"\n","", $ s l [ $ i d ] ) ) ;
if (!$temp) { $temp = 0; }
$temp++;
$sl[$i] = $temp."\n";
, .
$u,
, ,
. $temp , .

.
:
$sav = i m p l o d e ( $ s l ,

"");

:
$fp = @fopen($add, "w+");
if ($fp) { $fw = fwrite($fp, $sav); fclose($fp);

header ("Location: " . $ u r l ) ;


?>
. ,
, , .. , .
. ,
, . .

107


-,
,
.
, .
, . , , MySQL,
(,
-).

. ,
,
. , , .
, .
.
. , :
, .
,
. , , , . .
:
<?
// 1
?>
. , cookie,
.

108

, ..
.
:
<?

$nomer_ban = 3;
$name_file = " ";
$ l i s t = f i l e ($name_file);
?>

$nomer_ban
. ,
.
$file_name , .
, .
.
, $ l i s t .
, ,
.
, , ,
, (
) ( ,
, ) .
:
<?
$set = trim(str_replace ("\n","", $ l i s t [ 1 ] ) ) ;
$set = trim(str_replace ( " / / " , " " , $set));
$set++;
if ( $ s e t > $nomer_ban or $ s e t < 1)
?>

{ $ s e t = 1;

109

$ s e t $ l i s t .
, , ,
1.
.
(//) . , .
$ s e t ,
.
, , ..
, .
, , .
, , . , , :
<?
if ($set == 1) { ?> <?
if ($set == 2)

{ ?> <?

if ($set == 3) { ?> <?


?>
. ,
, :
<?
$list [1] = "// $set \n";
$str = implode("", $list);
$fp = fopen($name_file, " w " ) ;
if ($fp) { $fw = fwrite($fp, $str); fclose($fp); }
?>

. $ s t r -

110

. ,
.

. , , .
.
, .
,
,
, .
HTML-,
. i n c l u d e (" "); , phtml, php h .

, , ...
, - . - . , (
, , ). , , ,
. ,
.
,
-, , . Web- , - . ,
.
(, , ..) , .

, , ...

111

, , . , , :
< href="http://myhost.com"><IMG SRC="http://myhost.com/
banner.gif" alt="Mo " border="0"></a>
, , , . ,

, , .
. :
, .
, , . ^.
.
:
^ ^
, ,
, .
, . ,
, .
, , , , . :
< href="http://myhost.com">
<IMG SRC="http://myhost.com/banner.phtml?id=l"
alt="Mo " border="0"></a>
, id.
,
banner.phtml, -

112

.
:
header ("Location: banner.gif");
.
,
, id.
.

. ,
, , .
,
,
.
, $id. , ,
$id
( ). Sid

, .
, , :
$adds = "url.txt";
$txt = file($adds);
$ t x t . ,
, . :
$str = trim(str_replace

("\n","",

$txt[$id]));

, , ...

113

, . , .
:
list

($add,

$time,

$counter)

= split

("^",

$str) ;

^. , .
$ c o u n t e r , .
, .
Unix (. 6). , 1 1970 .
,
, , , .
:
$time = time(void);
$counter++;

.
.
(, $id):
$txt[$id] = $add."^".$time."^".$counter."\n";


.
,
:
$str = implode("",

$txt);

$fp =

"w");

if

fopen($adds,

($fp)

$fw =

fwrite($fp,

$str);

fclose($fp);

, .

114

, ,
, .




.
stat.phtml.
:
<?
$adds = "url.txt";
$txt = file($adds);
$i = 0;
while ($i <= count ($txt)):
$temp = trim(str_replace ("\n","", $txt [$i])) ;
list ($add, $time, $counter) = split ("^", $str);
echo $add." - ".$counter." : ".$time."<br>";
$i++;
endwhile;
?>
, .
,
.
.

115


:
<?

session_name ("virtualbrest") ;
session_start ();
session_register("counter");
$counter = @$counter +1; ?>
<html><body>Hae "",

<br>: <?=$counter?>
</body></html>
SID,
.
, PHPSESID. s e s s i o n _ s t a r t () , s e s s i o n _ r e g i s t e r ( " c o u n t e r " )
$counter.
, , .


,
. , ,
.
, ,
logo.txt .
.

116

1 <?
2 $lin = file ("logo.txt");
3 $ = count ($lin);
4 if ($a < 11)
5 {
6 $size = $;
7 } else
8 {
9 $size = 10;
10 }
11 ?>
12

<P>

13 <select name="D1" size=<? echo $size; ?>


14 <? $i = 0;
15 while ($i < $a) :
16 echo "<option value=".$i.">".$lin[$i]."</option>";
17 $i++;
18 endwhile; ?>
19 </select><br>
20 <input type="submit" value="submit" name="B2">
( 2).
, (
3), ( 413).
11, ( 46).
10, ( 710). ,
,
$ s i z e 1.

117

,
, (
1518).
( 1920).
<form>
</form>, ,
(. 5).



, , .
:
<form method="POST" action="post.phtml">
<? $ s l l l = f i l e ( " u r l . t x t " ) ; ?>
<select name="ur" s i z e = " l " >
<option value="0"><? echo $ s l l l [ 0 ] ; ?>: -l</option>
<option value="l"><? echo $ s l l l [ l ] ; ?>: -2</option>
<option value="2"><? echo $ s l l l [ 2 ] ; ?>: -3</option>
<option value="3"><? echo $ s l l l [ 3 ] ; ?>: -4</option>
</select>
<input type="submit" value="" name="Bl" >
</form>

(. 21),
, .
url.txt,
(
) , , .
post.phtml:
if ($ur == "") { $ur = 0;
$add = " u r l . t x t " ;
$sl = file($add);

118

. 21.

/*
*/
$u[0] = "http://-l";
$u[l] = "http://-2";
$u[2] = "http://-3";
$u[3] = "http://-4";
$i = 0;
while ($i <= count ($u)):
$sl[$i] = trim(str_replace ("\n","", $sl[$i])) ;
if ($ur == $i)
{
$url = $u[$i];
$sl[$i]++;
}
$i++;
endwhile;
$sav = ""; $i = 0;
while ($i <= count ($u)):

119

$sav = $ s a v . $ s l [ $ i ] . " \ n " ;


$i++;
endwhile;
$sav = str_replace ("\n\n","\n", $sav);
$fp = @fopen ($add, "w+") ; if ($fp) { $fw = @fwrite{$fp,
$sav); @fclose($fp); }
header
?>

("Location:

".$url);

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


, ,
. .
, , , :
$f = fopen("counter.txt","w+"); /*
*/

w+ , ( ). ,
,
.

, ,
, ,
-

120

. ,
, .
, ,
.
.
flock ( d e s c r i p t o r , mode).
(
, , fopen). mode :
1
;
2 , .. ;
3 .
:
flock($f,2);

//

:
flock($f,3); //
, , .
(
).
, , , , , .
.
, , .

,
:

121

, ,
.
. log-, ..
.

1
, . . ,
h t t p : / / s u b s c r i b e . r u .
, , .
, .
, .
,
. : http://win.subscribe.ru/catalog/
latest.

. , , , , -
.
.
. , ,
.
, .
. grab (, ). (. .)

122

<?php
//
$link = "http://win.subscribe.ru/catalog/latest";
$file = @fopen($link, " r " ) ;
if ($file) {
$rf = fread($file, 200000);
fclose ($file);
} else
{
echo "<h3 align=nter>,
!</h3>
<center>
<IMG src=http://virtual.bresttelecom.by/banner.jpg
width=468 height=60 border=0 alt=\" \">
</A><br><br>";
}
// 1
$rf = trim (chop ( $ r f ) ) ;
$s = strpos($rf, "<!-noindex-><FORM", 0) ;
$rf = substr($rf, $ s ) ;
// 2
$s = strpos($rf, "<!-/noindex-><table") ;
$rf = substr($rf, 0, $s) ;
// 3
$rf = str_replace ("/catalog/","http://win.subscribe.ru/
catalog/",
$rf);
$rf = str_replace ("/archive/","http://win.subscribe.ru/
archive/",
$rf);
$rf = s t r _ r e p l a c e ("ACTION=/member/

123

quick", "ACTION=http://win.subscribe.ru/member/quick", $rf) ;


$rf = str_replace ("/img/money2.gif","http://
win.subscribe.ru/money2.gif", $ r f ) ;
$rf = str_replace ("/img/all4.gif","http://win.subscribe.ru/
af.gif", $ r f ) ;
$rf = str_replace ("/img/af.gif","http://win.subscribe.ru/
af.gif", $rf) ;
// 4
echo $rf;
?>
. .
. , ( 200 000 ,
).
,
, .
.
1 :
$rf = trim (chop ($rf));
, ,
.
, :
$s = strpos($rf, "<!-noindex-><FORM", 0) ;
,
. $s.
, ( ):
$rf = s u b s t r ( $ r f , $ s ) ;

124

2. , ,
.
, . ,
, , .
, .

, , : , .
,
.
3. , , , . :
$rf = s t r _ r e p l a c e
("/catalog/","http://win.subscribe.ru/catalog/",

$rf);

$rf
. ,
. , .
4. . HTML-, .
,
. : , ,
.
, . .

125



. ,
,
:
? :
!
.
.
- .
.
.
, .
, .
index.phtml, golos.txt
golos.phtml (, , , , , ).
.
Index.phtml.
, , .
,
.
.
HTML, , :
<form method="POST" action="golos.phtml">
<table border="l"><tr><td><table border="0">
<tr><td>Bae ?</td></tr>

126

<tr><td><input type="radio" name="answer"


! </td></tr>
<tr><td><input type="radio" name="answer"
Hopao</td></tr>
<tr><td><input type="radio" name="answer"
pao</td></tr>
<tr><td><input type="radio" name="answer"
- !</td></tr>

value="l">
value="2">
value="3">
value="4">

<tr><td><input type-"Submit" name="vote" value=""></td></tr>


<tr><td><input type="Submit" name="result" value="C "> </td></tr></tablex/td></tr></table></
form>
,
PHTML,
-. (. 22).

. 22.

127

HTML- , .

.
-, , , a c t i o n ,
.
, , , .
golos.txt. ,
.
( ),
. golos.txt
f i l e ( $ a r r a y ) .
,
, , .
. . () , , .
golos.phtml. .
, .
1 <?php
2 $file = "golos.txt";
3 $ = file($file) ;
4 $i = 1; $fi = count($a) ;
5 $n = 0;
6 while ($i <= $fi):
7 $a[$i] = trim(str_replace ("\n","", $a[$i]));
8 $n = $n + $a[$i];
9 $i++;
10 endwhile;

128

11 if ($answer != "") {
12 echo "<br>, ";
13 $a[$answer]++; $n++;
14 $rez = " \n".$[1].
"\n".$[2]."\n".$[3]. "\n".$[4];
15 $fp = @fopen($file,"w");
16 if ($fp) { $counter = fputs{$fp,$rez); fclose($fp); }
17 else { echo " !"; }
18 } else { echo "<br> "; }
19 echo "<br>! - <b>".$[1]."</b>";
20 echo "<br> - <b>".$a[2]."</b>";
21 echo "<br> - <b>".$a[3]."</b>";
22 echo "<br> - ! - <b>".$a[4]."</b>";
23 echo "<br><br>Bcero : ".$n;
24 ?>
, , . ,
- , ,
( ),
, .
,
. , .
( 2) $ ( 3). ( 610), ,
( 7).
.
,
" \ n " ( )
t r i m ().
, -

129

, , ,
.. , $answer, .
,
,
( 8).

,
. $answer
( 11), .
, ,
( 1416). $answer , , , ( 13).
, , ( 13).
, . ( 15). w
.
, $rez ( 16), ( 17).
$rez :
( ,
) ,
. .
. ,
.

130

, .
HTML <br>.
, . -,
.
, . : , . , .
. , .
,
: ,
, , IP- ,
.. .


, Web- : , , ?
,
,
. .
. ( guest.phtml)
,
. , (guest.txt) , .
FTP-,
.

131

.
guest.phtml. :
<h2> </h2>
<form action="guest.phtml" method="post">
e-mail: <input type="text" name="email">
: <input type="text" name="name">
: <br><textarea name="msg"
cols = "40"></textarea>
<p><input

type="submit"

rows="10"

value="0"></>

(
email), ( name) ( msg) (. 23).

. 23.

132


, , . .
, ,
, :
<?
$files = "guest.txt";
$qq = 50;

:
if (!$email) { $email = ""; }
$msg = substr($msg,0,999);
$email = substr($email,0,39);
$name = substr($name,0,39);

, ( ,
""). , . ,
, .
, :
if ($msg != "" && $name != "") {
, , (. ).
, , , , :

133

$time = D a t e ( " h : i : M : d " ) ;


$soo = "\n<b>$time $name (<a href=\"mailto: $email \">
$email </a>) </b><br> $msg<hr>";
$fp = fopen($files,

"a+");

$fw = fwrite($fp, $soo);


fclose($fp); }
. .
, HTML.
(
100,
, , 50- 80-).
, . :
$lines = file ($files);
$ = count($lines);
$u = $a - $qq;
for($i = $a; $i >= $u ;$i-) { echo $lines[$i]; } /* */
?>
, ,
, ,
.
, .
, . ,
, . , .

134

.
.
, :
< href=guest.txt>apx</a>
,
HTML-. , ,
.
,
, , ,
.. .


.
, .
.

. ,
,
, , .
Web- . , Web-
,
.
.
, , CGI (,
Perl).
.

135

,
CGI ?
,
CGI? , ,
, ?
, , . ,
- .
: ,
(. ) .
, , .
, - . , .
, - CGI.
CGI ,

, . .
,
- , .
-
,
( )
,
.
,
, .

. , ,
.
, : -

136

. ,
(, ).
, , . ,
.
.
, . , ,
. .
, . ,
, , ,
. , ,
,

. ,
,
, . .
:
, ( ,
, -
, ) ,
?
. Windows
2000, .
, -

137

.
( , ..).
, Windows

, . , ,
.
, ,
,
, .
,
, ,
. , .
, . , . , ( ),
. ( ).
, .
, :
. , . .
, ,
,
.. .

. , : -

138

, cookie
.
,
.
,
, .
, , .
: , , , guest, , ( ), .
,
, ,
, , ..
.
, , , POST (CM. 5) ,
.
, , .
, - . .
( )
, , (
1

.
.
(. .)

139

) , .

, , ..
, . ,
, , ..
, . ( , ),
, .
,
. , , POST,
.
GET (CM. 5), ,
..! .
, , ,
. , .
POST, $QUERY_STRING.
, , - GET. .
, . ,
,
,
, , ,
. ,
, -- , , , . ,
,
,
. ,
, , . - -

140

, ,
.
,
GET. , , . cookie. , cookie
. cookie
, , ,
, .
:-)
, cookie
, .
, , ,
. GET.
GET
, . . ,

,
GET . ,
, .
.
,
, .
.
.
,
, , . , Windows 2000
(. ): ,

141

. , : GET , (
, ),
.
, GET, .
, , , . . ,
,
. ,
, , .
,
.
, ,
, , . .
, .
, .
, , .
POST (, ). ,
, .
. , ,
- . , , . HTML .

142

,
. , ,
, , ( ) .
.
.
.
.
,
.
,
. .

, ..
,
, . , ,
. ,
,
. , . ,
. ,
- . ,
. ,
GET. ,
, ,
.

143

, 1520 , , .
.
, . , ,
, , .
, . .
( , - , ), , ,
.

. ,
, - , ,
.
,
. , .
. , , .
, ,
ICQ .
. , . ,
.
,
.
. .

144


,
. , , ,
, .
, ,
, , .
, 4.
, .
:
index.phtml
tools.phtml
header.phtml
banner.phtml
main_window.phtml
msg.phtml
userlist.phtml
memolog
log_chat.txt kto_chat.txt. ,
, ,
.
, .
index.phtml. , , .
, .
:

145

<form method="POST" action="header.phtml">


<b> :</b><br>
<input type="text" name="person"
size="14" maxlength="10"><br>
<p><input type="submit" vlue=" " name="Bl">
</form>
(. 24),
header.phtml. ,
.

. 24.
name <input> person,
($person) ,
. $ p e r s o n .
tools.phtml. ,
.
, , , c h a t _ v i r t u a l b r e s t .
:

146

<?
session_name ("chat_virtualbrest");
session_start();

,
chat_virtualbrest, .
if ( $ip == "127.0.0.2" ) { $server = 1; } else
{ $server = 0 ; }
,
. , ,
,
. Sip 12 7 . 0 . 0 . 2 .
, $ip =
getenv("REMOTE_ADDR"); :

echo $ i p ;
exit;

IP- . 1 2 7 . 0 . 0 . 2 .
, $server ,
, 0 (). , 1 ().
- ( ), :
if ($server) {,
} e l s e {, }
:
if ( !$server ) { error_reporting (0); }
, . , , .

147

:
$time_nast = time(void);
,
, .
$file_logchat = "memolog/log_chat.txt";
, log- . ,
.
:
$chat_number = 100;
$name_rob = "Robot";
. ($chat_number)
, ,
.
, - . , ,
,
.
$name_rob ,
, ..
, , :
$file_kto_in_chat = "memolog/kto_chat.txt";

Unix-,
:
// $time = date("H:i");

. , ,
. ,

148

, .
, :
$timel = date("H");
$time2 = date("i");
$time_s = 7
$timel = $timel + timer_s;
if ($timel >= 24) { $timel = $timel - 24; }
$time = "$timel:$time2";
?>

,
, ( , ). , 24, , 24. .
:
?>

, .
header.phtml. .

,
, .
.

tools.phtml, :
<?
include

("tools.phtml");

149

, . :
session_register("person",

"pass");

, , , .
, :
$kto = file ($file_kto_in_chat);
: ,
~ (, )
.
, , , 1 1970 .
.
, :
$fi = count($kto); //
$met = - 1 ; /* ; -1 , */
$i = 0;


:
while

($i <= $fi) ;

$str = trim(str_replace

("\n","",

$kto

[$i]));

:
if ($str)
{
list ($name_kto, $time_kto) = split ("~", $str);

150


s p l i t ($name_kto)
($time_kto):
if { {$time_nast-$time_kto) > $chat_number and
$name_kto != $person)
, ,
, , . :
{

$kto [$i] = " " ;


,
.
:
$sav = "$name_rb~$time~ $name_kto~\n";
$fp = fopen($file_logchat,
if ($fp)

"a+");

{ $fw = fwrite($fp, $sav); fclose($fp);

, .
,
. , .
, . 25.
, ( +
fopen). (
, ,
), .

, $met $1. , $i 10 000
(, 10 000 ), $met, :

151

if ( $name_kto == $person ) { $met = $ i ; $i = 10000; }

,
( - ) ,
.

. 25. kto_chat.txt
:
}
$i++;
endwhile;
, , . - 1 , , ;
if

{$met == -1)

$sav = "$name_b~$time~ $ p e r s o n ~ \ n " ;


$fp = f o p e n ( $ f i l e _ l o g c h a t ,
if

($fp)

"a+"};

$fw = f w r i t e ( $ f p ,

$sav);

$kto[] = "$person~$time_nast\n";

fclose($fp);

152

, ? , - (
).
, ,
.
(. 26).

. 26. log_chat.txt

, ,
,
, :
} else { $kto[$met] = "$person~$time_nast\n"; }

, :
, , , . , , .

,
:

153

$sav = implode ( "\n" , $kto);


$sav = str_replace ("\n\n","\n", $sav);
$sav = str_replace ("\n\n","\n", $sav);
, :
$fp = fopen($file_kto_in_chat, "w");
if ($fp) { $fw = fwrite($fp, $sav); fclose($fp); }
?>
, HTML:
<html><headxtitle> </title>
<meta http-equiv="Content-Type"
charset=windows-1251"></head>

content="text/html;

,
. ,
, :
<frameset

framespacing="0"

rows="54,*,70">

<frame name="banner" scrolling="no" noresize target=


"banner" src="banner.phtml">
<frameset

cols="200,*">

<frame name="userlist" target="userlist" src="userlist.phtml"


frameborder="0" scrolling="l">
<frame name="main_window" src="main_window.phtml"
frameborder="0">
</frameset><frame name="msg" scrolling-"no" noresize
target="msg" src="msg.phtml" frameborder="0">
</frameset>
banner.phtml.
, ..

154

:
<html><head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1251">
<style type=text/css>
A { text-decoration: none}
A { color: #FFFFFF}
A:hover {color: #EFEF4B; text-decoration:underline;}
A.mat {color: #FFFFFF}
A.mat:hover {color: #0066FF}
p { font: 8px Verdana }
</style></head>
<body topmargin=0 leftmargin=0 bgcolor=#546A8C>
.
.

.
<table border="0" cellpadding="0" cellspacing="0"
width="90%" align="center"><tr><td>
<font color="white">
</td></tr></table>
</body></html>
,
, .
main_window.phtml. , ,
( ):

155

<? include

{"tools.phtml");

?>

<html><head>
<meta http-equiv="Content-Type"
charset=windows-1251">

content="text/html;

<meta http-equiv=Refresh content="5; URL=main_window.phtml">

, , .
,
.
(. 1), :
<style type=text/css>
body {

scrollbar-face-color:#54 6A8C;
scrollbar-3dlight-color:#FFFFFF;
scrollbar-track-color: #FFFFFF;
scrollbar-arrow-color: #FFFFFF;
scrollbar-border-color:#000000 }
p { font: Verdana; font-size : 12; }
</style>
<body bgcolor=#E7E7E7>

30 :
<p>
<?
$user = file ($file_logchat);
$i = count($user) ;

156

$fi = $i - 30;
if {$fi < 0) { $fi = 0; }
while ($i >= $fi):
30:
l i s t ($name, $ t i m e _ n a m e , $msg, $komu) = s p l i t
t r i m ( s t r _ r e p l a c e ( " \ n " , " " , $user [ $ i ] ) ) ) ;

("~",

, ,
.
:
if ($name and $msg) {
if {!$komu or $komu == $person) {
if (!$komu) {
echo "<small>$time_name>
</small> <b>$name</b> $msg<br>";
} else {
echo "<small>$time_name>
</small> <b> $name $komu:</b> $msg<br>";
}
}
}
, - , . .
$i-;
endwhile;
?><br></body></html>
.

157

msg.phtml.
,
, ,
.
.
,
. ,
, .
<? include ("tools.phtml"); ?>
<html><head><meta http-equiv="Content-Type" content="text/
html; charset=windows-1251">
<style type=text/css>
input.button {
border-style:solid;
border-width:1px;
border-width-color:#546A8C;
width:80px;
height:20px;
font-family: Verdana;
font-size: 10px;
color: #000000;
font-size: 10px;
background: #E7E7E7
}
p { font: 8px Verdana }
body { font: 12px Verdana }
</style>

158


:
<?
$kto = file ($file_kto_in_chat);
$fi = count($kto); $met = -1; $i = 0;
while ($i <= $fi):
$str = trim(str_replace ("\n","", $kto [$i]));
if ($str) {
list ($name_kto, $time_kto) = split ("~", $str);
if ( $name_kto == $person ) { $met = $i; $i = 10000; }
}
$i++;
endwhile; ?>
, .
,
, .
:
<base target="msg">
</head>
<body leftmargin="0" topmargin="8" bgcolor="#546A8C">
<? if ($met != -1) { ?>
<form method="POST">
&nbsp;&nbsp;&nbsp;&nbsp;
<input maxlength="500" type="text" name="msg" value=""
size="20">
<input type="submit" value="" class="button">

159

(. 27).

. 27.
500. ; , .
, , , :
<? if ($fi > 2 )

{ ?>

<select name=komu>
<option value="" selected>Koy</option>
<?
$i = 0; while ($1 < $fi) :
$str = trim(str_replace ("\n","", $kto[$i]));
if ($str != "") {
list ($nik) = split ("~", $str);
if ($nik != $person) {
echo "<option value=\"$nik\">$nik</option>";
}

160

}
$i++;
endwhile;
echo "</select>";
}
,
. . , ,
.

: , , ,
:
}

if ($met != -1) {
if {$msg and $person) {
$sav = "$person~$time~$msg~$komu\n";
$fp = fopen($file_logchat,

"a+");

if ($fp) { $fw = fwrite($fp, $sav); fclose($fp); }


. . .
(
), :
if

($komu)

$sav = " $ k o m u ~ $ t i m e ~ $ m s g ~ $ p e r s o n \ n " ;


$fp =
if
}

($fp)

fopen($file_logchat,

"a+");

{ $fw = f w r i t e ( $ f p ,

$sav);

fclose($fp);

161

,
, , , .
, :
}
} e l s e { echo "&nbsp;&nbsp;&nbsp; !"; }
?></form></body></html>
, . ,
.
, , ,
.
.
userlist.phtml.
. .
, ,
. , ,
:
<? include

("tools.phtml"};

?>

<html><head>
<meta http-equiv="Content-Type"
charset=windows-1251">

content="text/html;

, :
<meta http-equiv=refresh content="15; url=userlist.phtml">
15 , .
,
. , , (, ) ,
, . -

162

,
,
,
.
:
<base target=userlist></head>
<style type=text/css>
body {
scrollbar-face-color:#546A8C;
scrollbar-3dlight-color:#FFFFFF;
scrollbar-track-color: #FFFFFF;
scrollbar-arrow-color: #FFFFFF;
scrollbar-border-color:#000000
}
p { font: 10px Verdana }
td { font: 10px Verdana }
</style>
<body topmargin=0 leftmargin=0 bgcolor=#546A8C>

:
<form method="POST" target="_self">
<table border="0" width="100%" height="100%">
<tr><td width="8%"></td>

<td width="87%" bgcolor="#E7E7E7" valign="top">


<table border="0" width="100%"><tr>
<td width="100%" height="100%">
<big>B :</big><p>

163

:
<?
$kto = file ($file_kto_in_chat);
$fi = count($kto); $met = -1; $i = 0;
while ($i <= $fi):
$str = trim(str_replace ("\n","", $kto [$i]));
if <$str) {
list ($name_kto, $time_kto) = split {"~", $str);
if ( ($time_nast-$time_kto) > $chat_number)
{
$kto [$i] = "";
$sav = "$name_rob~$time~ $name_kto~\n";
$fp = fopen{$file_logchat, "a+") ;
if ($fp) { $fw = fwrite($fp, $sav); fclose($fp); }
}
, .
.
, .
,
2030 . ?
:
if ( $name_kto == $person )
{
$met = $i;
echo "<b>$name_kto</b><br>";
} else {
echo "$name_kto<br>";

164

}
}
$i++;
endwhile;
.

:
if {$met == -1)
{

echo "<> !";


} else {
$kto [$met] = "$person~$time_nast\n";
}
,

.
:
$sav = implode("\n", $kto);
$sav = str_replace ("\n\n","\n", $sav);
$sav = str_replace ("\n\n","\n", $sav);
$fp = fopen($file_kto_in_chat, " w " ) ;
if ($fp) { $fw = fwrite($fp, $sav); fclose($fp); }
?>

, -

165

, .
.
, , , , :
<br><a href="userlist.phtml"></>
</td></tr></table></td></tr>
</table></body></html>

, . !


, , .

.
, .
, ,
, . ,
.
,
, ,
, -
. , ,
.
, ,
( , ),

166

, .
.
,
. . , ,
, - .
.
(
). , .
, .

, Unix (. 6).

. . Unix :
Unix , .

.
.
,
.
, , .
.

167

,
.
, , ,
.
, , , GET. (, ) POST.
.
, ,
.
, ..
, , ( ), ,
.

, ,
. , , .
, , .
.
Unix:
$time = time(void);

,
:
$file = " ".$time.".phtml";
, ,
,
.

168

,
:
$sav = "<? /* * $person * * $kto * \n";
$person $kto
.
$sav :
//
$file = " , ";
$sav = ", ";
$fp = fopen ($file, " w " ) ; //
if($fp)
{
$fw = fwrite ($fp, $sav); // ,
fclose($fp);

//

}
else
{
/*
*/
}
, ,
, .
, , , .


. ,

169

,
. , , .
,
Unix.
.
.
, .
, , ,
. ,
. ,
, ,
.
,
, , . . , , GET. ,

.
,

.
.
. .
. - , , .

170

, . .
.

-

- , ,
. , ( , ,
-) . ,
1000 . , , .
, , , ,
..
,
, .

. , .
, . , , . ,
,
.
Excel ( ,
, , 1: , ,
Excel).
,
.

171

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

Excel ( ), , , ,
, . , . , ,
,
:-) , .
? , , . ,

. ( Excel) - . , ,
, , . ,
, .
Excel .
.
,
. .
: *.txt,
( Enter), . ,
Excel.

-,
.
, ,
.

172

, , , ..
,
, , ,
. ,
.
,
.
:
$file = "price.txt";
$tovar = file ($file);
$tovar [] :
$i = 0; //
while ($i < count ($tovar)) : //
//
echo $ t o v a r [ $ i ] ; //
echo "<br>"; //
$i++; //
endwhile; //
. , ,
,
. .

.
. , ,
. , ,

173

. , . .
, , ,
, ,
, .
. . , ,
.
, ,
: .
. , , ,
,
.
, - , , ,
, , , , ..
:
.
.
.
,
. . , .
, : $n_1, $n_2, $n_3,
$n_4, $n_5. ,
$ t o v a r [ $ i ] , :

174

l i s t ( $ n _ l , $n_2,
$tovar[$i]) ;

$n_3,

$n_4,

$n_5)

split

<"\t",

, .
, " \ t " .
,
. -,
.
. ,
, -.
-? , . ?
, ,
,
, ( ).
, .
, ?
, .
: , ? , . , , . :
, ,
, ..
,
.
, ,
.

175

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

.
:
$file = "price.txt";
$as = file ($file);

:
$info = $as[$id];

$ i d , . ,
, ,
.

. 1.
(

176

, ) . . HTML-
, Enter.
,

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

. ,
.
, (
, cookie) . , .
, .
. . ,
.
,
. . . , , .. (,
). . . -

177

, .
.
, .
. .
. : _@_
.
, .
SMS ,
, .
, ,
. .
-
,
-,
,
. ,
.
.

, . .

178

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

GD, . GD
php.ini, Windows (. . ).

, - .
,
. , banner.
, , ,
. ,

. :

179

$dir = opendir ("banner/");


while($f = readdir($dir))
{
if

(!stristr($f,"..")

and

$f

!=

".")

{ $ t t [ ] = $f; }
} }


, , $ t t .
, , , ( ).
, ,
.

. , cookie .
:
$ t t l = file ( "counter.php" );
$str = trim(str_replace ( " \ n " , " " , $ t t l [ 0 ] ) ) ;
$str++;
if ($str >= count($tt) or $str < 0} { $str = 0; }
( ),
,
. ,
.
, . , , .
:
$fp = fopen("counter.php",

if

($fp)

"w");

$fw = fwrite($fp,

$str);

fclose ($fp);

180

,
. , . , ,
. ,
. , , ,
.
:
$str1 = trim{str_replace (".","~", $tt[$str]));
@list ($id_price, $id_ras) = split("~", $str1);
, , . .
, , , :
if ($id_ras == "jpg" or $id_ras == "jpeg") {
echo "<img border=0 src=banner/$tt [$str]>"; } else {
,
:
@$siluro++; }
, , ,
, , , ,
, . . ,
, .
:
$temp_siluro = @$siluro;
if {@!$siluro} {
,
, $ s i l u r o .

181

:
if (@$siluro != $temp_siluro
include("mini.phtml"); }

and

$siluro

<

50)

, , ,
mini.phtml, include ( " m i n i . p h t m l " ) ; . , -
, ,
. .

, ,
, ..
.
chitatxt.php ,
. :
, , .
, , .
, ,
:
$nomer = 1;
$file = "chitatxt.php";
$ i i = 0;

$ t t = f i l e ( $file );
$qw = count ( $ t t ) ;

, :
while ($ii < 4 ) :

;
, . ,
.

182

, :
$nomer++;
@$str = trim($tt[$nomer]);
list ($data, $add, $txt) = split ("~", $str);
:
echo "<b> $data</b> <a href=\"$add\"><br>$txt </a>";
:
$ii++;
endwhile;
. ,
, , .

, ? , ,
, ,
. ,
, ,
:
<?
$dir = opendir("news/");
while ($f = readdir($dir))
{
if (stristr($f,".html"))
{ $li[] = $f; }
}

183

, ,
, .
$i = 0; while ($i < count ( $ l i ) ) :
include

{"news/$li[$i]");

echo "<br><hr noshade s i z e = l > " ;

$i++;
endwhile;
?>

, . , .

- , .
, ,
. , .
Excel
: , , . ,
.. , , ,
(. 28).
Excel , , (. 29).
,
, (. 30).

.

184

. 28. Excel

. 29. Excel

. 30.

185

, ,
.
,
.
:
,
:
<form method="POST"
name="pop" action="cena.phtml"
title="

">

SUBMIT , , n.phtml.
.
read.phtml:
<?
$file = $DOCUMENT_ROOT."/$path/price.txt";
$as = file ( $file );

( $as) price.txt, . , $ f i l e =
$DOCUMENT_ROOT."/$path/price.txt";
, ,
,
$DOCUMENT_ROOT , , $path, .
.
,
$path. , .
, ,
:

186

$ip=getenv("REMOTE_ADDR");
if ($ip != "127.0.0.1") { error_reporting(0); }
, IP- , .. , , , , ,
.

, :
$i = 1;
while ($i < count($as)):
$str = trim(str_replace ("\n","", $as[$i]));
$str = str_replace ("\t","~", $str);
$str = str_replace ("\"","", $str);
list ($n_l, $n_2, $n_3) = split ("~", $str);
$n_l = str_replace <",",".", $n_l);
$n_2 = str_replace (",",".", $n_2);
$as[$i] = "$n_l~$n_2~$n_3~$n_4~$n_5";
$as[$i] = str_replace (",",", ", $as[$i]);
$as[$i] = str_replace (" "," ", $as[$i]);
$i++;
endwhile; ?>
, , ,
, , ,

187

( Excel
, ). ,
read.phtml ,
.
minor.phtml. :
<?
$str = str_replace ("\n","", $as[$q2]};
@list ($n_l, $n_2, $n_3) = split ("~", $ s t r ) ;
?>
$q2 , ,
( $n_1, $n_2 $n_3). , .
,
:
<? include ("read.phtml"); ?>
<table><tr><td></td>
<td></td>
<td></tdx/tr>
<tr><td>
<?
$q2 = 0;
include

("minor.phtml");

echo $n_l;
?>: </td><td>
<select name="ur0" size="l">
<option value=all

selected>

</option>
<?

188

$ii =1; $i = 1; $s = count($as);


while ($i < $s) :
$q2 = $i; include ("minor.phtml");
if ($n_2 = "" and Si) {
, ,
.
, .
.
:
echo "</select><br></td></tr><tr><td>$n_l:</td><td>
<select name=ur".$ii." size="l">
<option value=all selected>
</option>";
$ii++; }
, :
else {
if ($n_l)

echo "<option value=\"$i\">".$n_l.":".$n_3. "</option>";


} else { echo "</td><td></td></tr>"; }
}
: HTML. ,
-.
:
$i++;
endwhile;
?></select></td></tr></table>

189

<br><input type="hidden"
$ i i - l ; ?>">
&nbsp;<input
"

name="nom"

TYPE="submit"

value="<?

VALUE="

echo
-

NAME="B3"></form>
, .
, cena.phtml.
<h> </h3>
<? include

("read.phtml");

read.phtml .
$i = 0;
$n_11 = 0;
while ($i <= $nom):
$nu = " u r " . $ i ;
if ($$nu != " a l l " )

$q2 = $$nu; include ("minor.phtml");

$n_ll = $n_l+$n_ll;

$i++;
endwhile; ?>

<font

color=red>".$n_ll."</font>

<br><a href=servis.phtml>
</>
,
, , .

190

, $nu ur5,
$nu $ur5. :
$ur5 = 1 0 ;
$nu = "ur5";
echo $nu;
10.
. , $nom, :
. , , . , , ,
.


, . , , , ,
.
: -, ,
. -, .
, , ,
.
, ,
.
.
html , zip ,

191

, , ,
(
,
). html zip .
, , .
,
. , , , . ,
.
$katalog_archiv = "archiv/";

, . , .
, , .
:
$name_temp = "Archiv_News!_";

,
,
. , ,
:
___
: html, zip txt.
html, txt.

txt:
$dir_archiv = opendir{$katalog_archiv);
while($f = readdir($dir_archiv))
{

192

,
, .
,
:
$f1 = trim{str_replace (".","~", $f) ) ;
@list ($id_name, $id_ras) = split ("~", $f1);
, , , , ,
:
if

($id_ras == " t x t " )

//

,
. ,
:
$f2 = trim(str_replace ($name_temp,"", $f));
$f2 = trim(str_replace (".txt","", $f2));
$f1 = trim{str_replace ("_","~", $f2));
@list ($den, $m, $god) = split ("~", $f1);
$q[] = "";
$q[] = "";
$q[] = "";
$q[] = "";
$q[] = "";
$q[] = "";
$q[] = "";

193

$q[] = "";
$q[] = "";
$q[] = "";
$q[] = "";
$q[] = "";
$q[] = "";
if ($m == "01") $m = 1;
if ($m == "02")

$m = 2;

if ($m == "03")

$m = 3;

if ($m == "04")

$m = 4;

if ($m == "05")

$m = 5;

if ($m == "06")

$m = 6;

if ($m == "07")

$m = 7;

if {$m == "08") $m = 8;
if ($m == "09") $m = 9;

$m = $q[$m];
, - .
:
echo "<><b> $den $m 20$god : </b><br>
:<br><br>";
:
include

("$katalog_archiv$name_temp$f2.txt");

, HTML- . :

194

echo"<br><br><a
href=$katalog_archiv$name_temp$f2.html>
</> - <a href=$katalog_archiv$name_temp$f2.zip>
</></>";
, :
} }
, , . , html zip txt,
, . ,
.


. : ,
. .
.
: ?
, , . ,
- , ?
.
. ,
, , . . ,
. , .
. , ,
.

195

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

,
,
.
- , , , .htacces
.
, :
<h5>0 npac</h5>
<form name="diler_vhod" method="post" action="diler.phtml">
<b> :</b><br>
<input name="diler" type="password">
<input type="submit" value="Bxo">
</form>
(. 31) , , , , .

196

. 31.
:
<?
$add_price = "memo/price_diler.zip";
.
, .
$pass = "3467899";

, .
, ,
. , :
$no_file = "";

:
if ($diler == $pass)
{ header ("Location: $add_price"); }
else { header ("Location: $no_file"); }
?>

197

, ,
. , , ,
, ,
, , .
HTTP-
HTTP-
Apache- , , CGI-.
- Apache- header () Authentication Required
,
.
, -
$PHP_AUTH_USER, $PHP_AUTH_PW $PHP_AUTH_TYPE,
, , . , :
<?php
if

(!isset($_SERVER["PHP_AUTH_USER"]))

header("WWW-Authenticate: Basic realm=\"My Realm\"");


header("HTTP/1.0 401 Unauthorized");
echo ", ,
Cancel\n";
exit;
} else {
echo "<> {$_SERVER[`PHP_AUTH_USER`]}.</p>";
echo "<> {$_SERVER[`$PHP_AUTH_PW` ] } . < / p > " ;
}
?>

198

, ,
, . , " B a s i c "
, realm ( ), " 4 0 1 "
" / 1 . 0 401" .


( ,
) , : ,
. , ,
,
.
. , ,
. - ( ). . ,
:
f i l e s i z e (name_file). :
$ewq = "index.phtml";
$lo_call = 6507;
,
, . . $1_11 , ,
(, ?). , .
.

199


?
.
, . 1994 , .
( ) HTML. ,
, <?php ?>
- HTML?
, . HTML-
-, .
HTML : < s c r i p t
language="php">, , , : < / s c r i p t > .
, - .
, -?
. , , php, php3, php4 phtml. , . , SSI?
shtml.
, .
,
-.
?
. ,
, -

200

. , . ,
.
, , .
, . ,
, . , Apache, , , .
. Apache,
(. . ). .
, 127.0.0.1.
, , ..
?
- .
: php.exe -f index.php | more.
, .
? , , ,
, .
, .
. FTP-
. , , . . 666 777. , .
php,
- ?
- (
, ), . -

201

, . ,
.

.
?
, ,
a d d s l a s h e s (), .
(, ). , .
magic_quotes_gpc
( ON).

?
<?php p h p i n f o (); ?> ,
, ,
, Web-.

, .

CGI ( $DOCUMENT_ROOT $HTTP_REFERER)
, . ?
, (, ,
" g l o b a l $ D O C U M E N T _ R O O T ; " ) (.. "$GLOBALS ["DOCUMENT_ROOT"] " ) .
HTML- <form>?
,
- -,
<input>, < s e l e c t > < t e x t a r e a > :

202

<input name="Array[]">
<input name="Array[]">
<input name="Array[] ">
<input name="Array[]">
,
, .
, :
<input name="Array[]">
<input name="Array[]">
<input name="OtherArray[]">
<input name="OtherArray[] ">
Array OtherArray,
-. :
<input name="AnotherArray[]">
<input name="AnotherArray[]">
<input name="AnotherArray[email]">
<input name="AnotherArray[phone]">
AnotherArray 0, 1, email
phone. , , .

?
.
, ,
: .
- , . - , , . :

203

and

for

array()

foreach

as

function

break

global

case

if

cfunction

include ()

class

include_once()

const

isset ()

continue

list ()

declare

new

default

ld_function

die()

or

do

print()

echo()

require ()

else

require_once ()

elseif

return ()

empty()

static

enddeclare

switch

endfor

use

endforeach

var

endif

while

endswitch

xor

endwhile

CLASS

eval

FILE

exit ()

FUNCTION

extends

___LINE__

204

- ,
, ?
, ,
$ = intval($a);
100 % , $ . :
"" -> 0
"123" -> 123
"123" -> 123
"123.55" -> 124
,
doubleval (), s t r v a l () ..

1. HTML CSS
HTML (HyperText Markup Language) . ? , , ,
, .


. ,
, .

. .
, , ..
, . , .

. HTML < c e n t e r > .
.
</center>. , HTML- . :
<center> < / c e n t e r >
HTML:
< >;
, ();

206

, , ;
, , , ..
.
, .
, .
. , , <br>, - <hr>, ( ) ..
, .
HTML-
HTML.
(CSS, Cascading
Style Sheets).
,
HTML.

2.

.
if () {}else{} , , .
, , , , , . :
Parse error: parse error in c:\usr\local\public_html\
host:\virtual\index. phtml on line 2


. .
, , .

2.

207

. , .
:
.
if () {}else{}
. .
.
?> , , .
. ,
, ,
. .
, : $user , $User. . -
.
( , ) : .
.
? , HTTP (HyperText Transport Protocol,
HTML, .. ). , HTTP- ,
, .
HTTP- .
,
, . ,
, ,
.
,
, , , cookie ..

208

.
:
Warning: Cannot add header information - headers
already sent by (output started at /site/name.phtml:3)
on line 5.

,
. ,
(output s t a r t e d at / s i t e / n a m e . p h t m l : 3 ) , - . , . , HTML-, ,
echo, ,
< ?
,
include -
, -. . header () ( s e s s i o n _ s t a r t (),
s e t c o o k i e ()) .
.

3.

a d d s l a s h e s . : s t r i n g a d d s l a s h e s ( s t r i n g s t r ) ;
,
.. : ('),
("), (\) .
chop . : s t r i n g
chop ( s t r i n g s t r ) ;
s t r , .
c o n v e r t _ c y r _ s t r i n g
. : s t r i n g

3.

209

convert_cyr_string(string str, string from, string

t o ) ; from to , . :
k koi8-r;
w windows-1251;
i iso8859-5;
a x-cp866;
d x-cp866;
m x-mac-Cyrillic
echo . :
echo { s t r i n g a r g 1 , s t r i n g [argn] . . .) ; . ( ),
. :
<?
echo ", !"; /* ",
" */?>
<?
echo " .
.";
?>
:
<?
$ = 5;
$b = 3;
$ = 4;
$d = $ + $b - $;
echo $d;
?>

210
4.
<?
echo "$d";
?>

:
$d
explode . :
array explode(string separator, string string [,

int limit]); , , s e p a r a t o r . l i m i t .
:
$pizza = "piece1 piece2 piece3
piece6";
5pieces = explode(" ", $pizza);

piece4

piece5

get_meta_tags . :
array get_meta_tags (string filename, int [use_include_path]) ;
filename, . :
<meta name="author" content="name">
<meta name="tags" content="php3 documentation">
name , c o n t e n t ,
.
'_', . u s e _ i n c l u d e _ p a t h 1 ,

include.

3.

211

h t m l e n t i t i e s
HTML. : string htmlentities (string string);
htmlspecialchars (),
, HTML
HTML-. ISO-8859-1.
htmlspecialchars
HTML. : s t r i n g htmlspecialchars
(string string) ;
HTML HTML,
.
. HTML ( , ).
:
& () &m;
" ( ) &quot;
< ( ) &lt;
> ( ) &gt.
, ,
.
h t m l e n t i t i e s ().
implode . : string implode(array pieces, string glue); -

,
, glue
.
:
$array = array("lastname", "email", "phone");
$a = implode(",", $array);
echo $a;
?>

212

:
lastname,email,phone

join implode
ltrim . :
string ltrim(string str);

nl2br HTML-
. : s t r i n g nl2br (string
s t r i n g ) ; s t r i n g <br>,
.
parse_str . :
void parse_str (string str); s t r ,

URL- , .
:
<?php
$str = "first=value&arr[]=foo+bar&arr[]=baz";
parse_str($str) ;
echo $ f i r s t ; // value
echo $ a r r [ 0 ] ; // foo bar
echo $ a r r [ l ] ; // baz
parse_str {$str, $output) ;
echo $ o u t p u t [ ` f i r s t ` ] ; // value
echo $ o u t p u t [ ' a r r ' ] [ 0 ] ; // foo bar
echo $ o u t p u t [ ' a r r ' ] [ 1 ] ; // baz
p r i n t . : p r i n t {string
arg) ; echo.

rawurldecode , % . :
s t r i n g rawurldecode(string s t r ) ; ,
admin%20log%40name admin log@name.

3.

213

strlen . : int
strlen(string str); :
<?php
$str = "abcdef";
echo strlen($str);

6.
str_replace . : mixed
str_replace(mixed

search,

mixed

replace,

mixed

subject); search
subject replace
.
:
<?
$string = " ";
$strnew = str_replace("", "", $string);

$strnew
.

strcmp (). : int strcmp(string str1, string str2);

<0, s t r 1 str2;. > 0, s t r 1


str2, 0, . ,
.
stripslashes . :
string stripslashes (string str);

s t r . (\" " ..).


\\ \. :
<?php
$str = " \"?";
echo stripslashes ($str);
?>
:
'?

214

strrpos
. : i n t strrpos (string haystack,
char needle) ; needle haystack. , needle . needle
, .
needle , false.
needle ,
.
s t r r c h r .
: string s t r r c h r (string haystack, s t r i n g
needle) ; haystack, needle haystack. false, needle
. needle , . needle
, . :
// $
$dir = substr( strrchr( $, ":" ), 1 );
/*
*/
$text = "Line 1\nLine 2\nLine 3";
$last = substr ( strrchr( $text, 10 ), 1 );

s t r r e v . : s t r i n g
s t r r e v ( s t r i n g s t r i n g ) ; :
<?php
echo strrev (", ! " ) ;
?>

:
!,
strstr . :
string strstr(string haystack, string needle); haystack needle

3.

215

. needle ,
false. n e e d l e , .
:
<?php
$address = "utc@yandex.ru";
$a = s t r s t r ( $ a d d r e s s , "@");
echo $a;
?>

:
@yandex.ru
strtok . : s t r i n g
s t r t o k ( s t r i n g arg1, s t r i n g arg2); ,
This is an example string ,
:
$string = "This is an example s t r i n g " ;
$tok = s t r t o k ( $ s t r i n g , " ") ;
while($tok) { echo "Word=$tok<br>"; $tok = strtok(" ");}
:
This
is
an
example
string

,
s t r t o k . s t r t o k ,
.
, s t r t o k -

216

.
.
.
, 0. .
s t r t o l o w e r . : s t r i n g s t r t o l o w e r ( s t r i n g s t r ) ; s t r i n g ,
. , .
:
<?php
$ = " ";
$ = s t r t o l o w e r ( $ ) ;
echo $a;
?>


strtoupper . : s t r i n g s t r t o u p p e r ( s t r i n g s t r i n g ) ;
s t r i n g , . ,

.
:
<?h

$ = " ";
$ = strtoupper $a);
echo $a;
?>
:

3.

217

s t r t r . :
s t r i n g s t r t r ( s t r i n g s t r , s t r i n g from, s t r i n g t o ) ;
: $addr = s t r t r ( $ a d d r , "", " " ) ;
s t r , from
to, . from to
,
.
substr . : s t r i n g
s u b s t r ( s t r i n g s t r i n g , i n t s t a r t , i n t [ l e n g t h ] ) ;
s t r i n g , s t a r t () length ().
s t a r t , , s t a r t
s t r i n g . :
$rest =

substr("abcdef",

1); // "bcdef"

$rest = substr ("abcdef", 1, 3 ) ; // "bed"


s t a r t ,
, s t a r t
s t r i n g . :
$rest = substr ("abcdef",

-1);

// "f"

$rest = substr("abcdef",

-2);

// "ef"

$rest = substr("abcdef", - 3 , 1); // "d"


length , length
s t a r t . ( ),
s t a r t . length , length s t r i n g .
,
s t a r t . :
$ r e s t = substr("abcdef", - 1 , - 1 ) ; // "bede"

218

trim . : s t r i n g t r i m ( s t r i n g s t r ) ;
u c f i r s t . : s t r i n g u c f i r s t (string s t r ) ;
s t r , . , .
:
$ = ", !";
$ = ucfirst ($foo);
:
, !

ucwords . : s t r i n g ucwords (string


str);
s t r , .
:
$foo = ", !";
$foo = ucwords($foo);
:
, !


basename . : s t r i n g basename (string p a t h ) ; ,
, . Windows (/) (\) .
(/).
$path = "/home/httpd/html/index.php3";
$file = basename($path); /* $file
"index.php3"*/

3.

219

. : i n t copy ( s t r i n g
source, s t r i n g dest) ; t r u e , false. :
if

(!copy($file,

$file.'.bak'))

print(" $file . ..<br>\n");


}

, $file
, :
$file ...
dirname , . : s t r i n g dirname (string path) ;
, ,
, . Windows
(/) (\)
. (/).
:
$path = "/etc/passwd";
$file = dirname($path) ; // $file " / e t c "
fclose . : i n t
fclose (int fp); ,
fp . true false .
,
fopen () fsockopen ().
feof , .
: int feof(int fp); true,
EOF (End Of File, ) . false.
, fopen (), n () fsockopen ().

220

fgetc . : s t r i n g
fgetc(int fp); , , fp. EOF false. , fopen (), popen (),
fsockopen().
fgets . :
s t r i n g fgets (int fp, i n t length);
length ,
fp. , length , ,
EOF. .
false.
, fopen (),
popen () fsockopen ().
fgetss HTML-. : s t r i n g
fgetss(int fp, i n t length); fgets (), , HTML- -
.
f i l e . :
array f i l e {string filename); ( ) .
fileatime . : i n t fileatime (string filename); false .
filectime
Unix. : i n t filectime (string filename);
false .
Unix.
file_exists .
: i n t f i l e _ e x i s t s ( s t r i n g filename); true, , filename, ; false. ,

3.

221

,
.
:
<?php
$filename = "/path/to/my.txt";
if (file_exists ($filename) ) {
print " $filename ";
} else {
print " $filename ";
}
?>
, ,
:

my.txt
:

my.txt
filemtime , Unix. : i n t
filemtime (string filename) ; false
. : $filename = "my.txt"; my.txt.
filesize . : i n t f i l e s i z e (string
filename); false .
filetype . : s t r i n g
filetype (string filename); false. : fif, char, dir, block, link, f i l e , unknown.
fopen URL. : i n t
fopen (string filename, s t r i n g mode); filename
" h t t p : //" ( ),
HTTP- .
. filename

222

" f t p : / / " ( ), FTP- .


FTP, . , FTP
( ). filename - ,
, .
, f a l s e . mode
:
r ,
;
r+ , ;
w ,
.
, ;
w+ , .
, ;
,
. ,
;
+ , . , .
:
$fp = fopen("/home/rasmus/file.txt", " r " ) ;
$fp = fopen("http://www.php.net/", " r " ) ;
$fp = fopen("ftp://user:password@example.com/", "w") ;

, ,
-

3.

225

. Windows
, , :
$fp = f o p e n ( " c : \ \ d a t a \ \ i n f o . t x t " , "r") ;
fpassthru . : i n t fpassthru (int fp) ; EOF
. false. , fopen (), popen () fsockopen ().
fputs . : i n t fputs (int
fp, s t r i n g s t r , i n t [ l e n g t h ] ) ; fputs () fwrite ().
fread . :
s t r i n g fread (int fp, i n t l e n g t h ) ; , fp length. , length EOF.
fseek . : i n t
fseek(int fp, i n t o f f s e t ) ; fp offset .
fseek (fp, offset,
SEEK_SET). 0, 1. EOF . , fopen(),
" h t t p : / / " " f t p : / / " .
fwrite . :
i n t f w r i t e ( i n t fp, s t r i n g s t r i n g , i n t [ l e n g t h ] ) ;
s t r i n g , fp. length , ,
length, s t r i n g .
length,
magic_quotes_runtime s t r i n g .

224

is_dir ,
. : bool is_dir ( s t r i n g filename);
true, filename .
is_executable , . : bool is_executable (string
filename) ; true, filename
.
is_file ,
. : bool is_file (string filename);
true, filename
.
is_link ,
. : bool is_link ( s t r i n g filename) ;
true, filename .
is_readable , . : bool is_readable (string
filename) ; true, filename
. , ,
.
is_writeable , . : bool is_readable (string
filename); true, . ,
, .
link . : i n t
link{string target, string link);

mkdir . : i n t mkdir
(string pathname, int mode); , pathname. ,
mode ,
0. :
mkdir("/path/to/my/dir",

0700);

3.

225

true .
pclose , popen (). : i n t pclose (int
fp) ; ,
pf . , popen ().
readfile
. : i n t r e a d f i l e (string
filename) ; . false
readfile @,
. filename " h t t p : / / " (
), HTTP- .
. filename " f t p : //" ( ), FTP- . ftp,
. filename
- ,
.

readlink . : s t r i n g readlink (string p a t h ) ; readlink


path 0 .
rename . : i n t
rename (string oldname, s t r i n g newname) ; , oldname newname.
true false
.

rewind . :
i n t rewind (int fp);
fp .

226

0. ,
fopen ().

rmdir . : i n t rmdir
(string dirname) ; ,
dirname.
. 0.
s t a t . : array
s t a t ( s t r i n g filename);
filename , , :
device ();
number of link ( );
user ID owner (ID );
group ID owner (ID );
size in bytes ( );
time of last access ( );
time of last modification ( );
number of blocks allocated ( ) ..
l s t a t
. : array l s t a t (string filename) ;
filename. s t a t (),
filename l s t a t ,
, ,
.
, ,
s t a t .
symlink . : i n t
symlink(string t a r g e t , s t r i n g link) ; , target, , link.

3.

227

tempnam . :
s t r i n g tempnam(string d i r , s t r i n g p r e f i x ) ;
. , tempnam () .
.
touch . : i n t touch(string filename, i n t t i m e ) ; filename time. time , . , .
true false .
cookie
setcookie ("name", $data, $y) cookie
name $data. $ , cookie
. $ mktime.
setcookie ("name") cookie name. , ,
cookie, cookie, $data
$ .

session_destroy . : bool session_destroy(void) ; cookie,


. true ,
false.

session_is_registered ,
. : bool
session is r e g i s t e r e d ( s t r i n g name);

228

session_regenerate_id ID
. : bool
session_regenerate_id(void) ; t r u e
, false
.
session_register . : bool
session_register (mixed name); t r u e ,
.
session s t a r t , SID, cookie POST GET. : bool
s e s s i o n _ s t a r t (void); true.
cookie,
session_start

,
.
session_write_close . : void session_write_close
(void);
session_unregister
name . : bool
session_unregister ( s t r i n g name); t r u e
.
session_unset
. : void session_unset (void)

array_sum . : mixed array_sum (array a r r a y ) ; , ..
. :
$ = array (5,7,10,1) ;
echo array_sum($a);
23.

3.

229

count .
: i n t count (mixed var [, i n t mode]) ;
, . :
$[0] = "Hello";
$[1] = 3;
$[2] = 5;
$[3] = "World";
$result = count($time);
echo

$result

4.
in_array . : bool in_array (mixed needle, array
haystack[,bool s t r i c t ] ) ; true, needle haystack,
false. bool
s t r i c t true,
needle. :
<?
$new = a r r a y ( " H e l l o " , "NTT", "World", "New");
if

(in_array

("NTT",

$new))

print " NTT $new \";


}
?>

in_array true,
,
" NTT array "
end . : mixed end ( array array).

230

next
(.. )
,
f a l s e , .
, f a l s e
. : mixed next ( a r r a y a r r a y ) .
prev
(.. ) false, .
, f a l s e . : mixed prev ( a r r a y a r r a y ) .
reset . : mixed r e s e t ( a r r a y a r r a y ) ;
current , . :
mixed c u r r e n t ( a r r a y a r r a y ) ;
. , c u r r e n t ( ) f a l s e .
(0 ),
f a l s e .
sort , . : bool s o r t ( a r r a y array)
:
<?php
$animals = array ("dog", "camel", " c a t " , "giraffe");
sort($animals);
reset($animals);
while (list($key, $val) = each($animals)) {
echo " f r u i t s [ " . $key . "] = " . $val . "\n";
}
?>

:
animals [0] = camel
animals [1] = cat

3.

231

animals [2] = dog


animals [3] = giraffe
rsort ( ). : bool rsort ( array array) ;
:
<?php
$animals = array("dog", "camel", "cat", "giraffe");
rsort($animals) ;
reset($animals) ;
while (list($key, $val) = each($animals)) {
echo "$key = $val\n";
}
?>
:
0 = giraffe
1

dog

cat

3 = camel


checkdate /. : bool checkdate ( i n t month, int day, int
year); t r u e , ,
false.
d a t e / . : $date
= date ("") ; ,
. :
a "am" "pm";
"AM" "PM";
. AM (Ante Meridiem) , PM (Post Meridiem) . {. .)

232

d , , (
);
D , , , " F r i " ;
F , , , " J a n u a r y " ;
h , , 12- , ;
H , , 24- , ;
i , , ;
j , , ;
1 ( L) , , , " F r i d a y " ;
m , ;
, , , " J a n " ;
s , , ;
S , , , " t h " , "nd" 1 ;
U Unix, .. 1 1970 ;
Y , , ;
w , , " 0 " ;
, , ;
z , , "299".
, , d D.
mktime Unix,
, Unix (1 1970 ) .
: i n t mktime ( i n t hour, i n t m i n u t e , i n t
second, i n t month, i n t day, i n t year) ; :
,
second (), seventh (). (..)

4. Cookie

233

mktime(0,0,0,12,31,1997);

, 1970 0:00 31 1997 .


time ,
Unix. : i n t t i m e (void) ;

4. Cookie
Cookie , . ,
, . , cookie 4 , cookie,
, cookie - , . , ,
...
, , .

cookie,
. , cookie , . cookie,
.
cookie ,
s e t c o o k i e . :
setcookie("",

"");

,
setcookie("name",

"12345");

234

, $name
, 12 345, :
isset

($name);

, .
,
cookie - ( ) ( ),
HTML-. , :
<html>
... cookie...
:
... cookie...
<html>
... ...

, . ,
cookie.
, cookie,
, . :
if (isset ($name)) { ,
} else { , }
,
cookie , ,
. , . cookie.
, cookie . oe-

5. POST GET

235

s e t c o o k i e , cookie , ,
:
$ = mktime(0,0,0,l,l,2005) ;
setcookie("name", "bret", $y) ;
$ , 1 1970 (. 6). ,
mktime ( ) . : , , , ,
. , 1.01.1970. cookie ( , ) 1 2005 .
cookie
, s e t c o o k i e
cookie :
setcookie("name") ;

5.
POST GET
POST , ,
, ,
, .. .
GET , . , ,
index.phtml:
http://myhost.ru/index.phtml?temp=l&qwe=slovo
, ,
. index.phtml $temp $qwe .

236

6. Unix
-, ,
, . Unix. 1 1970 .
,
.. ,
, , .
, Unix , 1 1970 .
mktime. :
mktime(int hour, int minute,
int day, int year)

int second,

int month,

:
mktime(0,0,0,12,31,1997);

, 1 1970 0:00 31 1997 .

scanned and converted to PDF including Bookmarks


by HupBaH9I

:
..
..
..
..
..
02.04.2004.
60x84 ]6. . .
. . . . 13,95. .-. . 10,86.
3010 . 2551
.
310 01.07.2003. , . , . 28, . 112.
: 220050, , / 79.
/: (10-375-17) 211-50-38. E-mail: nk@wnk.biz
:
, ., . 2.
(095) 234-58-53. E-mail: ru@wnk.biz
http://wnk.biz

.
210015, , . -, 4.

. , .
2- ., .
480 , .


CGI-.
,
EditPlus UltraEdit, Apache.
,
, . ,
Web-, .

, .
ISBN 985-475-076-0

:
: (095) 234-58-53, e-mail: ru@wnk.biz
: (10-375-17) 211-50-38. e-mail: nk@wnk.biz

Flash MX 2004
ActionScript 2.0:

.. , ..
446 ., .

Flash MX 2004 ActionScript 2.0 , . ,


,
-. ActionScript 2.0 .
, Flash
.
ISBN 5-94735-035-1

:
: (095) 234-58-53, e-mail: ru@wnk.biz
: (10-375-17) 211-50-38, e-mail: nk@wnk.biz