Hello everyone here in this listing:

<? function registrationCorrect() { if ($_POST['login'] == "") return false; //не пусто ли поле логина if ($_POST['password'] == "") return false; //не пусто ли поле пароля if ($_POST['password2'] == "") return false; //не пусто ли поле подтверждения пароля if ($_POST['mail'] == "") return false; //не пусто ли поле e-mail if ($_POST['lic'] != "ok") return false; //приняты ли правила if (!preg_match('/^([a-z0-9])(\w|[.]|-|_)+([a-z0-9])@([a-z0-9])([a-z0-9.-]*)([a-z0-9])([.]{1})([az]{2,4})$/is', $_POST['mail'])) return false; //соответствует ли поле e-mail регулярному выражению if (!preg_match('/^([a-zA-Z0-9])(\w|-|_)+([a-z0-9])$/is', $_POST['login'])) return false; // соответствует ли логин регулярному выражению if (strlen($_POST['password']) < 5) return false; //не меньше ли 5 символов длина пароля if ($_POST['password'] != $_POST['password2']) return false; //равен ли пароль его подтверждению $login = $_POST['login']; $rez = mysql_query("SELECT * FROM users_1 WHERE login=$login"); if (@mysql_num_rows($rez) != 0) return false; // проверка на существование в БД такого же логина return true; //если выполнение функции дошло до этого места, возвращаем true } ?> 

such is the error:

"Parse error: syntax error, $ end in Y: \ home \ ty.ty \ www \ registration \ lib \ function_global.php on line 18"

I can not understand where I am and what I missed?

Closed due to the fact that off-topic participants BOPOH , Nick Volynkin 12 Apr '16 at 6:50 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - BOPOH, Nick Volynkin
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • and who will close the function body? What does the bracket in the comments do? running her from there - BOPOH
  • @BOPOH he then closed it, only she came under the comment))) возвращаем true } - Vasily Barbashev
  • @ Vasily Barbashev, so I say - what does brace there do? she does not have a place there + author by code: isset(...) checks are not enough, it’s necessary to start as it is not necessary + because of $_POST how to test? It is better to pass it through parameters (i.e. at least as registrationCorrect($_POST) ), and in the body of the function you should work with some variable. something didn’t pass validation? Ie the code should be rewritten - BOPOH
  • @BOPOH most likely he learns from lessons, and most likely old ones, I used to learn the same things before even the same PDO . - Vasily Barbashev

1 answer 1

You have not closed the function body. Closing brackets fell under the comment in the second last line.

return true; // if the function has reached this place, return true }

Take it out for comment and it will work.

  • pancake as i didn’t notice xD thanks - qaz qaz
  • @qazqaz close the question if the answer helped you - Vasily Barbashev