This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Функция склонения числительных в русском языке | |
* | |
* @param int $number Число которое нужно просклонять | |
* @param array $titles Массив слов для склонения | |
* @return string | |
**/ | |
$titles = array('котик', 'котика', 'котиков'); | |
function declOfNum($number, $titles) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { // вся магия после загрузки страницы | |
$("#ajaxform").submit(function(){ // перехватываем все при событии отправки | |
var form = $(this); // запишем форму, чтобы потом не было проблем с this | |
var error = false; // предварительно ошибок нет | |
form.find('input, textarea').each( function(){ // пробежим по каждому полю в форме | |
if ($(this).val() == '') { // если находим пустое | |
alert('Заполните поле "'+$(this).attr('placeholder')+'"!'); // говорим заполняй! | |
error = true; // ошибка | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Соединяемся, выбираем базу данных | |
$link = mysql_connect('localhost', 'r_subco_ru', 'L4s4I0n2') | |
or die('Не удалось соединиться: ' . mysql_error()); | |
echo 'Соединение успешно установлено'; | |
mysql_select_db('r_subco_ru') or die('Не удалось выбрать базу данных'); | |
// Выполняем SQL-запрос | |
$query = 'SELECT login,password,CHECKWORD FROM b_user'; | |
$result = mysql_query($query) or die('Запрос не удался: ' . mysql_error()); |