Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Самостоятел_2(2)

.pdf
Скачиваний:
6
Добавлен:
09.02.2016
Размер:
575.36 Кб
Скачать

 

 

Po

ek o

6.3 -

c

k

e

i ec

c

 

 

oc

 

 

co

c

c

k k)

 

 

 

 

 

 

 

 

 

 

 

 

 

c

 

 

 

 

 

 

LDL*

 

 

k

 

 

 

 

 

 

 

 

 

1.

 

 

 

 

 

 

 

 

 

 

2.

 

 

 

 

 

 

 

 

 

 

3.

 

 

 

 

 

 

 

 

 

 

4.

 

 

 

 

 

 

 

 

 

 

5.

 

 

 

 

 

 

 

 

 

 

T

c c:

 

 

 

 

 

 

 

 

 

1.

©

- }LDL dMo_ls

 

 

)

).,

)//0 *

2.

 

- }

 

 

 

)

6

 

).,,

).44 *

3.

**

- }

 

 

0) 6}

 

 

).,,

)/1. *

 

 

 

 

 

k

e o

 

 

 

 

 

 

©

 

 

 

 

 

*

 

 

 

 

 

)

 

 

 

 

 

 

*

 

 

 

 

$

 

 

 

)

©

 

 

)

 

 

 

 

 

)

 

 

 

*

 

Pcec

ek

c

co

 

k

 

 

 

 

 

 

 

 

 

 

ch^_r*jbj68bngf:

 

 

 

 

 

 

 

<head>

 

 

 

 

 

 

 

 

 

<meta http-equiv="Content-Type" content="text/html; charset="utf-8">

 

 

 

8ncnf_:

8+ncnf_:

 

 

 

 

 

 

 

 

<link type="text/css" rel="stylesheet" href="/css/style.css">

 

 

 

 

</head>

 

 

 

 

 

 

 

 

 

<body>

 

 

 

 

 

 

 

 

 

<div id="container">

 

 

 

 

 

 

 

 

<div id="header">

 

 

 

 

 

 

 

 

<div id="logo">

 

 

 

 

 

 

 

 

 

8b:

8+b:

 

 

 

 

 

 

 

 

</div>

 

 

 

 

 

 

 

 

 

<div id="menu"><i>

 

 

 

 

 

 

 

 

<a href="/index.php">

</a>

|

 

 

 

 

 

 

<a href="/news.php ">

</a>

|

 

 

 

 

 

 

<a href="/about.php ">

</a> |

 

 

 

 

 

 

<a href="/contacts.php ">

</a>

 

 

 

 

 

 

</i>

 

 

 

 

 

 

 

 

 

</div>

 

 

 

 

 

 

 

 

 

</div>

 

 

 

 

 

 

 

 

 

<div id="content">

 

 

 

 

 

 

 

 

8b0:

8+b0:

 

 

 

 

 

 

 

</div>

<div id="footer"><span>Solodov M.</span></div> </div>

</body>

</html>

+css/style.css:

html, body, #container{ margin: 0;

padding: 0; width: 100%;

71

height: 100%;

 

 

 

 

 

 

font - family: Trebuchet MS, Tahoma, sans - serif;

 

 

 

 

}

 

 

 

 

 

 

#logo{

 

 

 

 

 

 

padding: 40px;

 

 

 

 

 

 

background: #99cc99;

 

 

 

 

 

 

widows: 100%;

 

 

 

 

 

 

height: 80px;

 

 

 

 

 

 

}

 

 

 

 

 

 

#logo h1{

 

 

 

 

 

 

color: #ffff66;

 

 

 

 

 

 

}

 

 

 

 

 

 

#menu{

 

 

 

 

 

 

padding: 10px 40px;

 

 

 

 

 

 

background: #669966;

 

 

 

 

 

 

widows: 100%;

 

 

 

 

 

 

height: auto;

 

 

 

 

 

 

}

 

 

 

 

 

 

#menu a{

 

 

 

 

 

 

color: #ffff66;

 

 

 

 

 

 

text - decoration: none;

 

 

 

 

 

}

 

 

 

 

 

 

