Reset Counter

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Reset Counter

    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?
    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."'");
    }
    }

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

    Comment


      #3
      it is very easy :lol:

      try this code
      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
      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

      Comment


        #4
        <#thank#>

        Comment


          #5
          there is an error
          Code:
          function resetcounter()
          {
              $nowtime = date("d-m-Y");
              $resettime = mysql_fetch_array(mysql_query("SELECT value FROM wiz_settings WHERE name=&#39;lastreset&#39;"));
              $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=&#39;0&#39;,hout=&#39;0&#39;")
                  $res = mysql_query("UPDATE wiz_settings SET lastreset=&#39;".$nnowday."-".$nowmonth."-".$nowyear."&#39;");
              }
          $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";
          
          }
          Code:
          Parse error: syntax error, unexpected T_VARIABLE in /home/funmobil/public_html/top/core.php on line 361
          here
          Code:
          $res = mysql_query("UPDATE wiz_settings SET lastreset=&#39;".$nnowday."-".$nowmonth."-".$nowyear."&#39;");

          Comment


            #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=&#39;lastreset&#39;"));
            $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=&#39;0&#39;,hout=&#39;0&#39;")
            $res = mysql_query("UPDATE wiz_settings SET lastreset=&#39;".$nnowday."-".$nowmonth."-".$nowyear."&#39;");
            }

            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";

            Comment


              #7
              i think you add to core.php all code?

              Comment


                #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
                Code:
                function resetcounter()
                {
                    $nowtime = date("d-m-Y");
                    $resettime = mysql_fetch_array(mysql_query("SELECT value FROM wiz_settings WHERE name=&#39;lastreset&#39;"));
                    $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=&#39;0&#39;,hout=&#39;0&#39;")
                        $res = mysql_query("UPDATE wiz_settings SET lastreset=&#39;".$nnowday."-".$nowmonth."-".$nowyear."&#39;");
                    }
                
                }

                Comment


                  #9
                  lol
                  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...
                  _______
                  Info & Tips
                  php.net
                  w3schools.com

                  Comment


                    #10
                    sub can u help plz. i suck@ time management

                    Comment


                      #11
                      ha ha ha lmao

                      Comment

                      Working...
                      X