Помогите пожалуйста сделать синхронизацию БД.
function sync_users()
{
global $user_name, $user_password, $user_email, $user_regdate, $name, $db;
dtb_connect();
$db->sql_query("INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
VALUES ('$user_name', '$user_password', '$user_name', '$user_email', '$user_regdate', '$user_regdate')");
dtb_disconnect();
}
Что я тут сделал не так?
Верно вставил место синхронизации, записи данных пользователя при регистрации?
function activate() {
global $db, $prefix, $conf;
$uname = htmlspecialchars(substr(urldecode($_GET['user']), 0, 25));
$cnum = htmlspecialchars(substr($_GET['num'], 0, 40));
$past = time() - 86400;
$db->sql_query("DELETE FROM ".$prefix."_users_temp WHERE time < '$past'");
$result = $db->sql_query("SELECT user_name, user_email, user_password, user_regdate, check_num FROM ".$prefix."_users_temp WHERE user_name='$uname' AND check_num='$cnum'");
head();
if ($db->sql_numrows($result) == 1) {
list($user_name, $user_email, $user_password, $user_regdate, $check_num) = $db->sql_fetchrow($result);
if ($cnum == $check_num) {
$uip = getip();
$uagent = getagent();
$db->sql_query("INSERT INTO ".$prefix."_users (user_id, user_name, user_email, user_avatar, user_regdate, user_password, user_lang, user_last_ip, user_agent) VALUES (NULL, '".$user_name."', '".$user_email."', '00.gif', '".$user_regdate."', '".$user_password."', '".$language."', '".$uip."', '".$uagent."')");
/* ADD SYNC */
include("config/config_sync.php");
sync_users();
/* End */
$db->sql_query("DELETE FROM ".$prefix."_users_temp WHERE user_name='$user_name' AND check_num='$check_num'");
if ($conf['forum']) new_user($user_name, $user_password, $user_email);
title(_ACTIVATIONYES);
warning(_ACTMSG, "?name=account", 15, 2);
} else {
title(_ACTIVATIONERROR);
warning(_ACTERROR1, "?name=account", 15, 1);
}
} else {
title(_ACTIVATIONERROR);
warning(_ACTERROR2, "?name=account", 15, 1);
}
foot();
}
function sync_users()
{
global $user_name, $user_password, $user_email, $user_regdate, $name, $db;
dtb_connect();
$db->sql_query("INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate)
VALUES ('$user_name', '$user_password', '$user_name', '$user_email', '$user_regdate', '$user_regdate')");
dtb_disconnect();
}
Что я тут сделал не так?
Верно вставил место синхронизации, записи данных пользователя при регистрации?
function activate() {
global $db, $prefix, $conf;
$uname = htmlspecialchars(substr(urldecode($_GET['user']), 0, 25));
$cnum = htmlspecialchars(substr($_GET['num'], 0, 40));
$past = time() - 86400;
$db->sql_query("DELETE FROM ".$prefix."_users_temp WHERE time < '$past'");
$result = $db->sql_query("SELECT user_name, user_email, user_password, user_regdate, check_num FROM ".$prefix."_users_temp WHERE user_name='$uname' AND check_num='$cnum'");
head();
if ($db->sql_numrows($result) == 1) {
list($user_name, $user_email, $user_password, $user_regdate, $check_num) = $db->sql_fetchrow($result);
if ($cnum == $check_num) {
$uip = getip();
$uagent = getagent();
$db->sql_query("INSERT INTO ".$prefix."_users (user_id, user_name, user_email, user_avatar, user_regdate, user_password, user_lang, user_last_ip, user_agent) VALUES (NULL, '".$user_name."', '".$user_email."', '00.gif', '".$user_regdate."', '".$user_password."', '".$language."', '".$uip."', '".$uagent."')");
/* ADD SYNC */
include("config/config_sync.php");
sync_users();
/* End */
$db->sql_query("DELETE FROM ".$prefix."_users_temp WHERE user_name='$user_name' AND check_num='$check_num'");
if ($conf['forum']) new_user($user_name, $user_password, $user_email);
title(_ACTIVATIONYES);
warning(_ACTMSG, "?name=account", 15, 2);
} else {
title(_ACTIVATIONERROR);
warning(_ACTERROR1, "?name=account", 15, 1);
}
} else {
title(_ACTIVATIONERROR);
warning(_ACTERROR2, "?name=account", 15, 1);
}
foot();
}