Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
Prev Previous Post   Next Post Next
  #1  
Old 09-11-2010, 02:14 PM
Bouncer222 Bouncer222 is offline
 
Join Date: Oct 2009
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Convert php script to use BCMath instead of GMP

Hey all, I need this script to use BCMath instead of GMP. My webserver is on a shared hosting and they don't support GMP. So the part of this code where there is GMP, I need to have it us BCMath instead, therefore it needs to be edited.

Please PM me with the price and how long this would take.
Thanks.

Code:
<?
 define("ACC_NAME", "bouncer222");
 define("ACC_PASS", "PASSWORDHERE");
 define("GROUP_ID", "103582791430981168"); // open steam group page and see "Enter chat room" link, which contains ID
 define("MY_STEAM_ID", "STEAM_0:0:35005283"); // steam ID which can invite to join group

 $invite_steam_id = $_GET['i'];

 $ids = file('invited_ids.txt');
 foreach($ids as $id) {
   $id = trim($id);
   if ( $id == $invite_steam_id )
     die($id .": Already invited!\n");
 }

 function GetFriendID( $steam_id ) {
   if ( !$steam_id )
     return 0;
   $auth = explode(':', $steam_id);
   if ( !$auth[2] )
     return 0;
   $fid = gmp_init($auth[2]);
   $fid = gmp_mul($fid, "2");
   $fid = gmp_add($fid, "76561197960265728");
   $fid = gmp_add($fid, $auth[1]);
   return gmp_strval($fid);
 }


 require_once "HTTP/Request.php";

 $req = &new HTTP_Request('https://steamcommunity.com');
 $req->setMethod(HTTP_REQUEST_METHOD_POST);

 $req->addPostData("action", "doLogin");
 $req->addPostData("goto", "");

 $req->addPostData("steamAccountName", ACC_NAME);
 $req->addPostData("steamPassword", ACC_PASS);

 echo "Login: ";

 $res = $req->sendRequest();
 if (PEAR::isError($res))
   die($res->getMessage());

 $cookies = $req->getResponseCookies();
 if ( !$cookies )
   die("fail!\n");

 echo "ok\n";

 foreach($cookies as $cookie)
   $req->addCookie($cookie['name'],$cookie['value']);

 $mid = GetFriendID(MY_STEAM_ID);
 $fid = GetFriendID($invite_steam_id);
 $url = "
 http://steamcommunity.com/actions/GroupInvite?type=groupInvite&inviter=$mid&invitee=$fid&group=";GROUP_ID;

 echo "Inviting $invite_steam_id ($fid): ";
 $req->setMethod(HTTP_REQUEST_METHOD_GET);
 $req->setUrl($url);

 $res = $req->sendRequest();
 if (PEAR::isError($res))
   die($res->getMessage());

 $data = $req->getResponseBody();
 preg_match("/CDATA\[([^\]]+)\]/", $data, $matches);
 echo $matches[1] . "\n";
 if ( $matches[1] == "OK" )
   file_put_contents('invited_ids.txt', $invite_steam_id . "\n",
 FILE_APPEND);
 ?>
You can also use this php snippet to replace the GMP one maybe (I have almost zero knowledge in php, I found this on a site, it's suposed to also do the same function that the GMP does.

Code:
__int64 GetFriendID( const char *pszAuthID )
{
    if(!pszAuthID)
        return 0;

    int iServer = 0;
    int iAuthID = 0;

    char szAuthID[64];
    strcpy_s(szAuthID, 63, pszAuthID);

    char *szTmp = strtok(szAuthID, ":");
    while(szTmp = strtok(NULL, ":"))
    {
        char *szTmp2 = strtok(NULL, ":");
        if(szTmp2)
        {
            iServer = atoi(szTmp);
            iAuthID = atoi(szTmp2);
        }
    }

    if(iAuthID == 0)
        return 0;

    __int64 i64friendID = (__int64)iAuthID * 2;

    //Friend ID's with even numbers are the 0 auth server.
    //Friend ID's with odd numbers are the 1 auth server.
    i64friendID += 76561197960265728 + iServer; 

    return i64friendID;
}
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:49 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03596 seconds
  • Memory Usage 2,238KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete