Passing Objects Vol II
| From: | tcuhost at hotmail dot com | Date: | Fri, 11 May 2001 02:21:35 +0000 |
| Subject: | Passing Objects Vol II | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-52384@lists.php.net to get a copy of this message | ||
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