Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




How Do I Pass Constructor Variables To An Assembly Using DOTNET?


How can I pass a necessary parameter while instantiating an object from a .NET assembly using DOTNET in PHP 5?

The sample code that came with the .NET assembly shows how to do this is with VB and C#:

VB: Dim transaction As New Paymentech.Transaction(RequestType.CC_AUTHORIZE)

C#: Paymentech.Transaction(Paymentech.RequestType.CC_AUTHORIZE);

I've tried the following using PHP:
$transaction = new DOTNET("ptDotNetSDK20","Paymentech.Transaction(CC_AUTHORIZE) ")

and

$transaction = new DOTNET("ptDotNetSDK20","Paymentech.Transaction(RequestType.CC_AUTHORIZE) ")

and even

$transaction = new DOTNET("ptDotNetSDK20","Paymentech.Transaction(Paymentech.RequestType.CC_AUTHORIZE) ")

and each time get errors "Failed to instantiate .Net object". I've even tried enclosing the parameter in single quotes, with no improvement.

If I leave out the parameter and just try:
$transaction = new DOTNET("ptDotNetSDK20","Paymentech.Transaction")
I am able to create the transaction, but am then told "Transaction Object is invalid" when I later try to use it, which makes sense since I didn't create it with the necessary parameter in the first place.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Assembly Language Inside PHP - Possible / Not ?
I'd like to know whether it is possible to use inline assembly code
inside PHP? Remember good old Turbo Pascal 7, one could write Assembly
language inside it if you have a function that will be ran millions of
times inside a loop? This sped up the process by hundred-folds because
of the speed of that bit of assembly language.

Well, I'd like to do the same in PHP, but am unable to find any
conclusive evidence (and help) on whether this works and how.

Methods To Pass Variables
I am trying to pass 8 variables from a search form to different pages and I am confuse whether to use:
1) session
2) cookie
3) passing variable through URL
4) Using hidden form field

My page#1 is a search form and with 8 Select fields. After press Submit Button, page#2 shows all the search results. Some search would show up 100+ rows so I am using a script to break the result pages. Each display page would limit 20 records with links <<Previous 1 2 3.... Next>> at bottom.

However only the first search result page would show up properly but rest of search result won't showup.

I read a few threads on this forums and I wonder what is the best method to use in my case??? It seem passing variable through URL is inefficient in my case since there are 8 variables. With session or cookie, what happen if the user decide to do another search (page#1 search form) without closing browser will the session id renew itself. With hidden form field, since my Page#2 (result display page) is not using form, will it work.

Pass Get Variables Using PHP Header()
I got a form page with 'update' & 'cancel' buttons. When 'cancel' clicked, I want to be redirected to the index page on the right page number.

URL of my edit page is like this:
http://localhost/form.php?op=edit&id=1&cursor=2

In the form.php I got few lines of code to get that 'cursor' before doing redirection:

$iCursor = $_GET["cursor"];
$url = 'index.php?cursor='.(int) $iCursor;

if ($_POST["cancel"]) {
header("Location: $url");
}

The new URL is supposed to be:
http://localhost/index.php?cursor=2

but it showed up like this:
http://localhost/index.php?cursor=0

I've tried using sessions variables as well, but the value of the cursor's still 0.

Do you guys know what happened?

How To Pass Variables To PHP Binary (CGI)?
My system use to run PHP as an Apache module. And I pass in variables like this:
http://www.somesite.com/somefile.php?IDvar=1

Now my system runs PHP as a CGI. So I am running the same script like this:
/usr/local/bin/php /somepath/somefile.php

How do I pass in the variable IDvar and value 1?

Can't Pass Variables By URL On Localhost
I'm developping on localhost (127.0.0.1). When I try to pass parameters from one page to another using the standart way (URL), I just can't retrieve the values. In fact, the isset($varname) returns false. Code:

Pass Variables To Functions
In php i've found that I cant seem to access global variables from within a function. Is there a way to access variables in a function that are in the same scope that the function is??? Can you make a variable global or something? How does that all work in PHP, is there a doc somewhere to explain? Can I define a global within a function in php?

How Do I Pass Variables On A Location
i have a script which creates 2 variables which then does a redirect to a page which then uses a query using the two variables. But i was wondering how to get the code to pass across the page... Code:

Pass Variables Via Include Command?
I've been trying to put amend a variable to the end of an include statement, but each time I do this, the variable isn't passed.

For example:

Pass The Variables In The Form Of Sessions
If I have something like this how can i pass the variables
in the form of sessions to another page, where i Can calculate based on the products selected, very much like a shopping cart! PHP Code:

Pass Variables To Php Include File
I'm working on using an include file that is set up all good to go for an image gallery. The one thing I need to change though, is the path. My code is simple enough using the inculde PHP Code:

Pass Upload Page Variables
As I sure will become obvious with the asking of this question, I am new to
programing....

I have copied and pasted my way to a successful file upload page and have
built some rather ugly if elseif loops that read the file and extract the
needed data from it. While the data is being parsed from the uploaded file
a string variable is being built that holds some details of the process.
All of this happens when the user clicks the upload button on the form. Now
when all this code is finished running, I ASSUME the page reloads, because
my string variable seems to be empty. So, my question is how do I keep this
variable so that I can print it to the form when the process is finished?

Search - Pass Variables Or Self Post
I've created a database of documents that is searchable by a variety of fields. Currently I have a PHP page called search.php with a form to get the keywords from the user and it then passes this back to itself, runs a query and displays the results. Doing it this way the address for the search page and the results of the search is the same.

This all works fine and I'm happy with it but I was wondering if it should be implemented differently where the keywords are used as a part of the address like with search engines with Google. I don't know what the advantages or disadvantages is for either method so I'm keen to hear what others think is the best method.

How Can I Pass Variables Via POST In A Script?
Let's assume we have a script that only accepts POST variable input.. How is it possible to pass variables to it (using a php-script)?

How Does One Pass Array Variables Between URLs?
I would like to pass array variables between URLs but I don't know
how. I know its possible with sessions, but sessions can become
useless if cookies are disabled. I have unsuccessfully tried using
post and get methods.

Pass Variables To A Background Process.
I know how to start a process in the background, but how do I pass variables (from the calling script) to the background process?

Getting The Server To Pass Variables And Not The Client Browser
I have a page on my site that has a form for people to include their name and e-mail that I need to send to another site to save to a database.

The receiving/action page will then give a response depending on the point of failure or if the send and storage was successful.

Seems simple enough, but I need to include a use an id and password with the information for the third party to accept the info.

I can't include these as hidden form fields, as you could see them in the source.

I can post the inputted variables to a second page and add the sensitive variables before using the header function in php to call up the third party site, but I can only use query string from there to pass the variables over, which will of course expose the details I was trying to hide.

The info has to be passed, there's no db option. Other people have supposedly written functions that POST the info on from the second page so it's not part of the query string, which would be an acceptable solution, but I can't seem to figure out how to do that.

The ideal would be for the php page to send the users info & the sensitive info to the server, wait for the response, interpret it and write to the page the result.

Hide GET Variables --> Pass Values Using Session
I have a php file which lists some records. On this list, the records
can be sorted on different columns. currently the sort column and the
direction of sorting is passed using GET values, this means the user
clicks the column name (which is a link) so the new sort column and
direction is passed to the script

<a href="main.php?page=news&sortfield=title&sortorder=asc">

now my question is, if it's possible to hide those values, so they
don't appear on the url, but sorting should work anyway. This means
that

1. when user clicks on column, the new sort order has to be set
2. page has to be reloaded, so new sort order gets displayed.

I'd like to do this using sessions, but I don't know how to update a
session value, when clicking on a link wihtout using GET values...

$_SESSION Requires Refresh To Pass Variables To (jp)graph File
I cannot figure out why my graphs will not accept $year variables defined by a form. The first time I send the form the $year variables passed to the graphs are the old $_SESSION versions but if I refresh the browser once on the output page, everthing is fine.

Preg_replace Call Funtion And Pass Variables Inside Class
I have wasted almost two days for this, but can't figure out whats wrong with it.

I have class with functions. The problem is that when I have a preg_replace in a function, and it calls other function in that class, I can't pass my variables to that function.

Weird thing is that, it works fine, if the function that I call is not in a class.

The preg_replace is guite ugly, but it works =).
Idea is to parse string where are some url-tags and convert them to a href links, with some addon features like: link-http-check and word-chopping so it ain't too long to mess up with strick layout.

