i can't get it to work.
when i load a php from a external site, the php file is displayed when i host the php file on the vbulletin site. the file isn't show.
how can i display this php file within vbulletin.
and alternate parse some variables from vbulletin to this php file.
i think i have to make a template and a different php file, but i don't have any experience with that. i followed the tutorial as kh99 in his first post mentioned but i don't get it.
would someone help me with this. not with the code but just with some tutorial help.
[edit]
I came from a button click from within a different plugin, here is a small peace of code.
Code:
$ptpnt_do = '';
//$ptpnt_action = 'https://www.paypal.com/cgi-bin/webscr';
$ptpnt_action = './test.php';
$ptpnt_item = $foruminfo['forumid'] . '_' . $vbulletin->userinfo['userid'] .
and a small bit of the template
<form action="{vb:raw ptpnt_action}" method="post">
<vb:if condition="$show['ptpnt_total_price']">
when the submit button is pushed then my peace of code should come in.
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<?php
// include the settings file
require("settings.php");
?>
<html>
<head>
<title>Transactie Pay.nl</title>
<!-- css -->
<link rel="stylesheet" type="text/css" href="includes/css/ppt.css" />
<!-- script -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
<script src="includes/script/ppt.js" type="text/javascript"></script>
</head>
<body>
<?php
if($_POST['submit_payment_method'])
{
try
{
// an amount has been entered and an payment method has been chosen
// now we can create a Pay.nl transaction
$objPay = new Transaction($iProgramId, $iWebsiteId, $iWebsiteLocationId, $arrEmailAddress, $iAccountId, $strToken, $boolDebugMode);
// set vars from settings.php
if(isset($_POST['external_order']) && strlen($_POST['external_order']) > 0)
{
$objPay->setExternalOrder($_POST['external_order']);
}
$objPay->setExchangeUrl($strExchangeUrl);
$objPay->setReturnUrl($strReturnUrl);
$objPay->setTestMode($boolTestMode);
// check if a bank has been chosen
if(intval($_POST['payment_profile']) == 10)
{
$objPay->setBankId($_POST['bank_id']);
}
// create transaction
$transaction = $objPay->createTransaction(intval($_POST['amount']), intval($_POST['payment_profile']), array('extra1' => isset($_POST['external_order']) ? $_POST['external_order'] : ''));
}
catch(Exception $exc)
{
// set error in debug info
if(is_object($objPay) && $objPay->getDebugMode()) $objPay->doDebug('An error occured: ' . $exc->getMessage(). ' - Script execution stopped');
// put error on screen
else echo 'An error occurend: '.$exc->getMessage(). ' - Script execution stopped';
exit;
}
// show Pay.nl transaction result
echo "<div class='ppt'>";
echo "<p>";
echo "U kunt uw betaling afronden via de onderstaande link.";
echo "</p>";
echo "<p>";
echo "<a href='" . $transaction['issuerUrl'] . "'>Betaling afronden</a>";
echo "</p>";
echo "</div>";
}
else
{
try
{
// an amount has been entered and the submit button has been clicked
// now we have to set the entered amount and display the available payment profiles
// create object
$objPay = new Transaction($iProgramId, $iWebsiteId, $iWebsiteLocationId, $arrEmailAddress, $iAccountId, $strToken, $boolDebugMode);
// get the availabel payment profiles
$arrPaymentProfiles = $objPay->getActivePaymentProfiles();
// generate select box with availabel payment profiles
$selectPaymentProfiles = '<option>Selecteer</option>';
if(is_array($arrPaymentProfiles))
{
foreach($arrPaymentProfiles as $arrPaymentProfile)
{
$selectPaymentProfiles .= '<option value="' . $arrPaymentProfile['id'] . '">' . $arrPaymentProfile['name'] . '</option>';
}
}
// if payment method 10 is available we need to show a list of banks
if($objPay->isBankList($arrPaymentProfiles))
{
$arrBankList = $objPay->getIdealBanks();
if(is_array($arrBankList))
{
$selectBank = '';
foreach($arrBankList as $arrBank)
{
// generate list of banks
$selectBank .= "<div><input type='radio' name='bank_id' value='" . $arrBank['id'] . "' /><img src='" . $arrBank['icon'] . "' alt='" . $arrBank['name'] . "'></div>";
}
}
}
}
catch(Exception $exc)
{
// set error in debug info
if(is_object($objPay) && $objPay->getDebugMode()) $objPay->doDebug('An error occured: ' . $exc->getMessage());
// put error on screen
else echo 'An error occurend: '.$exc->getMessage();
exit;
}
echo "<div class='ppt'>";
echo "<form method='POST'>";
// description
echo "<div>";
echo "<p>";
echo " test 2 Selecteer de gewenste betaalmethode en vul eventueel het ordernummer van uw systeem in.";
echo "</p>";
echo "<br />";
echo "</div>";
// amount in cents
echo "<div>";
echo "<label>";
echo "Over te boeken bedrag:";
echo "</label>";
echo "<input type='hidden' name='amount' value='".$bedragtotaal."'/>";
echo '€ '.number_format(($bedragtotaal/ 100), 2, ',', '');
echo " *** ".$ptpnt_total_price;
echo "</div>";
// optional: an external order
echo "<div>";
echo "<label>";
echo "Ordernummer van uw systeem:";
echo "</label>";
echo "<input type='hidden' name='external_order' value='vb_thread_1001' />";
echo "vb_thread_1001";
echo "</div>";
// available payment methods
echo "<div>";
echo "<label>";
echo "Selecteer betaalmethode:";
echo "</label>";
echo "<select name='payment_profile'>";
echo $selectPaymentProfiles;
echo "</select>";
echo "</div>";
// list of banks in case iDEAL has been selected
echo "<div id='banks'>";
echo "<label>";
echo "Selecteer bank:";
echo "</label>";
echo "<div class='bankList'>";
echo $selectBank;
echo "</div>";
echo "</div>";
// submit button
echo "<div>";
echo "<input type='submit' name='submit_payment_method' value='Volgende stap' class='button' />";
echo "</div>";
echo "<div class='clear'></div>";
echo "</form>";
echo "</div>";
}
?>
</body>
</html>