Witam, chciałbym do tego formularza rejestracyjnego dodać opcje takie jak:
- Sprawdzanie poprawności formy e-mail - Czyli, żeby w okienku e-mail, można było wpisać tylko formę e-mail'a : test@test.pl
- Wymagane minimum 3 znaki do okienka loginu
- Wymagane minimum 5 znaków do hasła
- Sprawdzanie czy e-mail nie jest zajęty
To by było na tyle, proszę o pomoc i trochę dokładniejsze wytłumaczenie, lub podanie formularza z dodanymi tymi opcjami
//** REJESTRACJA **//
public function add()
{
$this->login = $_POST['login'];
$this->password = md5($_POST['password']); $this->mail = $_POST['mail'];
$this->ref = $_POST['ref'];
}
public function check()
{
include ("language/pl.php");
if (!empty($_POST['spr'])) {
if ((!empty($_POST['login'])) && (!empty($_POST['password'])) && (!empty($_POST['mail']))) {
if ($_POST['password'] == $_POST['vpassword'])
{
$this->spr = $this->pdo->prepare("SELECT * FROM platnosci WHERE login=?");
$this->spr->execute(array($this->login)); $this->spr1 = $this->spr->fetchColumn();
if ($this->spr1 == 0)
{
{
$this->spr = $this->pdo->prepare("SELECT * FROM platnosci WHERE mail=?");
$this->spr->execute(array($this->mail)); $this->spr1 = $this->spr->fetchColumn();
if ($this->spr1 == 0)
{
$this->insert = $this->pdo->exec('INSERT INTO `platnosci` (`login`, `password`, `points`, `ref`, `mail`) VALUES(
\'' . $this->login . '\',
\'' . $this->password . '\',
\'0 \',
\'' . $this->ref . '\',
\'' . $this->mail . '\')');
if ($this->insert > 0)
{
$this->stmt = $lang[0];
} else
{
$this->stmt = $lang[1];
}
} else
{
$this->stmt = $lang[6];
}
} else
{
$this->stmt = $lang[3];
}
} else
{
$this->stmt = $lang[2];
}
}
return $this->stmt;