~grubng-dev/grubng/servers-dispatch-php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php

require_once("utils.php");

function check_login($user, $pass)
{
  $host = "grub.org";
  $uri = "?q=en/services/xmlrpc";
  $result = xu_rpc_http_concise(
				array(
				      'method' => "system.connect",
				      'host'  => $host,
				      'uri'  => $uri,
				      'port'  => 80
				      )
				);
  $session = $result["sessid"];
  $result = xu_rpc_http_concise(
				array(
				      'method' => "user.login",
				      'host'  => $host,
				      'uri'  => $uri,
				      'port'  => 80,
				      'args' => array($session, $user, $pass)
				      )
				);
  $session = $result["sessid"];
  if ($session == "")
    {
      return false;
    }
  $result = xu_rpc_http_concise(
				array(
				      'method' => "user.logout",
				      'host'  => $host,
				      'uri'  => $uri,
				      'port'  => 80,
				      'args' => array($session)
				      )
				);
  return true;
}
?>