Reset Counter

Started on the old forum in March 2007 · view the original in the archive · old links redirect here

10 replies · 911 views · started 19 years ago · 1 min read

2 participants
wizard Senior · 493 posts #1

i did a code to reset d counter in my toplist n show the time left before next reset. does anyone kno wuts wrong with this code?

function resetcounter() {
$now = time();
$tnow=date("H:i:s n/j/y",$now);
$lastreset = mysql_fetch_array(mysql_query("SELECT value FROM wiz_settings WHERE name='lastreset'"));
$lastreset = strtotime($lastreset[0]);

$res=mktime(date("H",$lastreset),date("i",$lastreset),date("s",$lastreset),date("n",$lastreset),date("j",$lastreset)+1,date("y",$lastreset));

$resettime=$res-$tnow;
$resetminutes=$resettime/60;
$resethours=$resettime/3600;
$resetdays=$resethours/24;
$resetmonths=$resetdays/30;
$resetyears=$resetdays/365;
$reset = date("H:i:s n/j/y",$res);

if($reset==$tnow) {

$resetted = mysql_query("UPDATE wiz_sites SET hin='0',hout='0'");
$resetted = mysql_query("UPDATE wiz_settings SET lastreset='".$tnow."'");
}
}
lamar-wap #2

i dont know im having the same problems too i need help just like you can anybody help us please?................................

Guest #3

it is very easy 😂

try this code

function resetcounter()
{
    $nowtime = date("d-m-Y");
    $resettime = mysql_fetch_array(mysql_query("SELECT value FROM wiz_settings WHERE name='lastreset'"));
    $resettime = $resettime[0];
$nowday = date("d");
$nnowday = $nowday+1;
$nowmonth = date("m");
$nowyear = date("Y");

    if($resettime==$nowtime)
    {
        $res = mysql_query("UPDATE wiz_sites SET hin='0',hout='0'")
        $res = mysql_query("UPDATE wiz_settings SET lastreset='".$nnowday."-".$nowmonth."-".$nowyear."'");

    }
}

to lastreset write now time example : 16-03-2007

if you want to to see in index how time left add this code

$nowhours = date("H");
$nowminutes = date("i");
$nowseconds = date("s");
$lefthours = 24-$nowhours;
$leftminutes = 60-$nowminutes;
$leftseconds = 60-$nowseconds;

echo "Counters reset after: $lefthours hours $leftminutes minutes $leftseconds seconds";

if you find error or you want ask me , write me pm External image (may be gone)

Thank_You_Bot #4

<#thank#>

wizard Senior · 493 posts #5

there is an error

function resetcounter()
{
    $nowtime = date("d-m-Y");
    $resettime = mysql_fetch_array(mysql_query("SELECT value FROM wiz_settings WHERE name='lastreset'"));
    $resettime = $resettime[0];
$nowday = date("d");
$nnowday = $nowday+1;
$nowmonth = date("m");
$nowyear = date("Y");

    if($resettime==$nowtime)
    {
        $res = mysql_query("UPDATE wiz_sites SET hin='0',hout='0'")
        $res = mysql_query("UPDATE wiz_settings SET lastreset='".$nnowday."-".$nowmonth."-".$nowyear."'");
    }
$nowhours = date("H");
$nowminutes = date("i");
$nowseconds = date("s");
$lefthours = 24-$nowhours;
$leftminutes = 60-$nowminutes;
$leftseconds = 60-$nowseconds;

echo "Counters reset after: $lefthours hours $leftminutes minutes $leftseconds seconds";

}
Parse error: syntax error, unexpected T_VARIABLE in /home/funmobil/public_html/top/core.php on line 361

here

$res = mysql_query("UPDATE wiz_settings SET lastreset='".$nnowday."-".$nowmonth."-".$nowyear."'");
Guest #6

this code add to core.php

function resetcounter() { $nowtime = date("d-m-Y"); $resettime = mysql_fetch_array(mysql_query("SELECT value FROM wiz_settings WHERE name='lastreset'")); $resettime = $resettime[0]; $nowday = date("d"); $nnowday = $nowday+1; $nowmonth = date("m"); $nowyear = date("Y");

if($resettime==$nowtime)
{
    $res = mysql_query("UPDATE wiz_sites SET hin='0',hout='0'")
    $res = mysql_query("UPDATE wiz_settings SET lastreset='".$nnowday."-".$nowmonth."-".$nowyear."'");
}

this add to index

$nowhours = date("H"); $nowminutes = date("i"); $nowseconds = date("s"); $lefthours = 24-$nowhours; $leftminutes = 60-$nowminutes; $leftseconds = 60-$nowseconds;

echo "Counters reset after: $lefthours hours $leftminutes minutes $leftseconds seconds";

Guest #7

i think you add to core.php all code?

wizard Senior · 493 posts #8

i get this error Parse error: syntax error, unexpected T_VARIABLE in /home/funmobil/public_html/top/core.php on line 360 and this is all i have on core.php

function resetcounter()
{
    $nowtime = date("d-m-Y");
    $resettime = mysql_fetch_array(mysql_query("SELECT value FROM wiz_settings WHERE name='lastreset'"));
    $resettime = $resettime[0];
$nowday = date("d");
$nnowday = $nowday+1;
$nowmonth = date("m");
$nowyear = date("Y");

    if($resettime==$nowtime)
    {
        $res = mysql_query("UPDATE wiz_sites SET hin='0',hout='0'")
        $res = mysql_query("UPDATE wiz_settings SET lastreset='".$nnowday."-".$nowmonth."-".$nowyear."'");
    }

}
subzero Super moderator Fellow · 3,954 posts #9

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

Guest #11

ha ha ha lmao

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close