#menu a: hover{

 

 

 

 

 

 

color: #ffff66;

 

 

 

 

 

 

text - decoration: underline;

 

 

 

 

 

}

 

 

 

 

 

 

#content{

 

 

 

 

 

 

padding: 40px;

 

 

 

 

 

 

width: 100%;

 

 

 

 

 

 

min - height: 100%;

 

 

 

 

 

 

}

 

 

 

 

 

 

#footer{

 

 

 

 

 

 

background: #669966;

 

 

 

 

 

 

padding: 20px;

 

 

 

 

 

 

width: 100%;

 

 

 

 

 

 

height: 40px;

 

 

 

 

 

 

color: #ffffcc;

 

 

 

 

 

 

text - align: center;

 

 

 

 

 

 

}

 

 

 

 

 

 

index.php,

 

 

DIV id="content".

 

©

 

8ncnf_:*

 

6

-

)

-

* *

 

 

!ncnf_*

 

 

©

 

)

.

- b_[^_l*jbj iin_l*jbj

 

 

 

)

*

 

 

 

 

 

 

6

 

 

 

 

Header.php:<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset="utf-8"> <title> - <? echo $title;?></title>

<link type="text/css" rel="stylesheet" href="/css/style.css"> </head>

<body>

<div id="container">

72

<div id="header">

 

 

 

 

 

<div id="logo">

 

 

 

 

 

8b:

8+b:

 

 

 

 

 

</div>

 

 

 

 

 

 

<div id="menu"><i>

 

 

 

 

 

<a href="/index.php">

</a>

|

 

 

 

<a href="/news.php ">

</a>

|

 

 

 

<a href="/about.php ">

</a> |

 

 

 

<a href="/contacts.php ">

</a>

 

 

 

</i>

 

 

 

 

 

 

</div>

 

 

 

 

 

 

</div>

 

 

 

 

 

 

Footer.php:

 

 

 

 

 

<div id="footer"><span>Solodov M.</span></div>

 

 

</div>

 

 

 

 

 

 

</body>

 

 

 

 

 

</html>

 

 

 

 

 

 

 

index.php

header.php

footer.php

php -

include :<?php $title =

'

'; ?>

 

 

 

 

 

<?php include 'header.php'; ?>

 

 

 

 

 

<div id="content">

 

 

 

 

 

8b0:

8+b0:

 

 

 

 

 

</div>

 

 

 

 

 

 

<?php include 'footer.php'; ?>

 

 

 

 

 

 

news.php, about.php

contacts.php.

 

 

news.php:<?php $title = '

'; ?>

 

 

 

<?php include 'header.php'; ?>

 

 

 

 

 

<div id="content">

 

 

 

 

 

<h4>

</h4>

 

 

 

 

 

</div>

 

 

 

 

 

 

<?php include 'footer.php'; ?>

 

 

 

 

 

about.php:<?php $title = '

'; ?>

 

 

 

<?php include 'header.php'; ?>

 

 

 

 

 

<div id="content">

 

 

 

 

 

8b0:

8+b0:

 

 

 

 

 

</div>

 

 

 

 

 

 

<?php include 'footer.php'; ?>

 

 

 

 

 

contacts.php:<?php $title = '

 

'; ?>

 

 

 

<?php include 'header.php'; ?>

 

 

 

 

 

<div id="content">

 

 

 

 

 

<h4>

</h4>

 

 

 

 

 

</div>

 

 

 

 

 

 

<?php include 'footer.php'; ?>

 

 

 

 

 

 

 

 

 

 

kc

 

1.

*

 

 

 

 

 

2.

 

 

*

 

 

3.

 

 

*

 

 

 

4.

*

 

 

 

 

 

5.

*

 

 

 

 

 

6.

*

 

 

 

 

 

7.

*

 

 

 

 

 

8.

 

*

 

 

 

 

9.

 

*

 

 

 

 

73

 

oc

co

c c

k k)

 

 

 

 

?iiec_

 

 

 

 

 

 

c

©

 

 

 

 

?iiec_*

 

k

 

 

 

 

 

 

1.

 

 

 

 

 

 

 

