001.
<?php
002.
include
(
'config.inc.php'
);
003.
mysql_query(
"SET character_set_results=tis620"
);
004.
mysql_query(
"SET character_set_client=tis620"
);
005.
mysql_query(
"SET character_set_connection=tis620"
);
006.
007.
?>
010.
<head>
011.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=windows-874"
/>
012.
<title></title>
013.
<?
014.
015.
function
getthaidate(
$date
){
016.
$_month_name
=
array
(
"01"
=>
"มกราคม"
,
"02"
=>
"กุมภาพันธ์"
,
"03"
=>
"มีนาคม"
,
"04"
=>
"เมษายน"
,
"05"
=>
"พฤษภาคม"
,
"06"
=>
"มิถุนายน"
,
"07"
=>
"กรกฏาคม"
,
"08"
=>
"สิงหาคม"
,
"09"
=>
"กันยายน"
,
"10"
=>
"ตุลาคม"
,
"11"
=>
"พฤศจิกายน"
,
"12"
=>
"ธันวาคม"
);
017.
$yy
=
substr
(
$date
,0,4);
$mm
=
substr
(
$date
,5,2);
$dd
=
substr
(
$date
,8,2);
$time
=
substr
(
$date
,11,8);
018.
$yy
+=543;
019.
$dateT
=
intval
(
$dd
).
" "
.
$_month_name
[
$mm
].
" "
.
$yy
.
" "
.
$time
;
020.
return
$dateT
;
021.
}
022.
023.
?>
024.
</head>
025.
026.
<body>
027.
028.
029.
031.
<p align=
"center"
><?
032.
{
033.
function
date_con(
$var3
) {
034.
035.
@list(
$date
) = split(
' '
,
$var3
);
036.
037.
list(
$d
,
$m
,
$Y
) = split(
'-'
,
$var3
);
038.
039.
$var3_echo
=
''
.
$Y
.
'-'
.
$m
.
'-'
.
$d
.
''
;
040.
041.
return
$var3_echo
;
042.
043.
}
044.
?>
045.
046.
<?
047.
$f
=
$_POST
[
'date1'
];
048.
$e
=
$_POST
[
'date2'
];
049.
$d1
= date_con(
$f
);
050.
$d2
=date_con(
$e
);
051.
052.
053.
$po
=
$_POST
[
"radiobutton"
];
054.
055.
056.
057.
if
(
$po
==1){
058.
$ss
=
"แสดงการส่งที่<font color = 'green'>"
.สำเร็จ .
"</font>"
;
059.
$strSQL
=
"SELECT * FROM sms WHERE Date_SMS BETWEEN '$d1' AND '$d2' AND ST = '1'"
;
060.
}
061.
elseif
(
$po
==2){
062.
$ss
=
"แสดงการส่งที่<font color = 'red'>"
.ไม่สำเร็จ .
"</font>"
;
063.
$strSQL
=
"SELECT * FROM sms WHERE Date_SMS BETWEEN '$d1' AND '$d2' AND ST = '2'"
;
064.
}
065.
elseif
(
$po
==
""
){
066.
$ss
=
"แสดงการส่งทั้งหมด"
;
067.
$strSQL
=
"SELECT * FROM sms WHERE Date_SMS BETWEEN '$d1' AND '$d2'"
;
068.
}
069.
echo
"<b>ค้นหาตามช่วงเวลา</b>"
;
070.
echo
"<center><p><p>วันที่"
;
echo
getthaidate(
$d1
);
echo
"<font color = 'red'>"
.ถึง.
071.
"</font>"
;
echo
"วันที่"
;
echo
getthaidate(
$d2
);
echo
$ss
;
072.
?>
073.
074.
075.
</p>
076.
077.
<div align=
"left"
></div>
078.
<table width=
"893"
border=
"1"
align=
"center"
>
079.
<tr>
080.
<th width=
"275"
bgcolor=
"#999999"
> <div align=
"center"
><font color=
"#000000"
>วันที่ส่ง</font></div></th>
081.
<th width=
"245"
bgcolor=
"#999999"
> <div align=
"center"
><font color=
"#000000"
>ข้อความ</font></div></th>
082.
<th width=
"230"
bgcolor=
"#999999"
> <div align=
"center"
><font color=
"#000000"
>ชื่อ-นามสกุล </font></div></th>
083.
<th width=
"115"
bgcolor=
"#999999"
> <div align=
"center"
><font color=
"#000000"
>สถานะ</font></div></th>
084.
</tr>
085.
<?
086.
087.
$Per_Page
=10;
088.
$Page
=
$_GET
[
"Page"
];
089.
if
(!
$_GET
[
"Page"
])
090.
{
091.
$Page
=1;
092.
}
093.
094.
095.
$Prev_Page
=
$Page
-1;
096.
$Next_Page
=
$Page
+1;
097.
$result2
=mysql_query(
$strSQL
);
098.
$Page_start
= (
$Per_Page
*
$Page
)-
$Per_Page
;
099.
$Num_Rows
= mysql_num_rows(
$result2
);
100.
101.
if
(
$Num_Rows
<=
$Per_Page
)
102.
$Num_Pages
=1;
103.
else
if
((
$Num_Rows
%
$Per_Page
)==0)
104.
$Num_Pages
=(
$Num_Rows
/
$Per_Page
);
105.
else
106.
$Num_Pages
=(
$Num_Rows
/
$Per_Page
)+1;
107.
108.
$Num_Pages
= (int)
$Num_Pages
;
109.
110.
if
((
$Page
>
$Num_Pages
) || (
$Page
<0))
111.
print
"<center><b>จำนวน $Page มากกว่า $Num_Pages ยังไม่มีข้อความ<b></center>"
;
112.
$strSQL
.=
" order by Date_SMS DESC LIMIT $Page_start,$Per_Page"
;
113.
114.
$i
=0;
115.
$objQuery
= mysql_query(
$strSQL
);
116.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
117.
{
118.
$i
++;
119.
?>
120.
<tr>
121.
<td height=
"39"
><div align=
"left"
class
=
"style7"
>
122.
123.
<div align=
"center"
>
124.
<?=getthaidate(
$objResult
[Date_SMS])?>
125.
</div>
126.
</div></td>
127.
<td><label></label>
128.
<div align=
"left"
>
129.
<?
$objResult
[
"MSG_ID"
];
130.
131.
$mmm
=
$objResult
[
"MSG_ID"
];
132.
$strSQL2
=
"SELECT * FROM message WHERE MSG_ID = '$mmm'"
;
133.
$result2
= mysql_query(
$strSQL2
);
134.
$row2
= mysql_fetch_array(
$result2
);
135.
$province_name1
=
$row2
[
'Message'
];
136.
echo
"$province_name1"
;
137.
138.
139.
140.
141.
?>
142.
</div></td>
143.
<td><div align=
"left"
>
144.
<?
$objResult
[
"ID_Students"
];
145.
$name
=
$objResult
[
"ID_Students"
];
146.
$strSQL2
=
"SELECT * FROM student WHERE ID_Students = '$name'"
;
147.
$result2
= mysql_query(
$strSQL2
);
148.
$row2
= mysql_fetch_array(
$result2
);
149.
$province_name1
=
$row2
[
'Name_Students'
];
150.
$province_name2
=
$row2
[
'LastName_Students'
];
151.
echo
"$province_name1 $province_name2"
;
152.
?>
153.
</div></td>
154.
<td align=
"right"
><div align=
"center"
>
155.
<?
$objResult
[
"Status_SMS"
];
156.
$error
=
$objResult
[
"Status_SMS"
];
157.
if
(
$error
==
"1701"
)
158.
{
159.
echo
"<font color = '#00FF00'>"
.สำเร็จ.
"</font>"
;
160.
}
else
if
(
$error
==
"1702"
)
161.
{
162.
echo
"<font color = 'red'>"
.ไม่สำเร็จ.
"</font>"
;
163.
164.
}
else
if
(
$error
==
"1703"
)
165.
{
166.
echo
"<font color = 'red'>"
.ไม่สำเร็จ.
"</font>"
;
167.
168.
}
else
if
(
$error
==
"1705"
)
169.
{
170.
echo
"<font color = 'red'>"
.ไม่สำเร็จ.
"</font>"
;
171.
172.
}
else
if
(
$error
==
"1706"
)
173.
{
174.
echo
"<font color = 'red'>"
.ไม่สำเร็จ.
"</font>"
;
175.
176.
}
else
if
(
$error
==
"1707"
)
177.
{
178.
echo
"<font color = 'red'>"
.ไม่สำเร็จ.
"</font>"
;
179.
180.
}
else
if
(
$error
==
"1709"
)
181.
{
182.
echo
"<font color = 'red'>"
.ไม่สำเร็จ.
"</font>"
;
183.
184.
}
else
if
(
$error
==
"1025"
)
185.
{
186.
echo
"<font color = 'red'>"
.ไม่สำเร็จ.
"</font>"
;
187.
}
188.
?>
189.
</div></td>
190.
</tr>
191.
<?
192.
193.
194.
if
((
$i
)%1==0){
195.
}
196.
else
{
197.
}}
198.
if
(
$i
==0){
199.
}
200.
}
201.
202.
?>
203.
</table>
204.
205.
206.
207.
<div align=
"center"
>
208.
<p><br>
209.
จำนวนข้อความ
210.
<?=
$Num_Rows
;?>
211.
ฉบับ :
212.
<?=
$Num_Pages
;?>
213.
หน้า :
214.
<?
215.
if
(
$Prev_Page
)
216.
{
217.
echo
" <a href='$PHP_SELF?Page=$Prev_Page&f=$d1&e=$d2&po = $_POST[radiobutton]' class='boxtext'><< ย้อนกลับ</a> "
;
218.
219.
220.
}
221.
222.
for
(
$i
=1;
$i
<=
$Num_Pages
;
$i
++){
223.
if
(
$i
!=
$Page
)
224.
{
225.
echo
"[ <a href='$PHP_SELF?Page=$i&f=$d1 &e=$d2&po = $_POST[radiobutton]' class='boxtext'>$i</a> ]"
;
226.
}
227.
else
228.
{
229.
echo
"<b> $i </b>"
;
230.
}
231.
}
232.
if
(
$Page
!=
$Num_Pages
)
233.
{
234.
echo
" <<a href='$PHP_SELF?Page=$Next_Page&f=$d1 &e=$d2&po = $_POST[radiobutton]' class='boxtext'>หน้าต่อไป>></a> "
;
235.
}
236.
mysql_close();
237.
?>
238.
</p>
239.
<p> </p>
240.
<p><a href=
"Admin_Check.php"
>กลับไปหน้าเช็ครายการส่ง</a></p>
241.
<p><img src=
"image/index.jpg"
width=
"1047"
height=
"131"
/></p>
242.
</div>
243.
<p align=
"center"
> </p>
244.
<p align=
"center"
> </p>
245.
<p align=
"center"
>
246.
247.
</p>
248.
</body>
249.
</html>