function checkUsername($username, $pw) { global $dbConnect; if ($pw != null && !validateSpringAccount($username, $pw)) { return -1; } $curId = $dbConnect->getUserIdByName($username); if ($curId == -1) { $dbConnect->addUser($username); $curId = $dbConnect->getUserIdByName($username); } return $curId; }
$password = $_GET['pw']; $targetUsername = $_GET['tu']; if (!isset($mode)) { die("\nResult: ERROR\nMessage: No mode given!"); } if (isset($_GET['s'])) { $skill = floatval($_GET['s']); } if (isset($_GET['c'])) { $confidence = floatval($_GET['c']); } if (!isset($sourceUsername) or !isset($password)) { die("\nResult: ERROR\nMessage: Missing argument"); } //////////////////////////////////////////////////////////// if (!validateSpringAccount($sourceUsername, $password)) { die("\nResult: ERROR\nMessage: Invalid login"); } $dbConnect = new dbConnection(); switch ($mode) { case 0: if (!isset($targetUsername) or !isset($confidence)) { die("\nResult: ERROR\nMessage: Missing argument"); } $dbresult = $dbConnect->addConfidence($sourceUsername, $targetUsername, $confidence); if (!$dbresult) { die("\nResult: ERROR\nMessage: Addin confidence failed!"); } else { echo "\nResult: OK\nMessage: Confidence added: " . $sourceUsername . " - " . $targetUsername . " : " . $confidence; } break;