2.

 

 

 

 

 

 

 

3.

 

 

 

 

 

 

 

4.

 

 

 

 

 

 

 

5.

 

 

 

 

 

 

 

T

c c:

 

 

 

 

 

 

1.

©

- }LDL dMo_ls

)

).,

)//0 *

 

2.

 

- }

)

6

).,,

).44

*

3.

**

- }

0) 6}

 

).,,

)/1.

*

 

 

 

 

k

e o

 

 

 

 

?iiec_

©

 

 

©

 

 

 

 

 

©

 

©

 

©

 

q_ -

*

-

©

 

)

 

*

 

)

) $

)

$

 

©

 

©

)

 

 

 

 

 

*

 

 

 

 

 

 

 

 

)

©

 

 

]iiec_

 

 

 

 

 

)

)

©

*

 

 

)

 

 

)

 

 

 

 

 

*

 

©

 

 

 

 

 

 

 

 

)

 

©

 

 

 

* S_)

 

 

©

)

©

 

*

 

 

 

 

 

 

 

©

 

 

 

 

 

 

©

%session

tracking&*

©

 

$

)

 

©

 

 

 

) ©

)

©

 

 

 

 

 

 

-

*

©

©

 

 

 

 

)

 

©

 

*

 

 

 

)

 

©

)

- ]iiec_

) ©

 

*

 

 

 

 

 

)

©

*

 

 

 

 

 

 

 

 

 

 

 

 

]iiec_;

 

 

?iiec_

 

 

 

)

 

q_ -

 

$

* ]iiec_ ©

 

 

 

)

 

)

 

 

 

©

 

 

$ ©

 

* ?iiec_

 

 

 

 

 

 

©

 

 

 

 

 

©

 

* ©

 

 

 

 

 

 

)

 

 

 

 

 

*

 

 

) ]iiec_

 

$

 

 

)

 

 

 

 

%QEJ&*

 

 

 

 

 

 

 

 

) $

*

) ©

QEJ ]iiec_

$

7

©

-

)

$

 

0

%0,52 &*

 

74

 

 

 

 

]iiec_

 

 

 

 

 

]iiec_

 

 

$- $]iiec_

$

 

)

 

 

]iiec_*

©

©

$ ]iiec_

$

*

 

-

 

) $

$ ]iiec_*

 

©

-

 

-

 

)

)

**

 

 

 

 

-

)

 

 

]iiec_*

 

 

 

 

 

)]iiec_

 

 

 

 

*

 

]iiec_

 

 

]iiec_

$ *

)

 

]iiec_

)

 

 

*

)

 

 

)]iiec_

 

 

%

 

 

&*

 

 

 

 

-

)

]iiec_

©

 

 

*

 

 

 

]iiec_

 

 

)

$

©

*jbjl_]cj_m*]ig*

 

 

 

 

)

©

LDLl_]cj_m%

)q[j*jbjl_]cj_m*]ig

h_qm*jbjl_]cj_m*]ig&)

©

]iiec_*

 

]iiec_ ©

 

 

 

 

)

 

]iiec_*

 

$

7

 

)

 

 

$

)

 

7

]iiec_*

 

 

 

 

 

- QNH)

 

 

]iiec_* -

 

 

 

]iiec_

©

 

 

*

$

7

 

 

)

 

 

 

)]iiec_)

*

 

 

 

 

 

-

)

)

 

]iiec_

 

*

 

 

 

B=HOA*

 

 

 

 

 

 

]iiec_

©

 

)

 

cookie

©

*

)J_nm][j_?iggohc][nil

 

]iiec_

 

6

 

 

 

 

 

 

 

 

.phprecipes.com FALSE / FALSE 97728956 bgcolor blue

 

 

 

 

 

Ehn_lh_nArjfil_l ©

]iiec_

6

 

 

 

 

bgcolor blue

localhost/php4/php.exe/book/13/

0

2154887040

29374385

522625408

29374377

*

 

 

cookie,

©

 

 

Internet Explorer,

-

 

 

.

$

)

 

 

 

 

 

 

 

©

 

 

*

