// set username & password $_SESSION['username'] = $_POST['username']; $_SESSION['password'] = $_POST['password']; header('Location: ' . htmlspecialchars($_SERVER['PHP_SELF'])); exit; } if (isset($_SESSION['username'], $_SESSION['password'])){ // construct the class $oAnalytics = new analytics($_SESSION['username'], $_SESSION['password']); // get an array with profiles (profileId => profileName) $aProfiles = $oAnalytics->getProfileList(); $aProfileKeys = array_keys($aProfiles); // set the profile tot the first account $oAnalytics->setProfileById($aProfileKeys[0]); $iSelectedMonth = date('n'); } if (isset($_POST['profileId'])){ // change profileId $oAnalytics->setProfileById($_POST['profileId']); } if (isset($_POST['month'])){ // change month $iSelectedMonth = $_POST['month']; }