Jump to content

Calling methods in the correct order, and once the conditions.


Rigodon

Recommended Posts

Hello,

I'm starting with object-oriented programming and I have the problem that I do not know how to efficiently manage captured with methods.

For example:

class logowanie {
 
public function valid_login_name() {
 
    $username = $_GET['username'];  
  $login_name = 'd56b6asdsada53855679cb1d252da';
 
      if(md5($username) === $login_name ){
    echo "extra";
 } elseif(md5($username) !== $login_name
         && !empty($username)   ){
    echo "błedny login";
 
    } elseif(md5($username) == null) {
        echo "nie podales loginu";
 
    }



I Checks if the given login is the same as that stored in the variable.
I know that I can refer to it by, for example:

$login= new logowanie();
 $login->valid_login_name();



I have also:

class pozalogowaniu {
 
       public function afterloggin(){
       header("Location: http://www.example.com/");
    }
  }


 And now my question in the style of dump question. How to do it when I want to show the method "afterloggin" only if the method valid_login_name () returns the result from the first condition?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.