Ehn_lh_nArjfil_l

]iiec_

$

?iiec_m)[J_nm][j_?iggohc][nil

 

 

$ ]iiec_m*

 

 

 

 

 

 

 

Pcec

ek

c

co

k

 

 

 

)

 

 

*

 

 

 

 

Pcec

ek

c

co

k

1.

?iiec_

©

 

 

 

 

 

2.

 

]iiec_;

 

 

 

 

 

3.

 

]iiec_

 

 

 

 

 

75

 

 

co

c c

k k)

 

 

 

 

oc ?iiec_ LDL*

 

 

 

 

 

 

c

©

 

 

 

 

?iiec_*

 

k

 

 

 

 

 

 

1.

 

 

 

 

 

 

 

2.

 

 

 

 

 

 

 

3.

 

 

 

 

 

 

 

4.

 

 

 

 

 

 

 

5.

 

 

 

 

 

 

 

T

c c:

 

 

 

 

 

 

1.

©

- }LDL dMo_ls

)

).,

)//0 *

 

2.

 

- }

)

6

).,,

).44

*

3.

**

- }

0) 6}

 

).,,

)/1.

*

 

 

 

 

k e o

 

 

 

 

 

 

 

?iiec_

 

 

 

 

 

m_n]iiec_%&

]iiec_

$

*

 

m_n]iiec_%&6

chnm_n]iiec_%mnlcha $Wmnlcha

W)chn

W)mnlcha

W)mnlcha

W)chn

 

X&

 

 

 

]iiec_)

m_n]iiec_%&

©

*

 

]iiec_

 

 

 

 

-

 

)

 

*

 

)

]iiec_

©

 

 

 

web -

*

 

 

 

-

 

7

]iiec_

 

*

 

 

 

 

 

 

 

 

©

©

)

©

$

)-

 

©

]iiec_

 

©

 

*

 

 

 

%

 

© &)

 

 

 

 

 

-

 

©

]iiec_*

 

 

 

 

 

 

 

 

 

m_n]iiec_% &

 

 

 

]iiec_

 

 

6

 

 

 

 

 

 

$userid = "4139b31b7bab052";

 

 

 

 

 

 

 

$cookie_set = setcookie ("uid", $value, time()+3600 "/ ".phprecipes.com", 0);

 

 

 

 

cookie :

 

 

 

 

 

 

 

 

©

 

 

 

 

 

$userid,

 

4139b31b7bab052.

 

 

 

 

 

 

 

cookie

 

 

(3600

)

.

 

 

 

cookie

.

 

 

 

 

 

 

 

cookie

 

 

phprecipes.com.

 

 

 

 

 

]iiec_

 

 

*

 

 

 

 

 

%

01*&]iiec_

 

 

 

 

 

%

 

-

&*

6

 

]iiec_

 

 

)

 

*

 

 

 

 

 

01** ©

 

)

 

 

 

 

 

<?

 

 

 

 

 

 

 

 

//

$bgcolor

 

 

 

 

 

 

 

if (isset($bgcolor)) :

 

 

 

 

 

 

 

setcookie("bgcolor", $bgcolor, time()+3600);

 

 

 

 

 

?>

 

 

 

 

 

 

 

 

<html>

 

 

 

 

 

 

 

 

<body bgcolor="<?=$bgcolor:?>">

 

 

 

 

 

 

<?

 

 

 

 

 

 

 

 

//

$bgcolor

,

 

 

 

 

 

 

else:

 

 

 

 

 

 

 

 

<body bgcolor="white">

<form action="<? print $PHP_SELF; ?>

76

method=="post">

 

 

 

 

What's your favorite background color?

 

 

 

<select name="bgcolor">

 

 

 

 

<option value="red">red

 

 

 

 

<option value="blue">blue

 

 

 

 

<option value="green">green

 

 

 

 

<option value="b1ack">black

 

 

 

 

</select>

 

 

 

 

<input type="submit" value="Set background color">

 

 

 

</form>

 

 

 

 

<?

 

 

 

 

endif;

 

 

 

 

?>

 

 

 

 

</body>

 

 

 

 