The function which has the preg_replace inside of it, PHP Code:

Pass A Querystring Through <a Href="mailto:xxxx .... Using PHP Variables
I'm trying to send a link with a querystring as the body of an email
message. My HTML syntax looks something like this:

<a href="mailto:xxx@yyy.com?Subject=<? print $subject ?>&Body=<? print
urlencode($url) ?>">Send an Email</a>

(I've had to URLENCODE the variables first, and it works. If I don't
do so, then it doesn't work.)

The problem occurs when it is time to display the encoded version. It
automatically translates it into the appropriate URL in certain email
clients (like OUTLOOK) but leaves it encoded in others (like
Groupwise).

Basically, I would like to be able to email a link in the body with
querystring in such a way that it appears on ALL email clients. I've
tried lots of things, but nothing seems to work.

Php 4.4.1 Constructor Vs. Php 5.0 Constructor
I have a class with a constructor function that looks like so on my php
5.0 box:

public function __construct(....)

does this syntax change when I go back to php 4.4.1? I've never used
4.4.1 before, been solely 5.0 until now. It seems the 4.4.1 box is
giving me an error on that call.



Constructor Overloading In Php
I looked everywhere for that problem. Does anyone know that how can i
overload constructor function in php 5?

Class Constructor
I have been doing a lot of OOP recently with PHP and now that I've given myself more time to think about my structure I'm second guessing the way I'm doing things. Right now I am coding a news system and I would have a class news, I always get confused as to what I should do in the constructor, if anything at all. I was thinking I could have the constructor retrive all the data from the database, but I then realized that it would be useless if I was just using the class to edit a post rather than view them all. Is it proper to have my constructor do nothing and have my functions handle everything?

Function Inside A Class Function Dont Pass Variables...
Im using xajax class, and i just made a custom class called mantenimientos that use objects of this xajax class. Something like this:

class mantenimiento
{
  public $titulo;
  public $ajax_sRequestURL;

  function __construct($titulo,$ajax_url){
    $this->titulo = $titulo;
    $this->ajax_sRequestURL = $ajax_url;
  }
  function exec_ajax(){
    //Here i can use $this with no problem
    $xajax = new xajax($this->ajax_sRequestURL);
    $xajax->registerFunction("call_fun");
    //I have to do this to have acces to the class itself when im inside a function
    global $mant ;
    $mant = $this;
    function call_fun(){
      //next line give me access to the mantenimiento class properties.
      //I havent    found other way of doing it.
      global $mant;
      $objResponse = new xajaxResponse();
      $objResponse->addAlert('XAJAX CALLED:'.$mant->titulo);
      return $objResponse->getXML();
  }
  $xajax->processRequests();
}

My problem is that $mant->titulo lost it value when i im inside the funciton, but only when that value comes from other var.

for example:

if i do this:

$mant = new mantenimiento('This is the title','index.php');
or
$titulo = 'This is the title'
$mant = new mantenimiento($titulo,'index.php');


When i execute the xajax_call_fun, it shows an alert box with the text "XAJAX CALLED:This is the title"

but if i do something like this:

$titulo = gettitulo_from_database();
or
$titulo = $_POST['titulo'];

The alert box show the mensaje with out the value of the $mant->titulo

Im getting crazy with this....!

Overloading Function/constructor?
Lo all,
I have try overloading function/constructor with numbers of arguments but it doesnt work. Anybody knows why? Thanx in advace!

for instance,
function foo($arg_1) {
...
}

function foo($$arg_1, $arg_2) {
...
}

php keeps calling "function foo($$arg_1, $arg_2)" even when i only pass one argument in. any idea?

Object Default Value In Constructor
I'm trying to write a class with a constructor that takes a single object
parameter. So far so good, but I can't for the life of me make the parameter
optional. I understand how to do it with a numerical or textual parameter,
but not with an object. I tried null, but it doesn't work.

class A
{
}

class B
{
function B($a = ???)
{
if (!isset($a)) $a = new A;
}
}

Object Oriented Get Set Using Constructor
I'm trying to teach myself php by following a book.  I have a constructor, that's supposed to call the get method but it doesn't seem to be. I know because i did and echo out and i got nothing displayed. I get the problem on my set method because for some reason _changedproperties is being passed to it and not the correct values. Code:

Object Constructor That Uses Mysql_fetch_object
I'm developing a Mysql + Php website using Classes  to manipulate each of the tables on my Db.

So i thought that it would be cool if my constructor used mysql_fetch_object to create itself. Each object has the same attributes and in the same order that his db table. Here's the code of my class. Code:

Creating Dir, Copy Files And Pass Variables To 2 Files
I need to create a folder on the server weekly named by the user. To this folder copy the contents of an /Original folder. Inside the new folder edit one of the files to insert a data with a XML path generated in another application, copied (via memory) and pasted within the very first form and passed to the file in question.

<param name="FlashVars" value="xmlfile= $lanofile" />

the $lanofile is the value that I need to pass from the form to be read by this file.
I have created an form (n.php) that POST the name of the folder to a second file (creatdir.php) everything is cool until I have to edit the third file.

How can I pass the value of one of the formfileds to a second file and them read this value as a variable to be consumed as mentioned above? Or actually right whatever is on the third field to this position (not using variables).

Array Of Instances Inside Constructor
keep an array of all
of its instances? This was my first and obvious first shot...

class A
{
function A()
{
static $a = array() ;
$this->array =& $a ;

$this->array[] =& $this ;
}
}

But, if I make changes to the instance contents (not included above)
they are lost when I eventually try to use the array of references.

Set_error_handler In Parent Class' Constructor
I have the following classes in separate files. These are shortened versions with relevant code only. PHP Code:

Fatal Error: Call To A Member Function On A Non-object In Constructor?
I'm having a problem that I have a hard time understanding. I am getting a
"Fatal error: Call to a member function on a non-object" on a constructor
of a class, that looks like this (simplified):

class phpBB_Template {
var $classname = "Template";

// Root template directory.
var $root = "";

/**
* Constructor. Simply sets the root dir.
*
*/
function phpBB_Template($root = ".")
{ /* Error is reported on this line */
$this->root = $root;
}
}

The line where the error is reported only contains the function's opening
accolade. As far as I understand, this error should only occur if I try to
access a function on a variable that is not an object, but the only
variable I am accessing, is $this, and that one is by definition an object,
right?

Using MD5($pass) With PHP And MD5 Tables Or Password('$pass') In SQL
My intranet log in page (which starts the session)
has a password field, and later once the form is submitted
(after all the checking) the $pass var goes through this:

$pass = MD5($pass);

And my password column has MD5 encrypted passwords.

I could just use password('$pass') in my SQL query and remove the MD5() from my PHP if I convert my column to "Password" instead of "MD5".

So which one is safer? I think MD5 is safer and is sort of a standard so my database has a little more portability if ever needed.

I have another question. My Form once submitted obviously has the non encrypted password until the variable is processed. The only way to protect this is to put the intranet on a SSL connection right?

Which Is Better, Pass, Or Not Pass By Reference?
I've asked this before but never got any response but its important and I
thought I'd pitch it again (hopefully a bit clearer)...

One can pass data from one function to another either by passing a copy, or
passing by reference.

My understanding of passing by reference (putting the & before a variable
during the function declaration) means that the original data is used.

My understanding of *not* passing by reference, (thus passing a copy)
literally means creating a copy of the data contained in my variables - thus doubling the memory usage for this data... even if its just a temporary while the function is being executed.

I *believed* (past tense) that one should only pass by reference if they
wanted the child function to change the data and pass the newer values back
to the parent function.

I'm now thinking that this is just a feature and not the only usage. I am
begining to think I should use "pass by reference" nearly all the time in
order to conserve memory (since I won't be creating copies of my variable
data in memory).

Would this be good practice? Am I right that passing by reference means that
my variable data is not duplicated thus using less memory than if I had
passed my variable data as a copy?

Why Pass The SID?
Although I understand that you can only pass your session ID from page to page using (1) cookies, or (2) sessions - im at a loss why you'd need to do this.

Why isn't it enough to just use 'session_start()' at the top of all your pages? On all the tests I've done, I can register variables and recall them on different pages by only calling session_start - but I saw in a recent post which said you should always pass the session ID too.

I realise there is a tutorial on this, and several (hundred) posts - most of which I've read, but can someone please explain this as basic as possible!

Pass A Value Or Something Like It
I want to know how to pass a certain value or anything like it when you try to click a "picture of a book" or its "name" to be pass on another web page that will show the "book picture", the "price of the book" and the "description" of it?

How To Pass And Use The & In A URL?
I want to pass a phrase in the URL that uses an ampersand:

"Black & White"

And I want to be able to 1) print it as is, and 2) insert it into a link. I think the problem lies in the spaces around the ampersand. I've tried various methods of replacing it with &amp; and &038; and replacing the spaces with %20 or + but it still causes trouble. Code:

