|
|
|
อยากได้ code refresh ข้อมูลบางส่วนในหน้าเว็บครับ รบกวนพี่ผู้รู้ด้วยครับ |
|
|
|
|
|
|
|
คุณต้องไปตีสนิทกับ AJAX แล้วแหละครับ
|
|
|
|
|
Date :
2011-08-29 02:41:24 |
By :
ikikkok |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อยากให้หน้านี้ รีเฟรชเฉพาะ ชื่อผู้ประมูล กับ ราคา ครับ
Code (PHP)
<?
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/index.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>AuctionOnline.com</title>
<script language="javascript">
<!-- Countdown in Java Script .. Cameron Gregory http://www.bloke.com/
// permission to use and modify as long as you leave these 4 comment
// lines in tact and unmodified.
// http://www.bloke.com/javascript/Countdown/
speed=1000;
len=40;
tid = 0;
num=0;
clockA = new Array();
timeA = new Array();
formatA = new Array();
dd = new Date();
var d,x;
function doDate(x)
{
for (i=0;i<num;i++) {
dt = new Date();
if (timeA[i] != 0) {
v1 = Math.round(( timeA[i] - dt )/1000) ;
if (v1 < 0)
clockA[i].date.value = "**BANG!**";
if (formatA[i] == 1)
clockA[i].date.value = v1;
else if (formatA[i] ==2) {
sec = v1%60;
v1 = Math.floor( v1/60);
min = v1 %60 ;
hour = Math.floor(v1 / 60);
if (sec < 10 ) sec = "0"+sec;
if (min < 10 ) min = "0"+min;
clockA[i].date.value = hour+"h "+min+"m "+sec+"s";
}
else if (formatA[i] ==3) {
sec = v1%60;
v1 = Math.floor( v1/60);
min = v1 %60 ;
v1 = Math.floor(v1 / 60);
hour = v1 %24 ;
day = Math.floor(v1 / 24);
if (sec < 10 ) sec = "0"+sec;
if (min < 10 ) min = "0"+min;
if (hour < 10 ) hour = "0"+hour;
clockA[i].date.value = day+"d "+hour+"h "+min+"m "+sec+"s";
}
else if (formatA[i] ==4 ) {
sec = v1%60;
v1 = Math.floor( v1/60);
min = v1 %60 ;
v1 = Math.floor(v1 / 60);
hour = v1 %24 ;
day = Math.floor(v1 / 24);
clockA[i].date.value = day+(day==1?"day ":" days ")+hour+(hour==1?"hour ":" hours ")+min+(min==1?"min ":" mins ")+sec+(sec==1?"sec ":" secs ")
}
else
clockA[i].date.value = "Invalid Format spec";
}
else
clockA[i].date.value = "Countdown till when?";
}
tid=window.setTimeout("doDate()",speed);
}
function start(d,x,format) {
clockA[num] = x
timeA[num] = new Date(d);
formatA[num] = format;
//window.alert(timeA[num]+":"+d);
if (num == 0)
tid=window.setTimeout("doDate()",speed);
num++;
}
function CountdownLong(t,format,len)
{
document.write('<FORM name=form'+num+'><input name=date size=')
document.write(len)
document.write(' value="Countdown: Requires Javascript" disabled="disabled"></FORM>')
start(t,document.forms["form"+num],format);
}
function Countdown2001seconds()
{
CountdownLong("January 01, 2001 00:00:00",1,8);
}
function Countdown2001()
{
//CountdownLong("January 01, 2000 00:00:00",3,20);
CountdownLong("January 01, 2001 00:00:00",4,30);
}
function Countdown(t)
{
CountdownLong(t,4,30);
}
// end-->
</script>
<META HTTP-EQUIV='Refresh' CONTENT='1; URL=auctionProduct.php'>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<style type="text/css">
<!--
.style1 {font-size: 12px}
-->
</style></head>
<body>
<table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/head1.jpg" width="1024" height="150" /></td>
</tr>
<tr>
<td><img src="images/manubar.jpg" width="1024" height="31" border="0" usemap="#Map" />
<map name="Map" id="Map">
<area shape="rect" coords="131,9,199,26" href="frmAddmember.php" />
<area shape="rect" coords="344,6,434,29" href="show_productsale.php" />
<area shape="rect" coords="40,6,94,28" href="index.php" />
<area shape="rect" coords="776,6,825,27" href="question.php" />
<area shape="rect" coords="587,6,638,26" href="promotion.php" />
<area shape="rect" coords="231,8,316,29" href="auctionProduct.php" />
<area shape="rect" coords="847,7,887,27" href="toplay.php" />
<area shape="rect" coords="912,9,1005,28" href="productCloseAuction.php" />
</map></td>
</tr>
<tr>
<td background="images/newmenu.jpg" valign="top">
<table align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<?
if(!isset($_SESSION['uemail']))
{
?>
<form id="form1" name="form1" method="get" action="login.php">
<span class="style1">User</span> :
<input name="i_user" type="text" id="i_user" size="15" />
<span class="style1">Password </span>:
<input name="i_password" type="password" id="i_password" size="15" />
<input type="submit" name="button" id="button" value="เข้าสู่ระบบ" />
</form>
<?
}
else
{
?>
<span class="style1">
<a href="update_member.php">แก้ไขข้อมูลส่วนตัว|</a>
<?
if($_SESSION['utype']!='admin')
{
?>
<a href="cart.php">ตระกร้าสินค้า|</a>
<a href="saleOrder.php">รายการสั่งซื้อ|</a>
<?
}
?>
<a href="logout.php">ออกจากระบบ|</a>
<?
if($_SESSION['utype']== 'ผู้ประกอบกิจการ')
{
?>
<a href="listProductAuction.php">รายการสินค้าประมูลของคุณ</a>
<?
}
if($_SESSION['utype']=='admin')
{
?>
| <a href="listUser.php">จัดการข้อมูลสมาชิก</a>
<?
}
?>
</span>
<?
}
?>
</td>
<td valign="top" align="right">
<form id="form2" name="form2" method="post" action="search.php">
<span class="style1">ค้นหา</span> : <input type="text" name="search" />
<input type="submit" value="Search" />
</form>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top"><!-- InstanceBeginEditable name="body" -->
<p>
<center>
</center>
<?
require_once("config.php");
if($connect=connectDB())
{
$sqlSa="select * from auction order by auc_id desc";
$resultSa=mysql_query($sqlSa);
$a=0;
?>
<table align="center" width="1000">
<tr>
<?
while($dataSa=mysql_fetch_row($resultSa))
{
if($a<4)
{
?>
<td valign="top">
<table width="238" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><img src="images/ddddd_01.png" width="250" height="17" /></td>
</tr>
<tr>
<td width="10" background="images/ddddd_02.png"> </td>
<td width="223" background="images/ddddd_03.png">
<?
$sqlSpa="select * from productauction where pa_ID=$dataSa[2]";
$resultSpa=mysql_query($sqlSpa);
$dataSpa=mysql_fetch_row($resultSpa);
?>
<center>
<img src="imageauction/<?=$dataSpa[3]?>" width="130" height="160" border="1"/><br />
<br />
<span class="style1">ชื่อสินค้า :
<?=$dataSpa[1]?>
<br />
฿
<?=$dataSpa[2]?>
<br />
<?
$year=substr($dataSa[1],0,4);
$month=substr($dataSa[1],5,2);
$day=substr($dataSa[1],8,2);
$mName="";
if($month=='01')
{
$mName="January";
}
elseif($month=='02')
{
$mName="February";
}
elseif($month=='03')
{
$mName="March";
}
elseif($month=='04')
{
$mName="April";
}
elseif($month=='05')
{
$mName="May";
}
elseif($month=='06')
{
$mName="June";
}
elseif($month=='07')
{
$mName="July";
}
elseif($month=='08')
{
$mName="August";
}
elseif($month=='09')
{
$mName="September";
}
elseif($month=='10')
{
$mName="October";
}
elseif($month=='11')
{
$mName="November";
}
elseif($month=='12')
{
$mName="December";
}
$s_time=substr($dataSa[1],11,8);
$e_date=date("Y-m-d H:i:s");
if($dataSa[1]>=$e_date)
{
?>
<script language="javascript">
// when I'll turn 100, causing my own y1c problems.
Countdown("<?=$mName?> <?=$day?>, <?=$year?> <?=$s_time?>");
</script>
<br />
<?=$dataSa[5]?>
<br>
<?
}
else
{
print "<br>หมดเวลาประมูล<br>";
}
if($dataSa[1]>=$e_date)
{
if(isset($_SESSION['uemail']))
{
$u_email=$_SESSION['uemail'];
$sqlUser="select * from user where u_email='$u_email'";
$resultUser=mysql_query($sqlUser);
$dataUser=mysql_fetch_row($resultUser);
if($dataUser[11]=='0')
{
?>
<input type="button" value="You has 0 BID." />
<?
}
else
{
?>
<a href="addBid.php?auc_id=<?=$dataSa[0]?>&bid=1">
<input type="button" value="BID" />
</a>
<?
}
}
else
{
?>
<input type="button" value="Please Login" />
<?
}
}
else
{
if($_SESSION['uemail']==$dataSa[3])
{
?>
<a href="closeAuction.php?auc_id=<?=$dataSa[0]?>">
<input type="button" value="Close auction" />
</a>
<?
}
}
?>
</span>
</center>
</td>
<td width="17" background="images/ddddd_04.png"> </td>
</tr>
<tr>
<td colspan="3"><img src="images/ddddd_05.png" width="250" height="23" /></td>
</tr>
</table>
</td>
<?
}
else
{
?>
</tr>
<td valign="top">
<table width="238" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><img src="images/ddddd_01.png" width="250" height="17" /></td>
</tr>
<tr>
<td width="10" background="images/ddddd_02.png"> </td>
<td width="223" background="images/ddddd_03.png">
<?
$sqlSpa="select * from productauction where pa_ID=$dataSa[2]";
$resultSpa=mysql_query($sqlSpa);
$dataSpa=mysql_fetch_row($resultSpa);
?>
<center>
<img src="imageauction/<?=$dataSpa[3]?>" width="150" height="180" border="1"/><br />
<br />
<span class="style1">ชื่อสินค้า :
<?=$dataSpa[1]?>
<br />
฿
<?=$dataSpa[2]?>
<br />
<?
$year=substr($dataSa[1],0,4);
$month=substr($dataSa[1],5,2);
$day=substr($dataSa[1],8,2);
$mName="";
if($month=='01')
{
$mName="January";
}
elseif($month=='02')
{
$mName="February";
}
elseif($month=='03')
{
$mName="March";
}
elseif($month=='04')
{
$mName="April";
}
elseif($month=='05')
{
$mName="May";
}
elseif($month=='06')
{
$mName="June";
}
elseif($month=='07')
{
$mName="July";
}
elseif($month=='08')
{
$mName="August";
}
elseif($month=='09')
{
$mName="September";
}
elseif($month=='10')
{
$mName="October";
}
elseif($month=='11')
{
$mName="November";
}
elseif($month=='12')
{
$mName="December";
}
$s_time=substr($dataSa[1],11,8);
$e_date=date("Y-m-d H:i:s");
if($dataSa[1]>=$e_date)
{
?>
<script language="javascript">
// when I'll turn 100, causing my own y1c problems.
Countdown("<?=$mName?> <?=$day?>, <?=$year?> <?=$s_time?>");
</script>
<br />
<?=$dataSa[5]?>
<br />
<?
}
else
{
print "<br>หมดเวลาประมูล<br>";
}
if($dataSa[1]>=$e_date)
{
if(isset($_SESSION['uemail']))
{
$u_email=$_SESSION['uemail'];
$sqlUser="select * from user where u_email='$u_email'";
$resultUser=mysql_query($sqlUser);
$dataUser=mysql_fetch_row($resultUser);
if($dataUser[11]=='0')
{
?>
<input type="button" value="You has 0 BID." />
<?
}
else
{
?>
<a href="addBid.php?auc_id=<?=$dataSa[0]?>&bid=1">
<input type="button" value="BID" />
</a>
<?
}
}
else
{
?>
<input type="button" value="Please Login" />
<?
}
}
else
{
if($_SESSION['uemail']==$dataSa[3])
{
?>
<a href="closeAuction.php?auc_id=<?=$dataSa[0]?>">
<input type="button" value="Close auction" />
</a>
<?
}
}
?>
</span>
</center>
</td>
<td width="17" background="images/ddddd_04.png"> </td>
</tr>
<tr>
<td colspan="3"><img src="images/ddddd_05.png" width="250" height="23" /></td>
</tr>
</table>
</td>
<?
$a=0;
}
$a++;
}
?>
</tr>
</table>
<?
}
else
{
print "Connection Fail";
}
?>
</p>
<!-- InstanceEndEditable --></td>
</tr>
<tr>
<td><div align="center"></div></td>
</tr>
<tr>
<td><img src="images/tbody.jpg" width="1024" height="31" /></td>
</tr>
</table></td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>
|
|
|
|
|
Date :
2011-08-30 22:25:57 |
By :
atthaphon |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อันนี้ภาาพครับ
|
|
|
|
|
Date :
2011-08-30 22:35:39 |
By :
atthaphon |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ตาลาย ลายตายิ่งนักครับ
|
|
|
|
|
Date :
2011-08-30 23:44:12 |
By :
ikikkok |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองใช้ Ajax กับ setTimeOut ครับ ตามตัวอย่างผมก็เขียนไว้ให้ดูอยู่ครับ
|
|
|
|
|
Date :
2011-08-31 06:26:23 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|