SQL加入Joomla用户
joomla有多种加密方式,默认用的方式是md5(密码+32位随机字串):md5(32位随机字串).如果只在数据库中的users表插入记录,在joomla后台将会显示不出新加入的用户,这是因为用户跟其他组权限表有关联.
完整的加入用户方法如下:
INSERT INTO jos_users (`name`,`username`,`password`,`email`,`usertype`,`gid`)VALUES('william','william',CONCAT(MD5(CONCAT('123123','wp0mDKxbvV3D3qNHW9gpCwfjHN3WjkH3')),':','wp0mDKxbvV3D3qNHW9gpCwfjHN3WjkH3'),该邮件地址已受到反垃圾邮件插件保护。要显示它需要在浏览器中启用 JavaScript。','Super Administrator',25);
INSERT INTO jos_core_acl_aro (`section_value`, `value`,`name`)SELECT 'users',id,username FROM jos_users WHERE id = @@IDENTITY;
INSERT INTO jos_core_acl_groups_aro_map (group_id,aro_id)SELECT 25,id FROM jos_core_acl_aro WHERE id NOT IN (SELECT aro_id FROM jos_core_acl_groups_aro_map)
INSERT INTO jos_core_acl_aro (`section_value`, `value`,`name`)SELECT 'users',id,username FROM jos_users WHERE id = @@IDENTITY;
INSERT INTO jos_core_acl_groups_aro_map (group_id,aro_id)SELECT 25,id FROM jos_core_acl_aro WHERE id NOT IN (SELECT aro_id FROM jos_core_acl_groups_aro_map)
然后在joomla后台就可以查到用户.
在后台把用户删除后,会残留多余的数据,这些数据有可能会影响SQL批量录入,可以用以下SQL语句删除:
DELETE FROM jos_core_acl_aro WHERE value NOT IN (SELECT id FROM jos_users);
DELETE FROM jos_core_acl_groups_aro_map WHERE aro_id NOT IN (SELECT id FROM jos_core_acl_aro);
DELETE FROM jos_core_acl_groups_aro_map WHERE aro_id NOT IN (SELECT id FROM jos_core_acl_aro);