Custom HTML login form

If you wish to use custom affiliate login form at a page of yours, then you can do so simply via the following simple HTML form:
 
<form action="https://URL_TO_PostAffiliatePro/affiliates/login.php" method="post">
Username <input type="text" name="username" value=""><br>
Password <input type="text" name="password" value=""><br>
Remember me <input type="checkBox" name="rememberMe" checked><br>
<input type="submit" value="Login">
 
Of course you can even tweak it with  a language selection list-box and with control if you wish to, while the imported and active languages are retrieved via php API.  More over, it is convenient to handle the submitted information -- in case it was wrong, then the error messages should display in your site and not in the default login page. 

Affiliate login form with language selection list-box and handling of submitted login credentials:
<?php
$papURL = "https://URL_TO_PAP"; //URL of PostAffiliatePro without trailing slash
$merchantUsername = "merchant@user.com"; //merchant username
$merchantPassword = "123456"; //merchant password
?>

<form action="" method="post">
Username <input type="text" name="username" value="<?php echo (isset($_POST['username']) ? $_POST['username'] : ''); ?>"><br>
Password <input type="text" name="password" value=""><br>
Language 

<?php
//You can download the PapApi.class.php file from the merchant panel: Tools > Integration > API Integration > Download PAP API
include ("PapApi.class.php"); //this include assumes the PapApi.class.php is in the same dir as this script
  
$session = new Pap_Api_Session($papURL."/scripts/server.php");

if(!@$session->login($merchantUsername,$merchantPassword)) {
  die("Cannot login. Message: ".$session->getMessage());
} 

$request = new Gpf_Rpc_GridRequest("Gpf_Lang_LanguagesGrid", "getRows", $session);

try {
  $request->sendNow();
} catch(Exception $e) {
  die("API call error: ".$e->getMessage());
}

$grid = $request->getGrid();
$recordset = $grid->getRecordset();
echo '<select type="text" name="language">';
foreach($recordset as $rec) {
	//you can obtain these variables: name,eng_name,code,text_direction,translated,is_default,active	
	if ($rec->get('active') == 'Y') { //we list only Active languages
		echo '<option value="'.$rec->get('code').'">'.$rec->get('eng_name').'</option>';
	}	
}
echo '</select>';
?>

<br>
Remember me <input type="checkBox" name="rememberMe" checked><br>
<input type="submit" value="Login">
</form>

<?php
if (isset($_POST['username']) && isset($_POST['password'])) {	
	$session = new Pap_Api_Session($papURL."/scripts/server.php");
	if(!@$session->login($_POST['username'], $_POST['password'], Pap_Api_Session::AFFILIATE,$_POST['language'])) {
		die("Cannot login. ".$session->getMessage());
	}
		
	// redirecting to affiliate panel (requires affiliate session)
	header('Location:'.$session->getUrlWithSessionInfo($papURL.'/affiliates/panel.php'));
}
?>

 
That's it. 
 
 
 
If you wish to use a custom signup form check it out here: