// generic fail
    exit;
}
if (file_exists('./code_storage.php')) {
    $arr = file('./code_storage.php');
}
foreach ($arr as $row) {
    $split = explode(':', $row);
    $codes[$split[0]] = $split[1];
}
require './interface.php';
$interface = new twitch();
array_shift($codes);
if (array_key_exists($_GET['user'], $codes) == 1) {
    if ($action == 'follow') {
        $success = $interface->followChan($_GET['user'], $_GET['chan'], null, $codes[$_GET['user']]);
        if ($success) {
            echo 'true';
        } else {
            echo 'false';
        }
    } elseif ($action == 'unfollow') {
        $success = $interface->unfollowChan($_GET['user'], $_GET['chan'], null, $codes[$_GET['user']]);
        if ($success) {
            echo 'true';
        } else {
            echo 'false';
        }
    }
} else {
    // Handle this in he AJAX.  This SHOULD prolly open up a new tab for the user to auth to.  From there, the follow can be retried as normal without a page reload