001.
<?
002.
include
(
"inc/config.php"
);
003.
conndb();
004.
005.
006.
$sqldata
=
"select *from tb_subfile where file_id = '20120417112002'"
;
007.
$querydata
= mysql_query(
$sqldata
)
or
die
(
"error=$sqldata"
);
008.
$numdata
= mysql_num_rows(
$querydata
);
009.
$resultid_data
=
array
();
010.
if
(
$numdata
!=0)
011.
{
012.
while
(
$rowdata
= mysql_fetch_array(
$querydata
))
013.
{
014.
array_push
(
$resultid_data
,
$rowdata
[
'subf_name'
]);
015.
}
016.
}
017.
018.
for
(
$i
;
$i
<
$numdata
;
$i
++){
019.
$resultid_data
[0];
020.
$resultid_data
[1];
021.
$resultid_data
[2];
022.
$resultid_data
[3];
023.
$resultid_data
[4];
024.
}
025.
?>
028.
<head>
029.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
030.
<title>Untitled Document</title>
031.
</head>
032.
033.
<body>
034.
<form action=
"test2.php"
method=
"post"
>
035.
<table width=
"50%"
border=
"1"
cellspacing=
"0"
cellpadding=
"0"
>
036.
<tr>
037.
<td>No.</td>
038.
<td>NAME</td>
039.
</tr>
040.
041.
<tr>
042.
<td><?=
$no
++;?></td>
043.
<td><a href=
"test/<?=$resultid_data[0];?>"
onclick=
"send1();"
target=
"_blank"
><?=
$resultid_data
[0];?></a><br />
044.
<a href=
"test/<?=$resultid_data[1];?>"
onclick=
"send2();"
target=
"_blank"
><?=
$resultid_data
[1];?></a><br />
045.
<a href=
"test/<?=$resultid_data[2];?>"
onclick=
"send3();"
target=
"_blank"
><?=
$resultid_data
[2];?></a><br />
046.
<a href=
"test/<?=$resultid_data[3];?>"
onclick=
"send4();"
target=
"_blank"
><?=
$resultid_data
[3];?></a><br />
047.
<a href=
"test/<?=$resultid_data[4];?>"
onclick=
"send5();"
target=
"_blank"
><?=
$resultid_data
[4];?></a></td>
048.
</tr>
049.
</table>
050.
</form>
051.
052.
<SCRIPT LANGUAGE=
"JavaScript"
>
053.
054.
function
send1() {
055.
alert("<?
056.
$s1
=
$resultid_data
[0];
057.
$slog
=
"INSERT INTO testlog"
;
058.
$slog
.=
"(logID,logDate,logStatus,logSubfname) VALUES"
;
059.
$slog
.=
"('',NOW(),'เปิดดูเอกสาร','$s1')"
;
060.
$querylog
= mysql_query(
$slog
);
061.
echo
"SHOW "
.
$s1
;
062.
?>");
063.
return
true;
064.
}
065.
function
send2() {
066.
alert("<?
067.
$s2
=
$resultid_data
[1];
068.
$slog
=
"INSERT INTO testlog"
;
069.
$slog
.=
"(logID,logDate,logStatus,logSubfname) VALUES"
;
070.
$slog
.=
"('',NOW(),'เปิดดูเอกสาร','$s2')"
;
071.
$querylog
= mysql_query(
$slog
);
072.
echo
"SHOW "
.
$s2
;
073.
?>");
074.
return
true;
075.
}
076.
function
send3() {
077.
alert("<?
078.
$s3
=
$resultid_data
[2];
079.
$slog
=
"INSERT INTO testlog"
;
080.
$slog
.=
"(logID,logDate,logStatus,logSubfname) VALUES"
;
081.
$slog
.=
"('',NOW(),'เปิดดูเอกสาร','$s3')"
;
082.
$querylog
= mysql_query(
$slog
);
083.
echo
"SHOW "
.
$s3
;
084.
?>");
085.
return
true;
086.
}
087.
function
send4() {
088.
alert("<?
089.
$s4
=
$resultid_data
[3];
090.
$slog
=
"INSERT INTO testlog"
;
091.
$slog
.=
"(logID,logDate,logStatus,logSubfname) VALUES"
;
092.
$slog
.=
"('',NOW(),'เปิดดูเอกสาร','$s4')"
;
093.
$querylog
= mysql_query(
$slog
);
094.
echo
"SHOW "
.
$s4
;
095.
?>");
096.
return
true;
097.
}
098.
function
send5() {
099.
alert("<?
100.
$s5
=
$resultid_data
[4];
101.
$slog
=
"INSERT INTO testlog"
;
102.
$slog
.=
"(logID,logDate,logStatus,logSubfname) VALUES"
;
103.
$slog
.=
"('',NOW(),'เปิดดูเอกสาร','$s5')"
;
104.
$querylog
= mysql_query(
$slog
);
105.
echo
"SHOW "
.
$s5
;
106.
?>");
107.
return
true;
108.
}
109.
</script>
110.
</body>
111.
</html>