Ejemplo n.º 1
0
 error_log("action set: " . $_REQUEST["action"]);
 switch ($_REQUEST["action"]) {
     case "actuallygettoken":
         $otkid = $_REQUEST["otkid"];
         $username = $_REQUEST["username"];
         error_log("requesting otk, {$otk}");
         $otk_img = $myAC->getOtkPng($username, $otkid);
         header("Content-type: image/png");
         echo $otk_img;
         exit(0);
         break;
     case "login":
         error_log("being login");
         $username = $_REQUEST["username"];
         $token = $_REQUEST["tokencode"];
         if ($myAC->authUserToken($username, $token)) {
             $_SESSION["user_loggedin"] = true;
             $_SESSION["username"] = $username;
             header("Location: index.php");
         } else {
             error_log("login failed, {$username}, {$token}");
             header("Location: index.php?error=" . urlencode("Login Failed"));
         }
         break;
     case "logout":
         $_SESSION["user_loggedin"] = false;
         $_SESSION["username"] = "";
         header("Location: index.php?message=" . urlencode("logged out"));
         exit(0);
         break;
 }
Ejemplo n.º 2
0
         }
     }
     break;
 case "tokentype":
     $msg = $myAC->getUserTokenType($argv[2]);
     echo "token type: {$msg}\n";
     break;
 case "synctoken":
     if ($myAC->syncUserToken($argv[2], $argv[3], $argv[4])) {
         echo "Token synced\n";
     } else {
         echo "Token not synced\n";
     }
     break;
 case "radauth":
     if ($myAC->authUserToken($argv[2], $argv[3]) == 1) {
         syslog(LOG_WARNING, "Got good request for user, " . $argv[2]);
         exit(0);
     } else {
         syslog(LOG_WARNING, "Got bad request for user, " . $argv[2]);
         exit(255);
     }
     break;
 case "getotk":
     $val = $myAC->getOtkID($argv[2]);
     if ($val === false) {
         echo "Failure\n";
     } else {
         echo "{$val}\n";
     }
     break;