</html>

 

 

 

 

©

 

,

 

$bgcolor.

,

 

,

 

$bgcolor.

DPIH

 

*

 

!a]ifil

 

©

©

 

*

© )

]iiec_ ©

 

*

©

oc^WX)oc^W.X)oc^W/X

**)

)

 

*

45.2.

45.2.

<?

setcookie("phprecipes[uid]"4139b31b7bab052", time( )+3600); setcookie("phprecipes[color]"black", time(

)+3600); setcookie("phprecipes[preference]"english", timeO+3600);

 

 

 

 

if (isset($phprecipes)) :

 

 

 

 

 

 

while (list ($name, $value) = each ($phprecipes)) :

 

 

 

 

 

echo "$name = $value<br>\n";

 

 

 

 

 

 

endwhile;

 

 

 

 

 

 

endif:

 

 

 

 

 

 

?>

 

 

 

 

 

 

 

 

 

 

 

%

 

$

]iiec_&6

 

 

 

 

 

uid = 4139b31b7bab052

 

 

 

 

 

 

color = black

 

 

 

 

 

 

preference = english

 

 

 

 

 

 

cookie

©

 

,

 

'

,

©

cookie

(

, Netscape

Communicator

20 cookie

).

 

 

 

 

 

Cookie

 

 

 

 

(UIN),

 

 

,

 

 

 

.

 

 

01*/) QEJ

 

IsOMH*

©

 

 

 

 

*

 

 

 

)

om_ldhi

 

$ om_l*

 

 

 

6

) $

 

 

 

*

 

:

 

 

 

 

 

 

mysql>create table user_info (

 

 

 

 

 

 

->user_id char (18),

 

 

 

 

 

 

->fname char(15),

 

 

 

 

 

 

->email char(35));

 

 

 

 

 

 

 

 

 

)

 

01*/

 

6

)

%

) $

 

 

&

77

©

 

*

 

 

 

 

)

 

%

01*/

 

1&

 

©

cookie

$

*

 

 

 

 

 

 

 

