Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $this->load->model('configModel');
- $this->load->model('databaseModel');
- $globalConfig = $this->configModel->getConfig();
- if($globalConfig['Login-Enabled'] != "True") {
- die('Disabled');
- }
- $userName = @$_POST['userName'] or die('MissingField');
- $passWord = @$_POST['passWord'] or die('MissingField');
- $platform = @$_POST['platform'] or die('MissingField');
- $commPlatform = $platform;
- if($platform == "SteamFriendsAndroid") {
- $commPlatform = "Socket";
- }
- $steamGuardKey = "";
- if(isset($_POST['steamGuardKey'])) {
- $steamGuardKey = $_POST['steamGuardKey'];
- }
- $sessionToken = uniqid();
- $passKey = uniqid();
- //Contact CSMCS to start SMCS and to get port
- $input = $sessionToken . "\n";
- $input .= $userName . "\n";
- $input .= $passWord . "\n";
- $input .= $commPlatform . "\n";
- $input .= $steamGuardKey . "";
- //Get the CSMCS port from global
- $csmcsPort = $globalConfig['CSMCS-Port'];
- $this->load->model('tcpModel');
- $CSMCSoutput = $this->tcpModel->sendServer($csmcsPort, $input);
- $CSMCSoutputArray = explode("\n", $CSMCSoutput);
- if($CSMCSoutputArray[0] == "Port") {
- $smcsPort = $CSMCSoutputArray[1];
- }
- else {
- //Add this login attempt to the logs
- $this->databaseModel->addLog(array(
- $userName,
- $platform,
- $CSMCSoutput,
- time()
- ));
- echo 'pocketSteamOffline';
- return; //Stop it from continuing with the script if inproper reply
- }
- $time = time();
- //Add session to database
- $this->databaseModel->addSession(array(
- $sessionToken,
- $_SERVER['REMOTE_ADDR'],
- $time,
- $time,
- $passKey,
- 1,
- $smcsPort,
- $platform));
- //Now lets verify the login with SMCS
- $SMCSoutput = $this->tcpModel->sendServer($smcsPort, "RepeatSteamReply");
- $this->databaseModel->addLog(array(
- $userName,
- $platform,
- $SMCSoutput,
- time()
- ));
- if($SMCSoutput == "Success") {
- if($commPlatform == "Web") {
- echo 'Success:' . $sessionToken . ':' . $passKey;
- $this->session->set_userdata('ps_sessionToken', $sessionToken);
- $this->session->set_userdata('ps_passKey', $passKey);
- } else if($commPlatform == "Socket") {
- echo 'Success:' . $sessionToken . ':' . $passKey . ":" . $smcsPort;
- }
- }
- else{
- echo $SMCSoutput;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement