Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class authenticate
- {
- private $name;
- private $password;
- public function login($name, $password)
- {
- $this->name = $name;
- $this->password = $password;
- if($this->check())
- {
- echo "Onnistui!";
- }
- else
- {
- echo "OHO";
- }
- }
- protected function check()
- {
- if($this->name == "Miika")
- {
- if($this->password == "Salasana")
- {
- $this->password = "";
- return true;
- }
- }
- return false;
- }
- public function identify()
- {
- echo "<br>".$this->name;
- echo "<br>".$this->password;
- }
- }
- if(isset($_POST["login"]))
- {
- $logger = new authenticate();
- $logger->login($_POST["name"], $_POST["password"]);
- $logger->identify();
- }
- ?>
- <form action="?" method="post">
- Nimi:<br><input type="text" name="name"><br>
- Salasana:<br><input type="text" name="password"><br>
- <input type="submit" name="login" value="kirjaudu">
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement