...

View Full Version : Countdown frm last submission



Chris-2k
05-27-2011, 03:49 PM
Hi,

im giving full credits to tangoforce as he's written this mod for me :-)



// 24 hr limit mod start.
//Get time and cal for last 24 hr time stamp
$Time = time();
$Day = (60*60*24);
$Time = ($Time - $Day);

$Site = mysql_real_escape_string($_POST['sname']);

//Lookup site and get its ID for next 2 queries
$Query_Site = "select * from wcddl_sites where name='$Site'";
$Result_Site = mysql_query($Query_Site);
$Row_Site = mysql_fetch_array($Result_Site);

//Get number of downloads already stored within last 24hrs
$Query_Downloads = "select * from wcddl_downloads where sid='$Row_Site[id]' and dat > '$Time'";
$Result_Downloads = mysql_query($Query_Downloads);
$Count_Downloads = mysql_num_rows($Result_Downloads);

//Get number of downloads in queue
$Query_Queue = "select * from wcddl_queue where sid='$Row_Site[id]'";
$Result_Queue = mysql_query($Query_Queue);
if (!$Count_Queue = mysql_num_rows($Result_Queue))
{
//If nothing in queue and mysql_num_rows returns false, set to 0
$Count_Queue = 0;
}

//Get total count of everything submitted in last 24 hrs (inc queued items that have been submitted anytime)
$Total_Count = ($Count_Queue + $Count_Downloads + $Count_Downloads);

for($i=0; $i < count($titles); $i++) {//Loiop through download fields
//Non submitted fields still set due to dropdown menu


can any 1 help me on displaying tha time since lats submissions..

tangoforce
05-27-2011, 04:56 PM
Thinking about this from another approach if its just the time of the last submission you want then from the downloads table you could run another 24 hr query and order it by asc (think its asc might need to try desc if it don't work).

Something like:


//Get time and cal for last 24 hr time stamp
$Time = time();
$Day = (60*60*24);
$Time = ($Time - $Day);

//Get number of downloads already stored within last 24hrs
$Query_Downloads2 = "select * from wcddl_downloads where sid='$Row_Site[id]' and dat > '$Time' order by dat asc limit 1";
$Result_Downloads2 = mysql_query($Query_Downloads);
$LastSubmission = mysql_fetch_array($Result_Downloads2));
$LastSubmission = $LastSubmission['dat'];


Thats theoretical - i've not tested it. If it works then it will return the timestamp of the most recent submission in the downloads table.

It should not be run in the core but somewhere in the main page itself otherwise you risk breaking the core and we both know how fragile that is!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum