Здравствуйте!
Я новичок
Вопрос следующий:
Реализую на Goodcms ajax регистрацию, столкнулся с такой проблемой:
Не происходит записи в БД:
Ajax код:
$(function(){
$("#s_href").click(function(){
var message = $("#codd").val();
var phone = $("#phone").val();
$.ajax({
type: "POST",
url: "../../sendCode.php",
data: {"message": message, "phone":phone},
cache: false,
success: $('#sms').modal()
});
return false;
});
});
Обработчик:
if (isset ($this->posts['reffrom']) && isset($this->posts['phone']) && isset($this->posts['password']))
{
if (!empty ($this->posts['reffrom']) && !empty($this->posts['phone']) && !empty ($this->posts['password']))
{
// $sault = 'fuckyou!';
// $pass = crypt ($this->posts['password'],$sault);
$posts = $this->posts;
$posts['registred'] = gmdate('Y-m-d H:i:s');
$posts['name'] = '';
$posts['family'] = '';
$posts['2family'] = '';
$posts['passport_serial'] = 0;
$posts['passport_number'] = 0;
$posts['passport_text'] = '';
$posts['address'] = '';
$posts['rank'] = 0;
$posts['reflink'] = '';
$posts['permissions'] = 1;
$posts['email'] = '';
$api = $this->getApiObject($this->tablePrefix.'accounts', $posts);
if (count($this->errors)==0) {
$api->dataInsert();
$this->errors = $api->errors;
}
}
}
posts - копия массива post, полдня бьюсь не пойму в чем дело
методы api и datainsert работают исправно