Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   TBDev (http://www.bvlist.com/forumdisplay.php?f=20)
-   -   Crazyhour (http://www.bvlist.com/showthread.php?t=12183)

elvira 22nd November 2019 19:48

Crazyhour
 
hello all,


what can be wrong here


http://shrani.si/f/B/yN/JdZ4A41/brez-naslova.png





Code:

        if (isset($CURUSER)) {
  $transfer_filename  = $BASEURL['cache'].'/transfer_crazyhour.txt';
  $crazyhour_filename = $BASEURL['cache'].'/crazy_hour.txt';
  $crazyhour_cache = fopen($crazyhour_filename,'r+');
  $crazyhour_var = fread($crazyhour_cache, filesize($BASEURL['cache'].'/crazy_hour.txt'));
  fclose($crazyhour_cache);
  $cimg = '\'FREE!\'';
  if ($crazyhour_var >= sqlesc(get_date_time()) && $crazyhour_var < sqlesc(get_date_time()) + 3600) { // is crazyhourmkprettytime(strtotime($leechwarnuntil) - gmtime())
      echo"
     
     
     

      w00 Vrijeme je za slobodne sate! Zavrsava u ".mkprettytime($crazyhour_var - time)."
". $cimg."
Svi torrenti su FREE/SLOBODNI i upload statistika se UTROSTRUCUJE!
".$cimg."
";
        if (is_file($transfer_filename))
            unlink($transfer_filename);
    }
    elseif ($crazyhour_var < sqlesc(get_date_time()) + 3600 && !is_file($transfer_filename)) { //== crazyhour over
        $transfer_file_created = fopen($transfer_filename, 'w');
        fclose($transfer_file_created);
        $crazyhour['crazyhour_new']      = mktime(23, 59, 59, date('m'), date('d'), date('y'));
        $crazyhour['crazyhour']['var']    = mt_rand($crazyhour['crazyhour_new'],  ($crazyhour['crazyhour_new'] + 86400);
        $fp = fopen($crazyhour_filename, 'w');
        fwrite($fp, $crazyhour['crazyhour']['var']);
        fclose($fp);
        write_log('Naslednji slobodni sati u '.gmdate('Y-m-d H:i', $crazyhour['crazyhour'] ['var']));
        echo"
"." Crazyhour will be ".get_date_time($crazyhour['crazyhour']['var'], '')." -------------- ".mkprettytime(strtotime($crazyhour['crazyhour']['var'] - gmtime()))." remaining till Crazyhour
";
        }
        else // make date look prettier with countdown etc even :]
        echo"
"." Crazyhour will be ".get_date_time($crazyhour_var, '')."  ".mkprettytime(strtotime($crazyhour_var - gmtime()))." remaining till Crazyhour
";
        }




Thanks for help

Napon 23rd November 2019 13:42

what is it your trying to do and what core are you using 08 09 ?

elvira 23rd November 2019 13:48

its for 08 and if you can see on picture not show me a date

Napon 23rd November 2019 14:15

did you 0777 crazyhour.txt and folder to 0777 ill look into it

elvira 23rd November 2019 14:19

yes have to 0777 crazyhour.txt and transfer_crazyhour.zxz

Napon 23rd November 2019 15:17

You are missing a few files from what i can see ill post up when done a demo on server do not worry fix be done for you

elvira 23rd November 2019 15:33

ok, you will post today

Napon 23rd November 2019 15:56

Pm me all your files on this upload them some where so i can download em

elvira 23rd November 2019 16:31

This code is for TBDev09 some changes we must make to work on TBDev 08


announce.php


Code:

    if ( strtoupper( substr(PHP_OS, 0, 3) ) == 'WIN' )
      {
        $file_path = str_replace( "\\", "/", dirname(__FILE__) );
        $file_path = str_replace( "/include", "", $file_path );
      }
      else
      {
        $file_path = dirname(__FILE__);
        $file_path = str_replace( "/include", "", $file_path );
      }
     
    define('ROOT_PATH', $file_path);


and this



Code:

$BASEURL["cache"] = ROOT_PATH.'cache';

and this too


Code:

        $crazyhour = crazyhour_announce();
      if ($upthis > 0 || $downthis > 0)   
      mysql_query("UPDATE users SET uploaded = uploaded + ".(!$crazyhour?"$upthis":"$upthis*3").(!$crazyhour?", downloaded = downloaded + $downthis ":'')." WHERE id=$userid") or err("Tracker error 3");


then in fuctions.php add


Code:

        if (isset($CURUSER)) {
  $transfer_filename  = $BASEURL['cache'].'/transfer_crazyhour.txt';
  $crazyhour_filename = $BASEURL['cache'].'/crazy_hour.txt';
  $crazyhour_cache = fopen($crazyhour_filename,'r+');
  $crazyhour_var = fread($crazyhour_cache, filesize($BASEURL['cache'].'/crazy_hour.txt'));
  fclose($crazyhour_cache);
  $cimg = '\'FREE!\'';
  if ($crazyhour_var >= TIME_NOW && $crazyhour_var < TIME_NOW + 3600) { // is crazyhour
      $htmlout .="
     
     
     

      w00t It's Crazyhour! Ends in ".mkprettytime($crazyhour_var - TIME_NOW)."
". $cimg."
All torrents are FREE and upload stats are TRIPLED!
".$cimg."
";
        if (is_file($transfer_filename))
            unlink($transfer_filename);
    }
    elseif ($crazyhour_var < TIME_NOW + 3600 && !is_file($transfer_filename)) { //== crazyhour over
        $transfer_file_created = fopen($transfer_filename, 'w') or die('no perms?');
        fclose($transfer_file_created);
        $crazyhour['crazyhour_new']      = mktime(23, 59, 59, date('m'), date('d'), date('y'));
        $crazyhour['crazyhour']['var']    = mt_rand($crazyhour['crazyhour_new'], ($crazyhour['crazyhour_new'] + 86400));
        $fp = fopen($crazyhour_filename, 'w');
        fwrite($fp, $crazyhour['crazyhour']['var']);
        fclose($fp);
        write_log('Next Crazyhour is at '.date('F j, g:i a T', $crazyhour['crazyhour'] ['var']));
        $htmlout .="
"." Crazyhour will be ".get_date($crazyhour['crazyhour']['var'], '')."  ".mkprettytime($crazyhour['crazyhour']['var'] - TIME_NOW)." remaining till Crazyhour
";
        }
        else // make date look prettier with countdown etc even :]
        $htmlout .="
"." Crazyhour will be ".get_date($crazyhour_var, '')."  ".mkprettytime($crazyhour_var - TIME_NOW)." remaining till Crazyhour
";
        }    }


Napon 23rd November 2019 16:35

i need to make a function to call on the
crazyhour_announce time start and end of date also a mysql too for this to work with the cache too

elvira 23rd November 2019 16:51

in cache folder goes txt files nothing else just must be 0777 to

Napon 23rd November 2019 21:04

show me the 09 one thread for this

elvira 23rd November 2019 21:36

this is it..all code posts nothing else

Napon 24th November 2019 00:04

So you telling me this all it needs i think not just looked in to it


this should be on the announce
Code:

  function crazyhour_announce() {
  global $SHITE;
  $transfer_filename  = $SHITE['cache'].'transfer_crazyhour.txt';
  $crazyhour_filename = $SHITE['cache'].'crazy_hour.txt';
  $crazyhour_cache = fopen($crazyhour_filename,'r+');
  $crazyhour_var = fread($crazyhour_cache, filesize($crazyhour_filename));
  fclose($crazyhour_cache);
  if ($crazyhour_var >= TIME_NOW && $crazyhour_var < TIME_NOW + 3600) { // is crazyhour
  if (is_file($transfer_filename))
        unlink($transfer_filename);
    return true;
    }
    elseif ($crazyhour_var < TIME_NOW + 3600 && !is_file($transfer_filename)) {  // crazyhour over
        $transfer_file_created = fopen($transfer_filename, 'w') or die('no perms?');
        fclose($transfer_file_created);
        $crazyhour['crazyhour_new']      = mktime(23, 59, 59, date('m'), date('d'), date('y'));
        $crazyhour['crazyhour']['var']    = mt_rand($crazyhour['crazyhour_new'], ($crazyhour['crazyhour_new'] + 86400));
        $fp = fopen($crazyhour_filename, 'w');
        fwrite($fp, $crazyhour['crazyhour']['var']);
        fclose($fp);
        mysql_query("INSERT INTO sitelog (added, txt) VALUES('.TIME_NOW.', '.sqlesc($text).')') or err("Crazyhour Err");
        return false;
        }else
        return false;
        }

Code:

  $happy = mysql_query("SELECT id, multiplier from happyhour where userid=" . sqlesc( $userid ) . " AND torrentid=" . sqlesc( $torrentid ) . " " );
  $happyhour = mysql_num_rows( $happy ) == 0 ? false : true;
  $happy_multi = mysql_fetch_row( $happy );
  $multiplier = $happy_multi["multiplier"];
  if ( $happyhour ) {
  $upthis = $upthis * $multiplier;
  $downthis = 0;
  }

Also you need to add to cleanup

Also there alot more to ths mod how do you think its going to work just with a few line of code Heads up no you need the rest of the code ive just test the full code on 08 and works a treat and you call your self coders

elvira 24th November 2019 00:51

look picture not show correctly date...first date and clock are ok then second one problem



http://shrani.si/f/42/aZ/1pmOwD1U/brez-naslova.png


All times are GMT +2. The time now is 07:04.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.