Jump to content

Automation: suspend TCAdmin user from my admincenter


Kian

Recommended Posts

Hi all

 

Right now i finished to create my GSP admincenter. There is everything i need for my business:

 

-Customers management (active, suspend, send email, invoices, services)

-Mailer system (automatically send payment overdue reminder 7, 3 and 1 day before service is suspended. In the message there is also "pay now" link with paypal. Just click and you are redirected to paypal page for payment. If user is English email will be written in English, if he's Italian in Italian lenguage and so on)

-Article management (inside panel you can change slot price, add / remove article. When you've done all config+payment modules will be automatically updated)

-System monitor (if there is a problem with a service, maintenance... you simply need to change the status of your service -gameserver, voiceserver, tcadmin, webadmin, site- to "offline" or whatever you want providing also full details and a log. When the service is fixed just click "Reset" button)

-Monthly balance of your business

 

Now everything is powered by ---> automation. I only need to set up services and reply support ticket. That's ok but what i miss is: auto-suspend user on TCAdmin.

 

I've Web hosting tcadmin license and mysql database. My GSP admincenter is php+mysql so it's perfect. What i want to do is to suspend TCAdmin user when i click "Suspend" in my panel. I think "Suspend" status is a simple number "0" or "1" in user_table of database. The problem is that i think that i can't automatically suspend user only changing the number, i've to run TCAdmin script right? Can i do it with demon cron function?

 

Thank you for your time and sorry for my English :o

Link to comment
Share on other sites

It's better using TCAdmin billing api for this.

i'm using curl to make calls:

 function suspend_TCAdmin_User($CLIENTPACKAGEID, $TCADMINADMIN, $TCADMINPASSWORD)
 {
   $post_params = 'function=SuspendGameAndVoiceByBillingID&response_type=text&tcadmin_username=$TCADMINADMIN&tcadmin_password=$TCADMINPASSWORD&';
   $post_params .= sprintf('client_package_id=%d', $CLIENTPACKAGEID);
   $ret = trim(do_console_post($post_params, 'http://xxx.xxx.xxx.xxx/billingapi.aspx'));

   //add some error handler here for $ret (TCAdmin is responding: "Suspended X game servers and Y voice servers." where X & Y are integers
  }

function do_console_post($str_post, $url)
{
$fp = fopen("/tmp/curl.log", "a"); // very usefull for debugging  But remember to remove it in production !
$ch = curl_init($url);
if ($ch)
{
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $str_post);

	curl_setopt($ch, CURLOPT_VERBOSE, 0);
	curl_setopt($ch, CURLOPT_STDERR, $fp);

	$page = curl_exec($ch);

	curl_close($ch);
	return($page);
}
else
	return("-1");
}

 

I'm really sorry but i dont remember where you can found TCAdmin Billing API Documentation !

BTW, this can work only if you filled "client package id" value in TCAdmin ;) And it's suspending all customers servers. To reenable them, it's same thing except function name: UnSuspendGameAndVoiceByBillingID

 

Hope this helps!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use