View Single Post
Old 11-29-2009, 08:02 AM   #7 (permalink)
peterjtracey
New Member
 
Join Date: Oct 2009
Model: 7100T
PIN: N/A
Carrier: ATT
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default PHP Server

A simple way to get up and running is to use PHP as the server with QCubed ORM objects:

Code:
<?
require('../../../qcubed/wwwroot/includes/prepend.inc.php');
 
$server = new SoapServer(null, array('uri' => "urn:keyringlabs.com"));
$server->addFunction("login");
$server->handle();
 
function login($email, $pass) {
	if (strlen($email) == 0) {
		return Array('serviceToken' => '');
	} elseif (strlen($pass) == 0) {
		return Array('serviceToken' => '');
	} else {
		$objMerchant = Merchant::LoadByEmailPassword($email, $pass);
		if ($objMerchant == null || $objMerchant->Id < 1) {
			return Array('serviceToken' => '');
		} else {
			$key = uniqid();
			$objSess = new Merchantsessions();
			$objSess->MerchantID = $objMerchant->Id;
			$objSess->ServiceToken = $key;
			$objSess->Save();
		}
	}
 
	$result = Array('serviceToken' => $key);
	return $result;
}
 
 
?>
Note that for real applications the password should be encrypted which requires a bit more work...
Offline   Reply With Quote