Ciao a tutti avrei un problema con un countdown inserito in un cms allora nella home ho vari articoli in asta con countdown ora vorrei che dalla parte admin quando sospendo una o tutte le aste mi si fermasse il conto alla rovescia solo che fino ad ora riesco a fermare il conto alla rovescia ma quando riprendo l'asta il conto alla rovescia è andato avanti cioè per esempio fermo l'asta a 5min e 30sec timer fermo riprendo l'asta mi ritrovo che il timer mi parte a 5min e 00sec
questo è il timer conto a rovescia inserito nell'index
questa invece la pagina che mi permette di sospendere l'asta dal lato admin
Ringrazio anticipatamente tutti
questo è il timer conto a rovescia inserito nell'index
PHP:
<script language="JavaScript" type="text/javascript">
TargetFromte = "05/25/2008 9:00 AM";
BackColor = "";
ForeColor = "#0000CC; font-family: Arial Bold; font-size:38px";
CountActive = true;
CountStepper = -1;
LeadingZero = true;
DisplayFormat = "%%D%%d %%H%%h %%M%%m %%S%%s";
FinishMessage1 = "<?=$MSG_31_0023;?>";
FinishMessage2 = "<?=$MSG_31_0024;?>";
</script>
PHP:
require('../includes/config.inc.php');
include_once "loggedin.inc.php";
include_once $include_path.'dates.inc.php';
$TIME = mktime(date("H")+$SETTINGS['timecorrection'],date("i"),date("s"),date("m"), date("d"),date("Y"));
$NOW = date("YmdHis",$TIME);
//-- Set offset and limit for pagination
$limit = 20;
if(!$_GET[offset]) {
$offset = 0;
} else {
$offset = $_GET[offset];
}
$_SESSION['RETURN_LIST'] = 'listauctions.php';
$_SESSION['RETURN_LIST_OFFSET'] = intval($_GET['offset']);
$action = isset($_GET['action'])?$_GET['action']:"";
$res_id = isset($_GET['res_id'])?$_GET['res_id']:0;
$ERR = "";
if($action == "reset" && is_numeric($res_id) && $res_id>0)
{
$sql = "SELECT * FROM BPPENNYAUTOBID_auctions WHERE id=$res_id";
$res = mysql_query($sql);
if($row1 = mysql_fetch_assoc($res))
{
$starts = $NOW;
$ends_time = mktime(date("H")+$SETTINGS['timecorrection'],date("i"),date("s"),date("m"), date("d"),date("Y"));
$ends = date("YmdHis", ($ends_time + ($row1['duration']*3600*24)) );
$second_starts = $ends;
$second_ends_time = mktime(date("H")+$SETTINGS['timecorrection'],date("i"),date("s"),date("m"), date("d")+$row1['duration'],date("Y"));
$second_ends = date("YmdHis", ($second_ends_time+$row1['second_duration']*60) );
if($row1['auction_type']==1)
{
$sql = "UPDATE BPPENNYAUTOBID_auctions
SET
starts='$starts',
ends='$ends',
closed=0,
suspended=0
WHERE id=$res_id";
}else{
$sql = "UPDATE BPPENNYAUTOBID_auctions
SET
starts='$starts',
ends='$ends',
second_starts='$second_starts',
second_ends='$second_ends',
closed=0,
suspended=0
WHERE id=$res_id";
}
if(mysql_query($sql))$ERR = $MSG_31_0062;
else{
print "Database access error: abnormal termination<BR>$sql<BR>".mysql_error();
exit;
}
}
}
function date_diff1($date1="",$date2="") {
$dateDiff = $date1 - $date2;
$fullDays = floor($dateDiff/(60*60*24));
$fullHours = floor(($dateDiff-($fullDays*60*60*24))/(60*60));
$fullMinutes = floor(($dateDiff-($fullDays*60*60*24)-($fullHours*60*60))/60);
return $fullDays."d ".$fullHours."h ".$fullMinutes."m";
}
?>
<HTML>
<HEAD>
<link rel='stylesheet' type='text/css' href='style.css' />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="javascript">
function reset_auction()
{
var answer = confirm("Are you sure you want to reset auction?");
if(answer)alert("ok");
}
</script>
</HEAD>
<body bgcolor="#FFFFFF" text="#000000" link="#0066FF" vlink="#666666" alink="#000066" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td background="images/bac_barint.gif"><table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td width="30"><img src="images/i_auc.gif" ></td>
<td class=white><?=$MSG_239?> >> <?=$MSG_067?></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" valign="middle"> </td>
</tr>
<tr>
<td align="center" valign="middle"><TABLE WIDTH="750" BORDER="0" CELLSPACING="0" CELLPADDING="1" BGCOLOR="#546f95" ALIGN="CENTER">
<TR>
<TD ALIGN=CENTER class=title><? print $MSG_067; ?></TD>
</TR>
<TR>
<TD>
<TABLE WIDTH=100% CELPADDING=0 CELLSPACING=1 BORDER=0 ALIGN="CENTER" CELLPADDING="3">
<TR BGCOLOR=#FFFFFF>
<TD COLSPAN=6>
<B><?=$ERR?></B>
</TD>
</TR>
<?
$query = "select count(id) as auctions from BPPENNYAUTOBID_auctions
WHERE (auction_type='1' AND closed='0') OR
((auction_type='2' OR auction_type='3') AND (closed != '2')) ";
$result = mysql_query($query);
if(!$result){
print "$ERR_001<BR>$query<BR>".mysql_error();
exit;
}
$num_auctions = mysql_result($result,0,"auctions");
print "<TR BGCOLOR=#FFFFFF>
<TD COLSPAN=6>
<B>
$num_auctions $MSG_311.</B>
</TD>
</TR>";
?>
<TR BGCOLOR="#FFCC00">
<TD ALIGN=CENTER> <B> <? print $MSG_312; ?> </B> </TD>
<TD ALIGN=CENTER> <B> <? print $MSG_314; ?> </B> </TD>
<TD ALIGN=CENTER> <B> <? print $MSG_315; ?> </B> </TD>
<TD ALIGN=LEFT style="width:250px;"> <B> <? print $MSG_317; ?> </B> </TD>
<TD ALIGN=LEFT> <B> <? print $MSG_31_0013;?> </B> </TD>
<TD ALIGN=LEFT> <B> <? print $MSG_297; ?> </B> </TD>
<TR>
<?
$query = "SELECT
a.id, a.title, a.starts, a.ends, a.description, a.suspended, auction_type,
d.description as duration
FROM BPPENNYAUTOBID_auctions a
INNER JOIN BPPENNYAUTOBID_durations d ON a.duration = d.days
WHERE (auction_type='1' AND closed='0')
GROUP BY a.id
ORDER BY a.starts ASC limit $offset, $limit";
// $query = "SELECT DISTINCT(a.id), u.username, a.title, a.starts, a.description, a.suspended, auction_type,
// c.cat_name, d.description as duration
// FROM BPPENNYAUTOBID_auctions a,
// BPPENNYAUTOBID_adminusers u,
// BPPENNYAUTOBID_categories c,
// BPPENNYAUTOBID_durations d
// WHERE (a.auction_type='1' AND a.closed='0') OR
// ((a.auction_type='2' OR a.auction_type='3') AND (a.closed != '2'))
// ORDER BY username limit $offset, $limit";
$result = mysql_query($query);
if(!$result){
print "Database access error: abnormal termination<BR>$query<BR>".mysql_error();
exit;
}
$num_auction = mysql_num_rows($result);
$i = 0;
$bgcolor = "#FFFFFF";
while($i < $num_auction){
if($bgcolor == "#FFFFFF"){
$bgcolor = "#EEEEEE";
}else{
$bgcolor = "#FFFFFF";
}
$id = mysql_result($result,$i,"id");
$title = stripslashes(mysql_result($result,$i,"title"));
//$nick = mysql_result($result,$i,"nick");
$tmp_date = mysql_result($result,$i,"starts");
$duration = mysql_result($result,$i,"duration");
//$category = mysql_result($result,$i,"cat_name");
$auction_type = mysql_result($result,$i,"auction_type");
$description = strip_tags(stripslashes(mysql_result($result,$i,"description")));
$suspended = mysql_result($result,$i,"suspended");
$day = substr($tmp_date,6,2);
$month = substr($tmp_date,4,2);
$year = substr($tmp_date,0,4);
$date = "$day/$month/$year";
$start_date=mysql_result($result,$i,"starts");
$end_date=mysql_result($result,$i,"ends");
?>
<TR BGCOLOR="<?=$bgcolor?>">
<TD>
<?
if($suspended == 1) {
print "<FONT COLOR=red><B>$title</B>";
} else {
print $title;
}
?>
</TD>
<!--<TD><?//=$nick?></TD>-->
<TD>
<?=$date?>
</TD>
<TD>
<? //echo $duration;?>
<?
echo date_diff1(strtotime($end_date),strtotime($start_date));
?>
</TD>
<TD style="width:250px;word-break:break-all;">
<?=substr($description, 0, 200)?>...
</TD>
<TD>
<?
if($auction_type==1){
echo"Classic";
}
?>
</TD>
<TD ALIGN=LEFT nowrap>
<A HREF="editauction.php?id=<?=$id?>&offset=<?=$offset?>" class="nounderlined"><?=$MSG_298?></A><BR>
<A HREF="deleteauction.php?id=<?=$id?>&offset=<?=$offset?>" class="nounderlined"><?=$MSG_299?></A><BR>
<?
if(($auction_type==2) || ($auction_type==3)){
echo "<A HREF='users_signed.php?id=".$id."' class='nounderlined'>Users signed</A><BR>";
echo "<A HREF='ignore_minimal_users.php?id=".$id."' class='nounderlined'>Ignore minimum</A><BR>";
}
?>
<A HREF="listsuspendedauctions.php?id=<?=$id?>&offset=<?=$offset?>" class="nounderlined"><?=$MSG_300?></A><BR>
<!--<A HREF="#" onClick="reset_auction();" class="nounderlined">Reset</A><BR>-->
<BR>
</TD>
</TR>
<?
$i++;
}
?>
</TABLE></TD>
</TR>
</TABLE>
<TABLE WIDTH=600 BORDER=0 CELLPADDING=4 CELLSPACING=0 ALIGN=CENTER>
<TR ALIGN=CENTER BGCOLOR=#FFFFFF>
<TD COLSPAN=2><SPAN CLASS="navigation">
<?
$num_pages = ceil($num_auctions / $limit);
$i = 0;
while($i < $num_pages ){
$of = ($i * $limit);
if($of != $offset){
print "<A HREF=\"listauctions.php?offset=$of\" CLASS=\"navigation\">".($i + 1)."</A>";
if($i != $num_pages) print " | ";
}else{
print $i + 1;
if($i != $num_pages) print " | ";
}
$i++;
}
?>
</SPAN> </TD>
</TR>
</TABLE></TD>
</TR>
</TABLE>
</td>
</tr>
</table>
</BODY>
</HTML>