Demonstration of Passing Objects
| From: | tcuhost at hotmail dot com | Date: | Fri, 11 May 2001 09:07:59 +0000 |
| Subject: | Demonstration of Passing Objects | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52433@lists.php.net to get a copy of this message | ||
Thanks for your help in the Vol I and Vol II of passing variables. I have put
up a quick little page to show the passing of variables and the correction
suggested here by Pevel. Kalian
http://24.11.192.82/objects/
sometimes seeing the solution is the best way to learn. I am only going to
leave it there for a few days so if it moves feel free to email me.
one last question. Since the object is serialized.... how would you suggest
getting to the next page form an href? I have this little question left from my
built sample
----- Original Message -----
From: "Pavel Kalian" <pkalian@ssw.cz>
To: <tcuhost@hotmail.com>; "Php-General (E-mail)" <php-general@lists.php.net>
Sent: Friday, May 11, 2001 12:56 AM
Subject: Re: [PHP] Passing Objects Vol II
In index2.php change the line $myInstance=urldecode (
unserialize($passedClass) ); to $myInstance=unserialize (
urldecode($passedClass) ); and you should be happy... I also assume you
have register_globals turned on in php.ini.
Pavel
----- Original Message -----
From: <tcuhost@hotmail.com>
To: "Php-General (E-mail)" <php-general@lists.php.net>
Sent: Friday, May 11, 2001 4:21 AM
Subject: [PHP] Passing Objects Vol II
> hmm well I tried it.... perhaps another step is in order. Once I can see
it
> work once I will be happy.
>
> //####################
> // index.php contains:
> //####################
> <pre>
> <?php
>
> include( "classes.inc" );
> $myInstance=new Main( $REMOTE_HOST , "nick" , "zzyzx" , true);
>
> echo $myInstance->client . "\n";
> echo $myInstance->user . "\n";
> echo $myInstance->password . "\n";
> echo $myInstance->allowed . "\n";
>
> ?>
> <a href=" <?php echo "index2.php?passedClass=" .
> urlencode(serialize($myInstance)) ; ?> "> Test </a>
> </pre>
>
> //####################
> // index2.php contains:
> //####################
> <pre>
> <?php
>
> include("classes.inc");
> $myInstance=urldecode ( unserialize($passedClass) );
>
> echo $myInstance->client . "\n";
> echo $myInstance->user . "\n";
> echo $myInstance->password . "\n";
> echo $myInstance->allowed . "\n";
>
> ?>
> </pre>
>
> //####################
> // classes.inc contains:
> //####################
> <?php
> class Main
> {
>
> var $client;
> var $user;
> var $password;
> var $allowed;
>
> function Main( $client="0.0.0.0" , $user= "" , $password="" ,
> $allowed
=
> false)
> {
> $this->client= $client;
> $this->user = $user;
> $this->password = $password;
> $this->allowed = $allowed;
> }
>
> }
> ?>
>
>
> //####################
> // THE MSG I GET
> //####################
>
> Warning: unserialize() failed at offset 3 of 130 bytes <path to file
here>
> on line 6
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net