I serialize an object that has a connection as an attribute echo the type of this attribute object and get as a result something like "Resource id #2"
and after i unserialize the object again the same thing gives 0!!!
Moderator: General Moderators
royalhunt wrote:I HATE MY JOB!!!!!!!! Please help me with that.
Code: Select all
class OracleCon{
var $username;
var $password;
var $alias;
var $conn;Code: Select all
function ConnectToDB(){
$this->conn = @OCINLogon($this->username, $this->password, $this->alias);
if (!OCIError()){
return true;
}else{
return false;
}
}Code: Select all
$oracle = new OracleCon($username, $password, "DEV_ORION");
if ($oracle->ConnectToDB()) {
$connection = serialize($oracle);
$connection = urlencode($connection);
if (setcookie("login", $connection)){
header("Location: search.php");
}else{
exit;
}Code: Select all
include "OracleCon.inc";
$connection = $HTTP_COOKIE_VARSї'login'];
$connection = urldecode($connection);
$oracle = unserialize($connection);
$oracle->CreateStatement();
$oracle->ExecuteStatement();
$oracle->ShowResults();
i login successfully and try to access the conn attribute since i need to run a statement in search.php. I get the following message:
Warning: ociparse(): supplied argument is not a valid OCI8-Connection resource in c:\program files\apache group\apache\htdocs\php\OracleCon.inc on line 66
I echoed the $oracle->conn in the login2.php and i get "Resource id #2". I echoed the $oracle->conn in the search.php and i get "0"!!!! The other attributes are set correctly (in the search.php file they still have their values)