I have a class userAuth inside its constructor I have added code to check the user is valid or not, if there is no value in session then I check cookies (as a part of "Remember Me" feature), if there is some value inside cookies then I call a function ConfirmUser to check its authenticity from database. On the basis of value returned by the confirmUser function I am returning a bool (true or fales) value in constructor.
I have created my class as:
<?php
class userAuth {
function userAuth(){
//code
}
function confirmUser($username, $password){
//code
}
}
$signin_user = new userAuth();
?>
confirmUser function take two string type parameters and return return a integer value of 0, 1, 2.
I can't add code of confirmUser function inside the constructor as I am using this function at some more places in my application.
So, I want to know how to call a user-defined function inside constructor in PHP. Please help.
Thanks!
confirmUserinside constructor...what is the problem?