How to automatically log in as an affiliate

You can do it using API:
$papURL = "https://URL_TO_PostAaffiliatePro/"; //URL of Post Affiliate Pro installation  without any trailing slash
$mUsername = ""; //replace it with your merchant username
$mPassword = "123456"; //replace it with your merchant password
//The API file can be downloaded in the merchant panel: Tools > Integration > API Integration
include_once ('PapApi.class.php'); //This include assumes the API file is in the same directory as this script

//username of affiliate you want to log in with
$usernameOfAffiliate = "";

$session = new Pap_Api_Session($papURL."scripts/server.php");
if(!@$session->login($mUsername, $mPassword)) {
    die("Cannot login. Message: ".$session->getMessage());

$affiliate = new Pap_Api_Affiliate($session);
try {
} catch (Exception $e) {
    die("Cannot load record: ".$e->getMessage());

//obtaining the authentication token of the affiliate
$authToken = $affiliate->getField('authtoken');
//redirecting to the affiliate login page and logging in
header('Location: '.$papURL.'affiliates/login.php?authToken='.$authToken);      
NOTE: You have to replace the URL_TO_PostAffiliatePro with the real URL of your Post Affiliate Pro installation