I don't know if you already solve this problem, but I would like to say something: besides all before comments there is one line to change $obj = new login(); parenthesis are necessary when instantiating a new object. Regards. R. Hernandez 2009/6/16 Hari KT <kthari85@xxxxxxxxxxx> > > > Your object is $obj and not $this . We call $this inside a class . > > $obj = new login; > > if(!$obj->isLoggedi n('admin' )){ > > > if($obj->sentData( )){ > > $this->setData( $_POST['username '],$_POST[ 'password' ]); > > $this->doLogin( ); > > So please change the lines . I am seeing some spaces . > ( Eg : $obj->isLoggedi n('admin' ) ) , don't know whether there is any in > the file. So if you still have trouble attach the file , than copy and paste > .. > > Hari K T > > http://harikt.com/ > > --- On Wed, 17/6/09, la_t3leeq <la_t3leeq@xxxxxxxxx<la_t3leeq%40yahoo.com>> > wrote: > > From: la_t3leeq <la_t3leeq@xxxxxxxxx <la_t3leeq%40yahoo.com>> > Subject: call to undefined method error ( but i defined it > !!) > To: php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com> > Date: Wednesday, 17 June, 2009, 5:57 AM > > hi > > this is my class for login > > class login{ > > public $currentUser; > > private $_uname , $_password; > > function setData($uname, $pass){ > > require_once' safeworld. php'; > > $obj= new safeworld; > > $this->_uname = $obj->safeString( $uname); > > $this->_password = $obj->safeString( $pass); > > } > > function doLogin(){ > > $query_string = "SELECT id FROM users WHERE username = '".$this->_uname. "' > and password = '".$this->_password ."'"; > > $q = mysql_query( $query_string) ; > > if(mysql_num_ rows($q)< 1){ > > throw new Exception("incorrec t data"); > > > }else{ > > $this->setSession( 'admin'); > > } > > } > > protected function setSession($ meen){ > > $_SESSION['is_ logged']= true; > > $_SESSION['meen' ]= $meen; > > } > > } > > function isLoggedin($ meen){ > > //if(isset($ _SESSION[ 'is_logged' ])){ > > echo "ssssssssssssssss" ; > > // $this->currentUser = $meen; > > //return true; > > //}else{ > > //return false; > > //} > > } > > function sentData(){ > > if(isset($_POST[ 'username' ]) and isset($_POST[ 'password' ])){ > > return true; > > > > }else{ > > return false; > > > > } > > } > > and this is the implementation > > <? > > //here > > //are > > //some > > //comments > > //only for the line number > > require_once "classes/login. php"; > > $obj = new login; > > if(!$obj->isLoggedi n('admin' )){ > > if($obj->sentData( )){ > > $this->setData( $_POST['username '],$_POST[ 'password' ]); > > $this->doLogin( ); > > }else{ > > require_once( "../templates/ loginForm. php"); > > } > > }else{ > > header("Location: admin.php" ); > > } > > ?> > > and this is the result > > Fatal error: Call to undefined method login::isLoggedin( ) in > C:\xampp\htdocs\ 5iblog\login. php on line 10 > > as you can see the method is defined although the error message !! > > > > > > > > > > > > Own a website.Get an unlimited package.Pay next to nothing.*Go to > http://in.business.yahoo.com/ > > [Non-text portions of this message have been removed] > > > -- Saludos, file:///C:/Users/RogerO/firmaRHB_2.png [Non-text portions of this message have been removed]