Ejemplo n.º 1
0
 public function get_userinfo($userid, $password)
 {
     //select the database
     mssql_select_db($this->dbname, $this->dbcon);
     //SQL Select statement
     $sqlselect = "SELECT userid,password,userright,ws,ws_name,location,fullname,gender,position,member_since,avatar FROM pospass WITH (NOLOCK) WHERE userid ='" . $userid . "';";
     //Run the SQL query
     $sqlquery = mssql_query($sqlselect);
     $string_result = '{"uservalidation":"false"}';
     //$login = new Blowfish();
     //$encpassword = $login->genpwd($password);
     $encpassword = $this->encryptIt($password);
     while ($result = mssql_fetch_array($sqlquery)) {
         //$verify = $login->verify_hash($password, $result["password"]);
         if ($encpassword == $result["password"]) {
             $xml = new XMLHandler(LOCAL_DIR . "/etc/greenSys.config.xml");
             $_SESSION["activedb"] = (string) $xml->Child("locationmapping", $result["location"]);
             $_SESSION["user-id"] = (string) $userid;
             $_SESSION["user-ws"] = (string) $result["ws"];
             $_SESSION["ws-name"] = (string) $result["ws_name"];
             $_SESSION["user-fullname"] = (string) $result["fullname"];
             $_SESSION["user-gender"] = (string) $result["gender"];
             $_SESSION["user-position"] = (string) $result["position"];
             $_SESSION["user-member_since"] = (string) $result["member_since"];
             $_SESSION["user-avatar"] = (string) $result["avatar"];
             //session_write_close();
             //setcookie("user-id",(string)$userid, time()+3600*24);
             $string_result = '{"uservalidation":"true","fullname":"' . $result["fullname"] . '","gender":"' . $result["gender"] . '","position":"' . $result["position"] . '","member_since":"' . $result["member_since"] . '","avatar":"' . $result["avatar"] . '"}';
         }
     }
     return $string_result;
 }
Ejemplo n.º 2
0
 public function LoadSettings()
 {
     try {
         $xml = new XMLHandler(LOCAL_DIR . "/etc/greenSys.config.xml");
         $this->dbhost = $xml->Child("database", "dbhost");
         $this->dbuser = $xml->Child("database", "dbuser");
         $this->dbpass = $xml->Child("database", "dbpass");
         $this->dbname = $xml->Child("database", "dbname");
         /*if(isset($_SESSION["activedb"])){
         			$this->dbname =$_SESSION["activedb"];
         		}*/
     } catch (Exception $e) {
         $title = "ERROR IN CLASS: " . get_class($this);
         $test = new MsgBox($title, $e->getMessage());
         $this->content .= $test->Show();
     }
 }