Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
API integration with .net Web application
11-12-2017, 09:33 PM,
#6
RE: API integration with .net Web application
Hi, the problem with modifying the api is always to keep compatibility with existing applications that use it.

I would do something like the following (Nb I haven't tried this, so you may need to experiment a little)

Change each function call like this:

function InsertBranch($BranchDetails, $user, $password) becomes function InsertBranch($BranchDetails, $user, $password, $database_name='')

Then each function has a line

$db = db($user, $password);

which needs to be

$db = db($user, $password, $database_name);

Then within api_php.php the function declaration becomes:

function db($user, $password, $database_name) {
if (!isset($_SESSION['AccessLevel']) or $_SESSION['AccessLevel'] == '') {
// Login to default database = old clients.
if ($user != '' and $password != '') {
global $api_DatabaseName;
if ($database_name != '') {
$api_DatabaseName = $database_name;
}
$rc = LoginAPI($api_DatabaseName, $user, $password);
if ($rc[0] == UL_OK) {
return $_SESSION['db'];
}
}
return NoAuthorisation;
} else {
return $_SESSION['db'];
}
}

As I said I haven't actually tried it, but would be interested to know if it works out :-)

Tim
Reply


Messages In This Thread
RE: API integration with .net Web application - by TimSchofield - 11-12-2017, 09:33 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)