/** userControl takes control of usernames to reduce complexity in chessToast However it may be used with other programs in the future. You create a user and then you can access these users and recieve a primary key. This allows you to connect to remote databases Technical Specifications Need Updating. */ class userControl{ /** Connects to the webservice @var soapClient */ public $ws; public $serverId; /** This is to call hidden functions */ public function __call($name,$arguments){ return $this->ws->__soapCall($name, $arguments); } /** This is to call functions using old code */ public function __soapCall($name,$arguments){ return $this->ws->__soapCall($name, $arguments); } /** This is to set cookie values functions */ public function setCookies($cookies_csv){ if($cookies_csv != null){ $splitCookies = explode(",",$cookies_csv); foreach($splitCookies as $currentCookie){ $subSplit= explode("=",$currentCookie); $this->ws->__setCookie($subSplit[0], $subSplit[1]); } } } /** This used to connect to the database. I think it is much better to have a function do this. */ public function __construct($cookies_csv=null){ $this->serverId="http://soap.peterdownie.com/webServices/userControl/server.php"; $this->ws = new SoapClient(null,array("uri"=>"$this->serverId","location"=>"$this->serverId")); $this->setCookies($cookies_csv); return $this->ws->__soapCall("__construct",array()); } /** Needs to be called for this web service to work. Optional $options can contain lowercase port, socket, projectIdentification and prePend */ public function database_setup($host,$user,$password,$database,$options){ return $this->ws->__soapCall("database_setup",array($host,$user,$password,$database,$options)); } /** Create new user allows you to create a user for the database and project combo */ public function createNewUser($username,$email,$unSaltedPassword,$passwordHint){ return $this->ws->__soapCall("createNewUser",array($username,$email,$unSaltedPassword,$passwordHint)); } /** Valid Login makes sure that a user with that password is in the database/project combination. */ public function login($username,$unSaltedPassword){ return $this->ws->__soapCall("login",array($username,$unSaltedPassword)); } /** Replaces a bunch of functions to make the webservice easier to learn Request Values password_hint, exists, validated password_hint: Retrieves the password hint for a given user. Returns string of the password hint exists: Checks to see if the given username is already in the database, returns a string validated: returns a string which has 3 possible values. */ public function get_username_data($request,$username){ return $this->ws->__soapCall("get_username_data",array($request,$username)); } /** Allows changing of a users data! changeType(s): email, password */ public function change_user_data($changeType,$username,$unsaltedPassword,$newDataArray){ return $this->ws->__soapCall("change_user_data",array($changeType,$username,$unsaltedPassword,$newDataArray)); } /** Create a recovery password, keys of username, or email */ public function createRecoveryCode($input_array){ return $this->ws->__soapCall("createRecoveryCode",array($input_array)); } /** Verify makes sure that the user has the email address they stated. */ public function verifyUsername($username,$verificationCode){ return $this->ws->__soapCall("verifyUsername",array($username,$verificationCode)); } /** Recovery using a temp code is a way of recovering a password when you have the email address associated with the temp Code. */ public function recoverUsingTempCode($username,$tempCode,$newUnsaltedPassword){ return $this->ws->__soapCall("recoverUsingTempCode",array($username,$tempCode,$newUnsaltedPassword)); } /** possible data requests are username, email, lastSignInData and signUpData */ public function getDataByUserID($data_requested,$user_ID){ return $this->ws->__soapCall("getDataByUserID",array($data_requested,$user_ID)); } }