Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-08-2014, 09:27 AM
ageurtse ageurtse is offline
 
Join Date: Apr 2009
Location: almelo
Posts: 275
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default parsing variables to an external file

Hello,

i'm in the process of building a plugin, with this plugin there is a post button which calls a external php file.

now i wan't have acces to all the variables that are present at that time.
for instance user name, thread id and so on. there are also some custom variables.

how can i use them in my custom php file.
i don't want use file.php?someinfo=info

i will only call file.php and all the info should be availeble in file.php

how can i do this.
Reply With Quote
  #2  
Old 03-08-2014, 10:21 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think maybe the answer is to follow the instructions in this article: https://vborg.vbsupport.ru/showthread.php?t=228112
Reply With Quote
  #3  
Old 03-08-2014, 05:56 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, now that I reread what you posted, you wouldn't necessarily have access to every variable that is present - some things like threadid would need to be passed to the external php file in some way. If you don't want to pass the parameters on the url or via POST (i.e. an html form), then you would have to use some other method. (tbworld had posted about some possible methods, but deleted his post when I said he was wrong about what you wanted. . Maybe he can undelete it).
Reply With Quote
  #4  
Old 03-08-2014, 08:05 PM
ageurtse ageurtse is offline
 
Join Date: Apr 2009
Location: almelo
Posts: 275
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Maybe post will do the job, i dont want the user to see variables on the command line.
Reply With Quote
  #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
  #6  
Old 03-11-2014, 04:09 AM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would need to see the entire page you are posting on the vbulletin site. You can send it in a PM if you do not want to display it here. It is hard to follow in fragments. You are probably missing something relatively easy dealing with vbulletin.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:39 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06552 seconds
  • Memory Usage 2,290KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete