View Single Post
  #5  
Old 03-10-2014, 05:48 PM
ageurtse ageurtse is offline
 
Join Date: Apr 2009
Location: almelo
Posts: 275
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 
'&euro; '.number_format(($bedragtotaal100), 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>
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01222 seconds
  • Memory Usage 1,908KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete