Results 1 to 8 of 8
-
6th Apr 2012, 12:31 AM #1OPBannedWebsite's:
WarezRelease.org ThatHosting.coDisplay banned sites + their time
this is the right way to show? cos nothing is displaying:
PHP Code:$current = time();
$expiry = mysql_query("SELECT url,expires FROM wcddl_blacklist WHERE expires < IN(0,86400,259200,604800,864000,1209600,2592000)");
while($row = mysql_fetch_assoc($expiry)) {
$getExpireSites = $row['expires'];
$Bsite = $row['url'];
$diff = $current-$getExpireSites;
switch(1) {
case($diff > 60 && $diff < 3600);
$count = floor($diff / 60);
if ($count == 1) $suffix = 'minute';
else $suffix = 'minutes';
break;
case($diff > 3600 && $diff < 86400);
$count = floor($diff / 3600);
if ($count == 1) $suffix = 'hour';
else $suffix = 'hours';
break;
}
echo '<div align="center">Your '. $Bsite .'\'s ban expires in '. $count .' '. $suffix .'</div><br />';
}
EDIT:updated query, still no l7uxk......Chris2k Reviewed by Chris2k on . Display banned sites + their time this is the right way to show? cos nothing is displaying: $current = time(); $expiry = mysql_query("SELECT url,expires FROM wcddl_blacklist WHERE expires < IN(0,86400,259200,604800,864000,1209600,2592000)"); while($row = mysql_fetch_assoc($expiry)) { $getExpireSites = $row; $Bsite = $row; Rating: 5
-
6th Apr 2012, 03:36 AM #2You can call me G
At first glance, appears as bad use of the switch statement.
Here's how the cases are evaluated:
PHP Code:switch($x) {
case 'blah':
echo "Something";
break;
case 'w00t':
echo "uhmm";
default:
echo "meh";
}
lets say we have the following set of values for x: "blah","w00t","crap"
the output in each case will be:
1. Something
2. uhmmmeh
3. meh
I think its clear from above that case only checks if $x has the same value as the one specified in the case else default block is executed.
also, the statements following a case block that matches successfully are executed until a break is encountered or the end of a switch block (refer to output 2)
Go ahead, make some changes to the control structures now
Regards,
Gaurav
My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz
-
6th Apr 2012, 10:51 AM #3MemberWebsite's:
tehMoviez.com 0Senes.com GeekFaceGames.comyou can only use switch statement for equalities.
PHP Code:$current = time();
$expiry = mysql_query("SELECT url,expires FROM wcddl_blacklist WHERE expires < IN(0,86400,259200,604800,864000,1209600,2592000)");
while($row = mysql_fetch_assoc($expiry)) {
$getExpireSites = $row['expires'];
$Bsite = $row['url'];
$diff = $current-$getExpireSites;
if($diff > 60 && $diff < 3600)[{
$count = floor($diff / 60);
if ($count == 1) $suffix = 'minute';
else $suffix = 'minutes';
} elseif ($diff > 3600 && $diff < 86400){
$count = floor($diff / 3600);
if ($count == 1) $suffix = 'hour';
else $suffix = 'hours';
}
echo '<div align="center">Your '. $Bsite .'\'s ban expires in '. $count .' '. $suffix .'</div><br />';
}
JokerHacker Blog
JokerHacker PHP coding Service // back again!
CurlAxel PHP Download Accelerator
hardly remembering the milk :p
-
6th Apr 2012, 09:35 PM #4OPBannedWebsite's:
WarezRelease.org ThatHosting.coHi
ive got it working, the query was wrong.....
Hmm now im looking to do a cuount to the banned times:
$allowed = array(
'bTime' => array(0,86400,259200,604800,864000,1209600,2592000 ),
then delete if expired.
any Help??????
-
7th Apr 2012, 05:17 PM #5Respected Member
I really don't understand what you are asking.
$time is now.
$expires is length of ban.
what is the variable for starting time of the banishment???
-
8th Apr 2012, 03:27 PM #6OPBannedWebsite's:
WarezRelease.org ThatHosting.coIm not sure how i'd go about a start time?
I only insert the expires time.
---------- Post added at 04:27 PM ---------- Previous post was at 01:10 AM ----------
My bad, i've the date converted by strtotime() func, so thats the start time,....
now just need help doing the if the time's expired, then delete..
-
9th Apr 2012, 04:20 PM #7OPBannedWebsite's:
WarezRelease.org ThatHosting.cobump
-
16th Apr 2012, 08:48 PM #8OPBannedWebsite's:
WarezRelease.org ThatHosting.cohere's my updated code:
PHP Code:$x = 0;
$current = time();
$expiry = mysql_query("SELECT * FROM wcddl_blacklist WHERE expires < 2592000 AND expires > 43200");
while($row = mysql_fetch_assoc($expiry)) {
$blackurl = $row['url'];
$expires = $row['expires'];
//Should be: Ymd, so we implode it.
$sDate = preg_replace('/[^a-zA-Z0-9 ]/','',$row['dat']);
$todays_date = date('Ymd', mktime (0, 0, 0, date ('m'), date ('d'), date ('Y')));
//Convert $sDate to timestamp.
$timestamp = strtotime($sDate);
$timestamp += 24*60*60 + $expires;
$expiry_date = date("Ymd", $timestamp);
if ($expiry_date >= $todays_date) {
mysql_query("DELETE FROM wcddl_blacklist WHERE url='". $blackurl ."'");
$x++;
}
echo '<p class="warn_message">Still banned: '. $blackurl .' for '. ($timestamp - $expires / 3600) .' hours</p>';
}
echo '<p class="warn_message">'. $x .' sites have been automatically unbanned.</p>';
Any help?
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
It's time to add the Open Graph to Sites
By Mr Happy in forum Feedback and SuggestionsReplies: 5Last Post: 21st Mar 2012, 04:13 AM -
File sharing sites, that pays and has no down time?
By johnwooo in forum Webmasters, Money MakingReplies: 9Last Post: 7th Sep 2011, 11:09 PM -
Download Sites - time to viability
By winton in forum Polling PlazaReplies: 1Last Post: 7th Sep 2011, 03:21 PM -
Any Good Pre Time Porn Sites?
By dede110 in forum File Host DiscussionReplies: 9Last Post: 26th Jun 2011, 01:16 PM -
How To: Display Time & Date on Site/Forum
By iHate in forum Tutorials and GuidesReplies: 1Last Post: 25th Aug 2010, 06:41 PM
themaLeecher - leech and manage...
Version 5.03 released. Open older version (or...