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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.