本文整理汇总了PHP中sql_db::prepare方法的典型用法代码示例。如果您正苦于以下问题:PHP sql_db::prepare方法的具体用法?PHP sql_db::prepare怎么用?PHP sql_db::prepare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sql_db
的用法示例。
在下文中一共展示了sql_db::prepare方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
$error = $check_email;
} elseif (!empty($check_pass)) {
$error = $check_pass;
} elseif ($array_data['nv_password'] != $array_data['re_password']) {
$error = sprintf($lang_global['passwordsincorrect'], $array_data['nv_password'], $array_data['re_password']);
} elseif (empty($array_data['question'])) {
$error = $lang_module['your_question_empty'];
} elseif (empty($array_data['answer_question'])) {
$error = $lang_module['answer_empty'];
} elseif (empty($error)) {
$password = $crypt->hash_password($array_data['nv_password'], $global_config['hashprefix']);
define('NV_CONFIG_GLOBALTABLE', $db_config['prefix'] . '_config');
$userid = 1;
$db->query('TRUNCATE TABLE ' . $db_config['prefix'] . '_users');
$db->query('TRUNCATE TABLE ' . $db_config['prefix'] . '_authors');
$sth = $db->prepare("INSERT INTO " . $db_config['prefix'] . "_users\n\t\t\t\t(userid, username, md5username, password, email, first_name, last_name, gender, photo, birthday, sig,\tregdate, question, answer, passlostkey, view_mail, remember, in_groups, active, checknum, last_login, last_ip, last_agent, last_openid, idsite)\n\t\t\t\tVALUES(" . $userid . ", :username, :md5username, :password, :email, :first_name, '', '', '', 0, '', " . NV_CURRENTTIME . ", :question, :answer_question, '', 0, 1, '', 1, '', " . NV_CURRENTTIME . ", '', '', '', 0)");
$sth->bindParam(':username', $array_data['nv_login'], PDO::PARAM_STR);
$sth->bindValue(':md5username', nv_md5safe($array_data['nv_login']), PDO::PARAM_STR);
$sth->bindParam(':password', $password, PDO::PARAM_STR);
$sth->bindParam(':email', $array_data['nv_email'], PDO::PARAM_STR);
$sth->bindParam(':first_name', $array_data['nv_login'], PDO::PARAM_STR);
$sth->bindParam(':question', $array_data['question'], PDO::PARAM_STR);
$sth->bindParam(':answer_question', $array_data['answer_question'], PDO::PARAM_STR);
$ok1 = $sth->execute();
$ok2 = $db->exec("INSERT INTO " . $db_config['prefix'] . "_authors (admin_id, editor, lev, files_level, position, addtime, edittime, is_suspend, susp_reason, check_num, last_login, last_ip, last_agent) VALUES(" . $userid . ", 'ckeditor', 1, 'adobe,application,archives,audio,documents,flash,images,real,video|1|1|1', 'Administrator', 0, 0, 0, '', '', 0, '', '')");
if ($ok1 and $ok2) {
try {
$db->query('INSERT INTO ' . $db_config['prefix'] . '_users_info (userid) VALUES (' . $userid . ')');
$db->query("INSERT INTO " . $db_config['prefix'] . "_groups_users (group_id, userid, data) VALUES(1, " . $userid . ", '0')");
$db->query("INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('sys', 'site', 'statistics_timezone', " . $db->quote(NV_SITE_TIMEZONE_NAME) . ")");
$db->query("INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('sys', 'site', 'site_email', " . $db->quote($global_config['site_email']) . ")");