Reset MBrahmanPoints in both .TAD and MSSQL

Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    Tantra Freelancer A v a r a is offline
    MemberRank
    Apr 2014 Join Date
    In Your HeadLocation
    554Posts

    Reset MBrahmanPoints in both .TAD and MSSQL

    To whom it may concern:

    Who know how to reset the MBrahmanPoints in both .TAD and MSSQL. I know its easy doing it MSSQL but in .TAD I don't have any knowledge. Please shred me some lights. Thanks.


  2. #2
    Valued Member John Ray is offline
    MemberRank
    Jan 2013 Join Date
    Zamboanga City,Location
    143Posts

    Re: Reset MBrahmanPoints in both .TAD and MSSQL

    Update to this??

  3. #3
    Enthusiast alxndr is offline
    MemberRank
    Nov 2012 Join Date
    Lima, PerúLocation
    45Posts

    note Re: Reset MBrahmanPoints in both .TAD and MSSQL

    Still don't know why do you need this, but here you go.

    PHP Code:
    <?php
    $accountsPath 
    'D:\\account';
    $accountsPathZeroMP 'D:\\account_zero_mp';

    function 
    endsWith($haystack$needle)
    {
      return 
    $needle === "" || substr($haystack, -strlen($needle)) === $needle;
    }

    function 
    find($path){
      global 
    $accountsPath$accountsPathZeroMP;
      foreach( 
    glob$path "\\*" ) as $filename ) {
        if(
    filetype($filename) == 'dir')
          
    find($filename);
        
        if(
    endsWith($filename,'.TAD') or endsWith($filename,'.tad')){
          
    $open fopen($filename,'rb');
          
    $read fread($open,filesize($filename));
          
    $newTAD substr_replace(substr_replace(substr_replace(bin2hex($read),'00000000',272,8),'00000000',3648,8),'00000000',7024,8); //reset to zero master point
          
    $newTAD substr_replace(substr_replace(substr_replace($newTAD,'00000000',2816,8),'00000000',6192,8),'00000000',9568,8); // reset to zero monthly master point
          
    fclose($open);
          
                
    $newFileName str_replace($accountsPath,$accountsPathZeroMP,$filename);
                
                if(!
    file_exists(dirname($newFileName))){
            
    mkdir(dirname($newFileName), 0777true);
          }
                
          
    $target fopen($newFileName,'wb');
          
    fwrite($target,hex2bin($newTAD));
          
    fclose($target);
          
        }
      }
    }

    find($accountsPath);
    echo 
    'Finished';
    ?>
    Just put it on your apache server with php or whatever you have and update the directories of course!

  4. #4
    Tantra/Web Development jbeitz107 is offline
    MemberRank
    Mar 2012 Join Date
    USALocation
    1,471Posts

    Re: Reset MBrahmanPoints in both .TAD and MSSQL

    Well done alxndr. Have you tested this code already?

  5. #5
    Enthusiast alxndr is offline
    MemberRank
    Nov 2012 Join Date
    Lima, PerúLocation
    45Posts

    Re: Reset MBrahmanPoints in both .TAD and MSSQL

    @jbeitz107 just tested on some *.TAD files and compared the modified and the original one at binary level nothing else, but it seems it's ok :)

  6. #6
    Tantra Freelancer A v a r a is offline
    MemberRank
    Apr 2014 Join Date
    In Your HeadLocation
    554Posts

    Re: Reset MBrahmanPoints in both .TAD and MSSQL

    Quote Originally Posted by alxndr View Post
    Still don't know why do you need this, but here you go.

    PHP Code:
    <?php
    $accountsPath 
    'D:\\account';
    $accountsPathZeroMP 'D:\\account_zero_mp';

    function 
    endsWith($haystack$needle)
    {
      return 
    $needle === "" || substr($haystack, -strlen($needle)) === $needle;
    }

    function 
    find($path){
      global 
    $accountsPath$accountsPathZeroMP;
      foreach( 
    glob$path "\\*" ) as $filename ) {
        if(
    filetype($filename) == 'dir')
          
    find($filename);
        
        if(
    endsWith($filename,'.TAD') or endsWith($filename,'.tad')){
          
    $open fopen($filename,'rb');
          
    $read fread($open,filesize($filename));
          
    $newTAD substr_replace(substr_replace(substr_replace(bin2hex($read),'00000000',272,8),'00000000',3648,8),'00000000',7024,8); //reset to zero master point
          
    $newTAD substr_replace(substr_replace(substr_replace($newTAD,'00000000',2816,8),'00000000',6192,8),'00000000',9568,8); // reset to zero monthly master point
          
    fclose($open);
          
                
    $newFileName str_replace($accountsPath,$accountsPathZeroMP,$filename);
                
                if(!
    file_exists(dirname($newFileName))){
            
    mkdir(dirname($newFileName), 0777true);
          }
                
          
    $target fopen($newFileName,'wb');
          
    fwrite($target,hex2bin($newTAD));
          
    fclose($target);
          
        }
      }
    }

    find($accountsPath);
    echo 
    'Finished';
    ?>
    Just put it on your apache server with php or whatever you have and update the directories of course!
    Thanks but from what I understand in the code its the reset for both Master Points & Monthly Master Points correct? I only wanted to reset the Monthly Master Points to be reset is it possible for this code given?

  7. #7
    Enthusiast alxndr is offline
    MemberRank
    Nov 2012 Join Date
    Lima, PerúLocation
    45Posts

    Re: Reset MBrahmanPoints in both .TAD and MSSQL

    @A v a r a just comment or delete the line of code where master point are being replaced.

  8. #8
    Tantra Freelancer A v a r a is offline
    MemberRank
    Apr 2014 Join Date
    In Your HeadLocation
    554Posts

    Re: Reset MBrahmanPoints in both .TAD and MSSQL

    Quote Originally Posted by alxndr View Post
    @A v a r a just comment or delete the line of code where master point are being replaced.
    I tried this but neither of my master points (total and monthly) didn't reset to zero.

  9. #9
    Enthusiast alxndr is offline
    MemberRank
    Nov 2012 Join Date
    Lima, PerúLocation
    45Posts

    Re: Reset MBrahmanPoints in both .TAD and MSSQL

    @A v a r a post a .TAD file and i'm going to show a demonstration.

  10. #10
    Tantra Freelancer A v a r a is offline
    MemberRank
    Apr 2014 Join Date
    In Your HeadLocation
    554Posts

    Re: Reset MBrahmanPoints in both .TAD and MSSQL

    Quote Originally Posted by alxndr View Post
    @A v a r a post a .TAD file and i'm going to show a demonstration.
    Here you go ESOJ.rar

  11. #11
    Enthusiast alxndr is offline
    MemberRank
    Nov 2012 Join Date
    Lima, PerúLocation
    45Posts

    Re: Reset MBrahmanPoints in both .TAD and MSSQL

    @A v a r a just made this showcase, check.

  12. #12
    Tantra Freelancer A v a r a is offline
    MemberRank
    Apr 2014 Join Date
    In Your HeadLocation
    554Posts

    Re: Reset MBrahmanPoints in both .TAD and MSSQL

    Quote Originally Posted by alxndr View Post
    @A v a r a just made this showcase, check.
    Now I get it so it creates a new folder for the new .TAD files and I have to replace the original .TAD files using the .TAD files generated in the "$accountsPathZeroMP"

  13. #13
    Enthusiast alxndr is offline
    MemberRank
    Nov 2012 Join Date
    Lima, PerúLocation
    45Posts

    Re: Reset MBrahmanPoints in both .TAD and MSSQL

    @A v a r a yeah, it's better to backup the original just in case.

  14. #14
    Tantra Freelancer A v a r a is offline
    MemberRank
    Apr 2014 Join Date
    In Your HeadLocation
    554Posts

    Re: Reset MBrahmanPoints in both .TAD and MSSQL

    Quote Originally Posted by alxndr View Post
    @A v a r a yeah, it's better to backup the original just in case.
    Good job by the way. What I am going to do now is to automate this one to reset MBrahmanPoints monthly.

  15. #15
    Tantra/Web Development jbeitz107 is offline
    MemberRank
    Mar 2012 Join Date
    USALocation
    1,471Posts

    thumbs up Re: Reset MBrahmanPoints in both .TAD and MSSQL

    Update to alxndr's code. This will reset all master points in a single directory. Use with caution. It has been tested here but, may not work for everyone. Please test it first. It was designed for older versions of xampp prior to 1.8.1. Thanks again alxndr for your code. I will continue to work on single accounts but, tonight I am too tired. Lol
    PHP Code:
    <?php
    //Change to your directory for your accounts. 
    $accdir="C:\Server\YourDirectorylocation";
    echo 
    "READY TO BEGIN RESETTING MASTER POINTS<br>";
    if (
    $_POST['action'] == 'submitted'){
    $accountsPath $accdir
    $accountsPathZeroMP $accdir

    function 
    endsWith($haystack$needle

      return 
    $needle === "" || substr($haystack, -strlen($needle)) === $needle


    function 
    find($path){ 
      global 
    $accountsPath$accountsPathZeroMP
      foreach( 
    glob$path "\\*") as $filename ) { 
        if(
    filetype($filename) == 'dir'
          
    find($filename); 
         
        if(
    endsWith($filename,'.TAD') or endsWith($filename,'.tad')){ 
          
    $open fopen($filename,'rb'); 
          
    $read fread($open,filesize($filename)); 
          
    $newTAD substr_replace(substr_replace(substr_replace(bin2hex($read),'00000000',272,8),'00000000',3648,8),'00000000',7024,8); //reset to zero master point 
          
    $newTAD substr_replace(substr_replace(substr_replace($newTAD,'00000000',2816,8),'00000000',6192,8),'00000000',9568,8); // reset to zero monthly master point 
          
    fclose($open); 
           
                
    $newFileName str_replace($accountsPath,$accountsPathZeroMP,$filename); 
                 
                if(!
    file_exists(dirname($newFileName))){ 
            
    mkdir(dirname($newFileName), 0777true); 
          } 
                 
          
    $target fopen($newFileName,'wb'); 
          
    //New Mod for older php versions
          
    fwrite($target,pack('H*',$newTAD)); 
          
    fclose($target); 
           
        } 
      } 


    find($accountsPath); 
    echo 
    '<b><font color=green>Finished Resetting all Master Points</font></b><br>'

    }
    ?>
    <form id="resetmp"  method="POST" action="resetmp.php">
                <input type="Submit" Value="Reset All Accounts Master Points">
                <input type="hidden" name="action" value="submitted">
                </form>
    Last edited by jbeitz107; 25-08-14 at 10:34 AM.



Page 1 of 2 12 LastLast

Advertisement