Skip to content

Instantly share code, notes, and snippets.

@XxAnonimeKxX
Last active June 26, 2020 14:39
Show Gist options
  • Select an option

  • Save XxAnonimeKxX/2966de68eae834842b5ae1d0bf2c757b to your computer and use it in GitHub Desktop.

Select an option

Save XxAnonimeKxX/2966de68eae834842b5ae1d0bf2c757b to your computer and use it in GitHub Desktop.

Revisions

  1. XxAnonimeKxX revised this gist Jun 26, 2020. 2 changed files with 6 additions and 3 deletions.
    2 changes: 1 addition & 1 deletion classes Validate.php
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    class Validate {
    public $login;

    public function __construct(){
    public function __construct($login){
    $this->login = $login;

    }
    7 changes: 5 additions & 2 deletions register.php
    Original file line number Diff line number Diff line change
    @@ -19,9 +19,12 @@
    if(isset($_POST['sub'])){
    require_once 'core/init.php';

    $v = new Validate;
    $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*/
    }

    ?>
  2. XxAnonimeKxX created this gist Jun 24, 2020.
    22 changes: 22 additions & 0 deletions classes Validate.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    <?php
    class Validate {
    public $login;

    public function __construct(){
    $this->login = $login;

    }
    }

    class Length extends Validate{

    public function checkLength(){
    if(strlen($this->login) < 5){
    echo "login jest za krótki";
    }
    }
    }



    ?>
    29 changes: 29 additions & 0 deletions register.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    <!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 Validate;


    }

    ?>
    </body>
    </html>