Cannot Pass @ For A SELECT... WHERE
From a cycling database, to put to screen the Clubs whose Secretary has email, this works just fine in phpMyAdmin -

select email from clubs where email like "%@%" order by club

I want to do it in php but from the manual and these DevShed files, it seems the @ character stops all further progress along the line it's on????

I've tried all kinds'v variations of the following, brackets on and off, double and single quotes, till I'm blue in the face.

User/Pass In URL
Hello all,

I am trying get one server to authenticate to another server possibly with a
browser window in the middle.

My browser throws a syntax error at this url
http://username:password@domain.com:2082 but will allow the same with ftp -
ftp://username:password@domain.com

I want to have a page that has login buttons for remote sites (hosting
client sites and the like).

I understand that with "AuthType Basic" the server sends a request for login
information (403 or something like that). The browser subsequently sends the
user/pass on every other request for a page/resource on that site.

Is there a way to do this in advance?

ie can I do something like this in html ? ..
<form action="http://theirdomain.com:2082" method="post">
<input type="hidden" name="user" value="username">
<input type="hidden" name="pass" value="password">
<input type="submit" value="Your cPanel">

If not then can I proxy it on the server? ie can I place the username and
password into the headers to the remote site and pass a cookie back to the
browser so they can continue the session with the remote site?

How To Pass SID From A Form?
Just trying to figure out how to pass SID once a form is submitted. I am assuming that I could append it to the action (<form method=get action=nextpage.php?<?=SID?>>), but all I get is a nextpage.php? without the SID attached. I have my global variables turned on.

How To Pass A Value In Javascript To A Value In Php
I have not learned Javascript,just copy & paste & revise

<script language="JavaScript">
function confirmDelete{
re = confirm("Delete or not?(yes,cancel)");
if (re == "0"){<?php $re1 = 0;?>}else{ <?php $re1 = 1;?>}
<!--the upper line will cause the confirm windows disappearing--!>
return 0;
}
document.writeln(confirmDelete());
</script>
<?php
echo "$re1 = $re1";
?>

1. How to pass the value "re" in Javascript to $re1 in php
2. How to revise to make the confirm window appear and pass the value
correctly.

How Do I Pass The Session ID Through URL?
I have a series of forms I have been working with using session ID's and
session variables.

I need to convert this to a series of forms where cookies might be turned
off so the URL needs to carry the session ID.

Question :
If I add the session ID to the URL that is passed, can I still use session
variables or do I need to change the way I code the variables altogether?

Pass By Ref Error
I'm getting this error on my PHP CLI script. If this feature is being
depreciated, then how are we to pass vars by reference???

Function parse_for_wind($php_line, &$php_total_wind_matches,
&$php_highest_wind)

[Wed Aug 24 16:22:08 2005] [error] PHP Warning: Call-time
pass-by-reference has been deprecated - argument passed by value; If
you would like to pass it by reference, modify the declaration of
parse_ceil_pattern().

Pass Through Variable
I'm trying to create an image gallery, with (of course) for every
picture
the same javascript-pop-up. Because i use the same javascript, i only
want
to tell it the number of the image... Below is what i have, and it
works:

<?php $pic="01";list($width, $height, $type, $attr) =
getimagesize("./pix/$pic.jpg");
echo "<a href="javascript:MM_openBrWindow('foto.php?naam=$pic&pic=./pix/$pic.jpg','dames3','width=$width,height=$height') "><img
src="./tmb/$pic.gif" height="90" width="90" alt="$pic"
/></a>";
?>

But when i copy it, and change $pic="01" to $pic="02", i get an error.
(Which
makes sense) But how can i tell the same script to take another
number..

The best would be something like <?php $pic="01"; print $script;
$pic="02"; print $script;
etc...
?>
$script would be everything of the earlier mentioned coding except for
'$pic = "..."' So you'd have to include it, but i can't even get that
to
work.. (I can't find a way to include php-script by calling it: echo
$script)

How To Pass A Variable ?
I use PHP with WML. After a simple form (login & password) I check if they are correct (with MySQL) and if yes:

echo ("<card ontimer="lesson.wml">n");
echo ("<timer value="30"/>n");
echo ("<p> Password ".$pass." accepted for login ".$find." </p>n");

what I want is to the next page lesson.wml the variable $find to exist with the value it had here. Meaning I want to keep the login name to the next page. How can I do that??

Pass Value To Header?
When processing a form I am reading in a value to a mysql database. I then
redirect the user to a "thank you" page with Header. What I would like is to
remind the user the value he/she keyed in. Can I pass the variable in the
Header command?

What I want to do in the following is echo the value of $inx01 in
thankyou.php?

<?php
mysql_connect(" Codes Removed ") or die(mysql_error());
mysql_select_db(" Database Name removed ") or die(mysql_error());

$inx01=$_POST['fardvagonf'];

mysql_query("INSERT INTO table1 VALUES ('$inx01')");
echo mysql_error();

mysql_close();

Header("Location: http://www.mydomain.com/thankyou.php");
exit;

?>

Pass A Variable?
I have two php scripts. I need to communicate with each other. I am an Action Script developer so i AM php RETARDED. This is my first one that takes my flash variables creates the right directory then write a text doc to it. Next the user is uploading a file. I want that image file to save to the same directory as the text doc wrote too. The only copmplicted part of this is that the user names the directory Code:

Pass An Id To Another File
On my news page I have a link to the full story and then the short story below.

The link to the full story is news/viewfull.php?id=something

Now what I need to do is make it so if the id=5 in the url it will query the database and get the fullstory that has an id of 5.

Does that make sense? Code:

Trying To Pass 2 Values
I am trying to pass 2 values in the URL, but for some reason they keep combinine to each other... I wanted to send over the groupid and the zipid, but it keeps sticking them together. Code:


Copyright © 2005-08 www.BigResource.com, All rights reserved