countdown

skikkato

Nuovo Utente
13 Ott 2012
4
0
0
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
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>
questa invece la pagina che mi permette di sospendere l'asta dal lato admin
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?>&nbsp;&gt;&gt;&nbsp;<?=$MSG_067?></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td align="center" valign="middle">&nbsp;</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>
Ringrazio anticipatamente tutti
 

skikkato

Nuovo Utente
13 Ott 2012
4
0
0
ho provato ad inserire questo nell'index solo che non mi funziona
PHP:
$res = mysql_query "SELECT * FROM BPPENNYAUTOBID_auctions WHERE suspended='1'";	
if($suspended == 1) {CountActive = false;}
grazie
 
Discussioni simili
Autore Titolo Forum Risposte Data
L countdown multiplo javascript Javascript 1
M Come fare un countdown in HTML? HTML e CSS 4
L Creare un countdown con giorno specifico della settimana PHP 3
T countdown da sistemare con i CSS... HTML e CSS 4
C Countdown bloccato? Javascript? Javascript 0
D [Javascript] [HTML] Countdown su Mobirise di 24 ore relative per ogni utente. Javascript 4
Alex1990000 [PHP] countdown 6 ore data PHP 9
Michaelweb93 [PHP] Creazione countdown a 72 ore PHP 1
G Countdown in secondi JS su pagina PHP Javascript 1
N Creazione countdown PHP 4
A Countdown js con variabile in php Javascript 16
A countdown modificabile con un click Javascript 1
O Countdown jQuery jQuery 0
O Countdown jQuery Javascript 1
P countdown jquery jQuery 2
blips Countdown e Redirect Javascript 3
T Javascript e countdown multipli Javascript 1
T Countdown e timestamp PHP 0
S countdown in php e script per aprire 2 siti contemporanemante PHP 1
P problema con il countdown per la fine dell'anno e per natale Javascript 13
N Countdown con effetto sonoro Snippet Javascript 0
maxnegri Problema countdown Javascript 3
F Countdown / timer javascript Javascript 19
S Stampare un messaggio alla fine del countdown in Javascript Javascript 0
S Fare un Countdown con flash Flash 0
L Countdown con script Javascript 4
A Limite minimo con countdown textarea Javascript 0
maxnegri Stampare un messaggio alla fine di un countdown in javascript Javascript 0
M Countdown in asp Classic ASP 0
E Domanda countdown PHP PHP 3
J Countdown Timer 2 Javascript 0
J Make a JavaScript Countdown Timer in OOP Javascript 0
J JavaScript Countdown Timer solution in OOP Javascript 0
T Countdown fra 2 date in ASP Classic ASP 12
M Differenza tra date e countdown PHP 5
J Top 10 Beautiful Christmas Countdown Timers Javascript 0
G Countdown per l'apertura di un sito Javascript 1
M Countdown script Javascript 1
M countdown Flash 0
M Countdown Server Side Classic ASP 0
C Conto alla rovescia - Countdown (al secondo) Javascript 1
G Countdown particolare Javascript 8
M Piccola intro con countdown!!! Presenta il tuo Sito 1

Discussioni simili