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

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

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

else if(isset($dm0))

{

$cmp = ($dm0 < $dm)!== ($em0 < $em);

if($cmp)

 

$res = "8 -

";

}

 

}

 

}

$maxres |= intval($res); echo "<tr>"

 

".<td>".htmlspecialchars($msg)".</td>"

 

".<td>".htmlspecialchars($em)".</td>"

 

".<td>".htmlspecialchars($dm)".</td>"

 

".<td>. $res</td></tr>";

}

 

echo "</table>

: ".$maxres;

?>

 

 

kc

1.

lin/*

2.

*

3.

*

21

oc

 

co c

c

k k)

 

 

*

 

 

 

 

 

 

c

 

 

 

*

 

 

 

 

k

 

 

 

 

 

 

 

1.

 

 

 

 

 

 

 

 

2.

 

 

 

 

 

 

 

 

3.

 

 

 

 

 

 

 

 

4.

 

 

 

 

 

 

 

 

5.

 

 

 

 

 

 

 

 

T

c c:

 

 

 

 

 

 

 

1.

©

- }LDL dMo_ls

 

 

)

)., )//0 *

2.

 

- }

 

 

)

6

).,,

).44 *

3.

**

- }

 

0)

6}

 

).,,

)/1. *

 

 

 

 

k

e o

 

 

 

 

 

 

 

 

 

 

ohckc^*

 

 

 

)

 

 

 

 

 

*

 

 

 

 

 

 

.4-

-

 

 

 

 

I@1

 

 

 

 

 

<?php

 

 

 

 

 

 

 

$id = md5(uniqid(rand(), true));

 

 

 

 

 

 

print $id".<br>";

 

 

 

 

 

 

?>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

©

 

*

 

 

 

©

 

 

 

© *

 

<form method="post">

 

 

 

 

 

 

<input type="text" name="number" value="10">

 

 

 

 

 

<input type="submit" value="

">

 

 

 

 

 

<form><br><br>

 

 

 

 

 

 

<?php

 

 

 

 

 

 

 

+

 

!hog _l-

 

 

 

 

 

 

+

 

 

 

 

 

 

 

 

echo generate_password(intval($_POST['number'])); function generate_password($number)

{

$arr = array('a ',' b ',' c ',' d ',' e ',' f 'g ',' h ',' i ',' j ',' k ',' l

'm ',' n ',' o ',' p ',' r ',' s 't ',' u ',' v ',' x ',' y ',' z

'A ',' B ',' C ',' D ',' E ',' F

'G ',' H ',' I ',' J ',' K ',' L

'M ',' N ',' O ',' P ',' R ',' S

'T ',' U ',' V ',' X ',' Y ',' Z '1 ',' 2 ',' 3 ',' 4 ',' 5 ',' 6 '7 ',' 8 ',' 9 ',' 0 ','.',',', '(',')','[',']','!','? '&','^','%','@','*','$ '<','>','/','|','+','-',

'{','};

+

$pass = "";

for($i = 0; $i < $number; $i++)

22

{

 

 

 

 

//

 

 

 

$index = rand(0, count($arr) - 1);

 

 

 

$pass .= $arr[$index];

 

 

}

 

 

 

return $pass;

 

 

}

 

 

 

?>

 

 

 

 

Pcec

ek c co

k

*

 

 

 

 

6

 

 

&

)

*

 

.&

*

 

 

 

6

 

 

<?php

+) *

$chars="qazxswedcvfrtgbnhyujmkiolp1234567890QAZXSWEDCVFRTGBNHYUJMKIOLP";

+

 

*

 

$max=10;

 

 

 

+

 

 

!]b[lm

$size=StrLen($chars) - 1;

 

 

+

©

)

*

$password=null;

 

 

 

//

.

 

 

while($max--)

 

 

 

$password.=$chars[rand(0,$size)];

 

//

 

.

 

echo

 

 

 

"<center>

 

 

 

 

:

 

 

<hr><font face=verdana color=red size=7><b>".$password".</b></font><hr>

8[bl_9# 2/7:

*8+[:8+]_hn_l:7

 

?>

 

 

 

.*

 

*

 

/*

 

)

*

 

 

 

kc

*

 

;

 

.*

 

I@1

 

/*

ohckc^*

 

 

0*

 

*

 

23

 

Po

ek o

-

ce

k

k

oc

 

co c

c

6 (

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

 

 

 

 

 

©

6

 

 

c% © &6

 

 

 

 

else:

 

 

 

 

 

endif;

 

 

 

 

 

 

© )

©

c

6

 

 

c%!99!&u

 

 

 

 

 

print "Equivalent values"!;

}

if ($a == $b) :

print "Equivalent values"!;

endif;

 

 

 

 

 

 

while

 

 

 

 

 

 

 

qbcf_

%

&

*

 

qbcf_

 

 

)

*

 

qbcf_

 

6

 

 

 

 

 

qbcf_% © &6

 

 

 

 

endwhile;

 

 

 

 

 

 

 

 

qbcf_

%h&) h916

 

 

$n = 5;

 

 

 

 

 

 

!h

9!h7

 

 

 

 

 

![]nilc[f9 7+

 

 

 

 

while ($n > 0) :

 

 

 

 

 

$factorial - $n * $factorial;

 

 

 

 

$n--7+

!h

 

 

 

 

endwhile;

 

 

 

 

 

print "The factorial of $ncopy is $factorial".;

 

 

 

 

 

 

6

 

 

 

The factorial of 5 is 120.

 

 

 

 

 

 

!h

©

*

 

 

 

)

!h

,)

![]nilc[f ©

,-

)

 

 

*

 

 

 

 

 

 

 

 

 

!h: )

 

©

![]nilc[f

-

*

 

 

 

 

)

©

$

*

 

24

do. .while

 

 

 

 

 

 

 

 

^i**qbcf_

©

)

qbcf_)

 

 

)

^i*

*qbcf_

 

 

)

©

*

)

^i**qbcf_

©

 

 

)

qbcf_ ©

 

)

 

 

 

 

6

 

 

 

 

 

 

do:

 

 

 

 

 

 

 

 

qbcf_% ©

&7

 

 

 

 

 

 

 

do. .while:

 

 

 

 

 

 

 

 

$n = 5:

 

 

 

 

 

 

 

 

$ncopy = $n;

 

 

 

 

 

 

 

 

![]nilc[f9 7+

 

 

 

 

 

 

 

do {

 

 

 

 

 

 

 

 

$factorial = $n * $factorial;

 

 

 

 

 

 

$n--: //

Sn

1

 

 

 

 

 

 

} while (Sn > 0);

 

 

 

 

 

 

 

 

print "The factorial of Sncopy is $factorial".;

 

 

 

 

 

 

 

 

 

©

)

 

 

 

 

 

*

 

 

 

 

 

 

^i**qbcf_

 

 

 

%

©

 

6

 

 

 

&)

©

 

© *

 

 

for

 

 

 

 

 

 

 

 

il

 

 

©

 

 

*

 

 

qbcf_

)

 

 

 

 

 

 

 

)

 

)

 

 

*

 

qbcf_)

 

 

)

)

)

 

*

 

 

il

6

 

 

 

 

 

 

 

il%

6

7

&u

 

 

 

 

 

}

 

 

 

 

 

 

 

 

 

 

il

 

 

 

*

 

 

 

 

 

 

)

 

*

 

 

©

 

)

 

 

 

*

)

 

)

)

©

* © )

 

 

 

)

 

©

 

)

 

 

 

*

 

 

 

 

 

il6

 

 

 

for ($i = 10; $1 <- ,,6! (9,&6+

 

 

 

 

 

print "\!c9!c8l:7_h^il7 + ©

 

!

 

 

 

 

 

 

 

6

 

 

 

 

$i = 10

 

 

 

 

 

 

 

 

$i = 20

 

 

 

 

 

 

 

 

$i = 30

 

 

 

 

 

 

 

 

$i = 40

 

 

 

 

 

 

 

 

$i =50

 

 

 

 

 

 

 

 

$i = 60

 

 

 

 

 

 

 

 

$i = 70

 

 

 

 

 

 

 

 

$i = 80

 

 

 

 

 

 

 

 

$i = 90

 

 

 

 

 

 

 

 

$i = 100

 

 

 

 

 

 

 

 

!c)

 

 

)

 

 

,*

)

 

 

)

!c

 

 

 

,,*

)

©

25

 

!c

,*

 

jlchn

, ) ©

 

 

 

!c*

6

!c

,

 

 

 

*

 

)

il

 

 

!c9!c( ,*

 

 

 

 

)

©

 

)

©

6

 

for ($i = 10; $i <= 100; print "\$i - $i <br>". $i+=10);

 

 

 

 

 

,

 

 

 

,

-

 

.

©

 

;

)

il

 

 

 

*

 

 

)

©

 

 

)

 

 

6

 

 

 

 

 

 

for ($x=0,$y=0: $x+$y<10; $x++) :

 

 

 

 

! (9.7

+

! .

 

 

 

 

print "\!s9!s8>N:7 +

!

 

 

 

$sum = $x + $y;

 

 

 

 

 

 

print "\surn = $sum<BR>";

//

$sum

 

 

 

endfor;

 

 

 

 

 

 

6

 

 

 

 

 

 

$y = 2 $sum = 2 Sy = 4 $sum = 5 $y = 6 $sum = 8 $y = 8 $sum = 11

 

 

 

!s

! !*

 

 

)

 

!mog9

)

 

©

%! (! 8 ,&*

 

)

 

 

 

!

2)

!

.*

 

 

 

)

! !

 

)

 

*

 

 

 

 

 

,

*

 

 

 

il)

) ©

 

-

*

)

©

 

)

 

)

)

 

 

 

 

* ©

 

-

)

©

 

©

 

)

 

*

 

 

 

©

)

*

:

 

 

 

 

$ = 5:

 

 

 

 

 

 

 

for (:: $ +=2) :

 

 

 

 

 

 

print " $

";

 

 

 

 

 

 

if ($x == 15) :

 

 

 

 

 

 

break; //

 

for

 

 

 

 

 

endif;

 

 

 

 

 

 

 

endfor;

 

 

 

 

 

 

 

 

 

:

 

 

 

 

 

5 7 9 11 13 15

 

 

 

 

 

 

 

 

for

while

 

,

© ,

for

 

 

.

 

,

 

 

for

 

 

 

 

 

.

)

qbcf_

 

 

 

 

 

-

 

©

 

 

*

 

 

 

 

 

26

 

Pcec

ek c co

k

1.

*

 

 

2.

 

)

LDLArj_ln

A^cnil)

 

*

 

 

 

kc

 

*

©

*

 

2.

while.

 

 

3.do. .while

4.for

27

 

oc

 

 

co

c

c

 

 

k k)

 

 

 

 

 

 

 

)

 

6

-

 

 

 

*

 

 

 

 

 

c

6

-

)

 

 

 

 

 

 

 

 

)

)

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

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

LDL)

 

 

 

 

 

 

 

 

 

-

 

LDL

 

 

 

 

 

*

 

 

 

©

 

 

) )

 

)

 

 

)

 

 

)

 

 

 

%

©

 

&*

 

 

 

 

 

 

 

*

 

)

 

 

 

©

 

 

)

 

 

 

 

 

 

 

 

 

©

u*w*

 

 

-

©

 

 

*

 

 

LDL

©

 

 

 

 

*

 

 

 

 

 

LDL

 

 

 

 

)

 

 

*

 

 

 

 

 

 

© )

 

 

 

LDL

)

 

 

6

 

 

 

 

 

 

 

 

6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

6

while

 

 

6

 

 

 

6

 

 

 

 

 

6

 

if

 

 

do-while

 

switch-case

 

declare

 

 

 

6

 

require()

 

 

else

 

for

 

 

 

 

 

 

 

 

return

 

 

include()

 

 

elseif

 

foreach

 

 

 

 

 

 

 

 

 

 

 

require_once()

 

 

 

 

break

 

 

 

 

 

 

 

 

 

 

 

include_once()

 

 

 

 

continue

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Pcec

ek

 

c

co

 

 

k

 

 

 

 

*.3*

 

©

 

 

 

 

 

)

 

 

 

.3*.

 

 

 

*.3**

 

 

 

)

©

6

©

)

 

6

28

Ä

)

 

*

 

Ä

©

0

6 ) )

*

Ä

 

 

*

 

Ä

*

 

 

 

.3**

 

 

_p_hnm*nrn

 

<?

+6

+

6

 

+

 

 

+

O_p_hnm

_p_hnm*nrn

$events - fopen("events.txt". "r"); print "<table border = 0 width = 250>" print""<tr><td valign=top";

print "<h3>Events Calendar :</h3>";

+)

while(! feof(Sevents)) :

+

events.txt $event = fgets($events. 4096);

+

$event_info = explode("|". Jevent);

+

print "$event_info[0]( $event_info[1] ) <br>"; print "<b>$event_info[2]</b> <br>";

print "$event_info[3] <br> <br>"; endwhile;

//

print "</td></tr></table>";

fclose($events);

 

?>

 

 

)

 

*

 

kc

1.

c*

2.

_fm_*

3.

_fm_c*

4.

%qbcf_&7

5.

(do - while);

6.

(for);

7.

il_[]b*

8.

mqcn]b- case.

9.

mqcn]b*

10.

^_]f[l_*

11.

nc]e*

12.

l_nolh*

13.

l_kocl_*

14.

ch]fude.

29

 

 

Po

ek o

-

 

 

 

 

 

oc

co

c c

(

k k)

 

 

 

 

*

 

 

 

 

 

 

 

c

 

 

 

*

 

 

 

 

k

 

 

 

 

 

 

 

1.

 

 

 

 

 

 

 

 

2.

 

 

 

 

 

 

 

 

3.

 

 

 

 

 

 

 

 

4.

 

 

 

 

 

 

 

 

5.

 

 

 

 

 

 

 

 

T

c c:

 

 

 

 

 

 

 

1.

©

- }LDL dMo_ls

 

)

).,

)//0 *

 

2.

 

- }

 

)

6

).,,

).44

*

3.

**

- }

0)

6}

 

).,,

)/1.

*

 

 

k e o

 

-

)

*

*

6

 

 

 

7

 

 

 

 

%

&)

r6

<?php

 

 

 

function factorial($x){

 

 

 

if ($x === 0) return 1;

 

 

 

else return $x*factorial($x - 1);

 

 

 

}

 

 

 

echo factorial(7);

 

 

 

?>

 

 

 

 

 

factorial()

,

.

 

 

 

)

 

) -

*

 

 

©

)

*

 

 

 

 

 

6

 

<?php

function factorial($x){ if ($x === 0) return 1;

else return $x*factorial($x);

}

?>

 

Pcec

ek c co

k (

 

1.

 

*

 

 

2.

 

)

©

)

 

*

kc

 

 

 

 

 

 

*

*

 

 

 

.*

 

*

 

 

30