Skip to content

Instantly share code, notes, and snippets.

@jamzy118
Forked from XxAnonimeKxX/classes Validate.php
Created June 26, 2020 14:39
Show Gist options
  • Save jamzy118/1400e51095302db8ea0e10b7574ccac4 to your computer and use it in GitHub Desktop.
Save jamzy118/1400e51095302db8ea0e10b7574ccac4 to your computer and use it in GitHub Desktop.
<?php
class Validate {
public $login;
public function __construct($login){
$this->login = $login;
}
}
class Length extends Validate{
public function checkLength(){
if(strlen($this->login) < 5){
echo "login jest za krótki";
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>writers - rejestracja</title>
</head>
<body>
<form action="#" method="post">
<div class="input">
Login: <input type="text" name="login">
</div>
<div class="input">
Hasło: <input type="password" name="password">
</div>
<div class="input">
<input type="submit" value="Wyślij" name="sub">
</div>
</form>
<?php
if(isset($_POST['sub'])){
require_once 'core/init.php';
$v = new Length($_POST['login']);
$v->checkLength();
/*Warning: require_once(classes/Length.php): failed to open stream: No such file or directory in C:\xampp\htdocs\writers\core\init.php on line 3
Fatal error: require_once(): Failed opening required 'classes/Length.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\writers\core\init.php on line 3*/
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment