01.
<?php
02.
$n
=
$_REQUEST
[
'n'
];
03.
if
(
empty
(
$n
)){
04.
echo
"
05.
<form method=\
"post\" action=\"?\"
>
06.
<input type=\
"text\" name=\"n\"><input type=\"submit\"
>
07.
</form>
08.
";
09.
}
else
{
10.
header(
"Content-Type: plain/text"
);
11.
header(
"Content-Disposition: Attachment; filename=data$n.txt"
);
12.
header(
"Pragma: no-cache"
);
13.
$arr
=
""
;
14.
for
(
$i
=1;
$i
<=
$n
;
$i
++){
15.
if
(
empty
(
$arr
))
$arr
[]=
$i
;
16.
else
$arr
[].=
$i
;
17.
}
18.
shuffle(
$arr
);
19.
foreach
(
$arr
as
$number
) {
20.
echo
"$number \r\n"
;
21.
}
22.
}
23.
?>