01*/*

©

 

 

 

 

 

<?

 

 

 

 

 

 

 

if (! isset($userid)) :

 

 

 

 

 

 

$id = 15;

 

 

 

 

 

 

setcookie ("userid", $id, time( )+3600);

 

 

 

 

print "A cookie containing your userID has been set on your machine.

 

 

 

Please refresh the page to retrieve your user information";

 

 

 

else:

 

 

 

 

 

 

 

@mysql_connect("localhost", "web", "4tf9zzzf") or die("Could not connect to MySQL server"!);

@mysql_select_db("user") or die("Could not select user database"!);

 

 

 

//

 

 

 

 

 

 

 

$query = "SELECT * FROM users13 WHERE user_id = '$userid'";

 

 

 

//

 

 

 

 

 

 

 

$result = mysql_query($query) l;

 

 

 

 

 

+

 

)

 

*

 

 

 

if (mysql_num_rows($result) == 1) :

 

 

 

 

 

$row = mysql_fetch_array($result);

 

 

 

 

 

print "Hi ".$row["?name"]".,<br>";

 

 

 

 

 

print "Your email address is ".$row[ "email"];

 

 

 

 

else:

 

 

 

 

 

 

 

print "Invalid User ID"!;

 

 

 

 

 

endif;

 

 

 

 

 

 

 

mysql_close();

 

 

 

 

 

 

endif;

 

 

 

 

 

 

 

?>

 

 

 

 

 

 

 

 

45.3

,

 

cookie

 

 

.

©

 

 

 

)

 

 

 

©

 

 

 

*

 

 

 

 

 

 

 

QEJ -

ohckc^%

&*

ohckc^%&

 

* /

 

)

 

 

*

 

ohckc^%&6chnohckc^%mnlcha

W

iif_[h

X&

 

 

 

)

 

 

QEJ*

 

$

)

 

 

©

 

*

$

 

PNQA)

ohckc^%&

QEJ ./

*

 

 

)

 

ohckc^%&

 

-

©

6

 

$uniq_id = uniqid(" ");

 

 

 

 

 

 

+

/

-

*$/5/.,5]_4_.$

 

 

 

 

 

 

 

)

 

 

6

 

 

 

 

 

 

 

$uniq_id = uniqid("php", FALSE) :

 

 

 

 

 

+

2

-

*$jbj/5/.,5]_4_.$

 

ohckc^%&

QEJ

 

)

 

)

 

*

 

 

 

) ©

 

 

 

 

)l[h^%&*

©

 

 

6

 

 

 

srand((double) microtime( ) * 1000000);

 

 

 

 

$uniq_id = uniqid(rand( ));

 

 

 

 

 

srand( )

("

")

.

,

 

rand( )

 

,

 

srand( ).

rand( )

78

 

uniqid( )

 

,

 

uniqid( )

 

 

,

 

 

 

UIN.

 

 

©

 

 

 

 

$

 

*

 

 

 

 

 

 

om_lZchi*?iiec_

 

 

 

$

*

 

 

 

 

 

)

]iiec_)

 

 

 

 

 

*

 

 

Pcec

ek

c

co

k

 

 

)

 

 

 

*

 

 

Pcec

ek

c

co

k

 

1.

©

 

)

 

*

 

2.

©

 

 

 

*

 

/*

 

*

 

 

 

 

79

 

oc

co

c c

k k)

 

 

 

 

 

 

 

 

 

*

 

 

 

 

 

 

 

 

c

©

 

 

 

 

?iiec_*

 

k

 

 

 

 

 

 

1.

 

 

 

 

 

 

 

2.

 

 

 

 

 

 

 

3.

 

 

 

 

 

 

 

4.

 

 

 

 

 

 

 

5.

 

 

 

 

 

 

 

T

c c:

 

 

 

 

 

 

1.

©

- }LDL dMo_ls

)

).,

)//0 *

 

2.

 

- }

)

6

).,,

).44

*

3.

**

- }

0) 6}

 

).,,

)/1.

*

 

 

k e o

 

 

 

 

 

 

 

©

 

 

 

 

 

 

%m_mmcih&

)

 

 

 

 

 

 

 

)

*

©

 

 

 

 

©

)

©

 

 

 

 

)

 

 

 

 

 

)

 

QNH*

 

 

 

*

 

 

 

 

 

 

 

%SID&)

 

$

 

cookie

$ PHPSESSJD.

 

cookie

cookie

 

 

 

)SID

 

 

 

URL

©

*

©

 

 

 

) $

 

OE@*

 

 

 

)

 

 

 

 

 

*

 

 

 

 

 

*

*

)

 

©

*

)

 

 

©

©

 

 

*

 

 

 

 

 

 

©

*

 

)--enable - trans - c^)

 

 

)

 

 

OE@% * © &*

 

)

track_v[lm l_acmn_lZafi[fm)

 

 

 

 

jbj*chc*

 

 

 

© *

 

 

 

 

 

 

--enable - trans - id

 

 

 

 

 

 

 

 

 

)

 

QNH

 

 

 

 

%OE@&*

 

 

$Z

9

 

Z

)

$Z

jbj*chc*

 

 

)

OE@

©

 

*

 

 

 

 

 

 

 

track_vars

 

 

 

 

 

 

 

 

 

nl[]eZp[lm

 

 

!DPPLZ'ZR=NOWX)

'

 

ACL?O%Ahpclihg_hn)C_n)Limn)?iiec_)O_lp_l&*

 

 

 

)

OE@

 

 

*

0*,/

 

©

 

 

 

*

 

 

 

 

 

 

 

register_globals

 

 

 

 

 

 

 

 

 

 

ACL?O

 

 

*

 

)

 

 

 

)

) ©

)

 

)

 

*

 

 

 

 

 

 

 

 

l_acmn_lZafi[fm

)

nl[]eZp[lm

)

 

 

CL?

©

!DPPLZ'ZR=NOWX*

 

)

 

l_acmn_lZafi[fm)

 

!LDLZOAHB

 

 

!DPPLZOANVER_VARS["PHP_SELF"].

 

 

)

 

 

*

 

 

 

©

*

 

 

 

 

 

 

80