diff --git a/application/controllers/example.php b/application/controllers/example.php index 774c42e..e4a462b 100644 --- a/application/controllers/example.php +++ b/application/controllers/example.php @@ -173,7 +173,7 @@ class Example extends CI_Controller { function create_user() { - $a = $this->aauth->create_user("aaa@a.com", "12345", "aa"); + $a = $this->aauth->create_user("admin@admin.com", "12345", "Admin"); if ($a) echo "tmm "; diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index 4665189..cb14686 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -11,7 +11,7 @@ * * @copyright 2014 Emre Akay * - * @version 1.0 + * @version 2.0 * * @license LGPL * @license http://opensource.org/licenses/LGPL-3.0 Lesser GNU Public License diff --git a/sql/Aauth_v2.sql b/sql/Aauth_v2.sql new file mode 100644 index 0000000..52aafbd --- /dev/null +++ b/sql/Aauth_v2.sql @@ -0,0 +1,171 @@ +/* +Navicat MySQL Data Transfer + +Source Server : local +Source Server Version : 50508 +Source Host : localhost:3306 +Source Database : aauth_v2_dev + +Target Server Type : MYSQL +Target Server Version : 50508 +File Encoding : 65001 + +Date: 2014-07-03 21:23:21 +*/ + +SET FOREIGN_KEY_CHECKS=0; + +-- ---------------------------- +-- Table structure for `aauth_groups` +-- ---------------------------- +DROP TABLE IF EXISTS `aauth_groups`; +CREATE TABLE `aauth_groups` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` text, + PRIMARY KEY (`id`), + KEY `id_index` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of aauth_groups +-- ---------------------------- +INSERT INTO `aauth_groups` VALUES ('1', 'Admin'); +INSERT INTO `aauth_groups` VALUES ('2', 'Public'); +INSERT INTO `aauth_groups` VALUES ('3', 'Default'); + +-- ---------------------------- +-- Table structure for `aauth_perms` +-- ---------------------------- +DROP TABLE IF EXISTS `aauth_perms`; +CREATE TABLE `aauth_perms` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` text, + `definition` text, + PRIMARY KEY (`id`), + KEY `id_index` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of aauth_perms +-- ---------------------------- + +-- ---------------------------- +-- Table structure for `aauth_perm_to_group` +-- ---------------------------- +DROP TABLE IF EXISTS `aauth_perm_to_group`; +CREATE TABLE `aauth_perm_to_group` ( + `perm_id` int(11) DEFAULT NULL, + `group_id` int(11) DEFAULT NULL, + KEY `perm_id_group_id_index` (`perm_id`,`group_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of aauth_perm_to_group +-- ---------------------------- + +-- ---------------------------- +-- Table structure for `aauth_perm_to_user` +-- ---------------------------- +DROP TABLE IF EXISTS `aauth_perm_to_user`; +CREATE TABLE `aauth_perm_to_user` ( + `perm_id` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT NULL, + KEY `perm_id_user_id_index` (`perm_id`,`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of aauth_perm_to_user +-- ---------------------------- + +-- ---------------------------- +-- Table structure for `aauth_pms` +-- ---------------------------- +DROP TABLE IF EXISTS `aauth_pms`; +CREATE TABLE `aauth_pms` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `sender_id` int(11) NOT NULL, + `receiver_id` int(11) NOT NULL, + `title` text NOT NULL, + `message` text, + `date` datetime DEFAULT NULL, + `read` int(11) DEFAULT '0', + PRIMARY KEY (`id`), + KEY `full_index` (`id`,`sender_id`,`receiver_id`,`read`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of aauth_pms +-- ---------------------------- + +-- ---------------------------- +-- Table structure for `aauth_system_variables` +-- ---------------------------- +DROP TABLE IF EXISTS `aauth_system_variables`; +CREATE TABLE `aauth_system_variables` ( + `key` text NOT NULL, + `value` text +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of aauth_system_variables +-- ---------------------------- + +-- ---------------------------- +-- Table structure for `aauth_users` +-- ---------------------------- +DROP TABLE IF EXISTS `aauth_users`; +CREATE TABLE `aauth_users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `email` text COLLATE utf8_turkish_ci NOT NULL, + `pass` text COLLATE utf8_turkish_ci NOT NULL, + `name` text COLLATE utf8_turkish_ci, + `banned` int(11) DEFAULT '0', + `last_login` datetime DEFAULT NULL, + `last_activity` datetime DEFAULT NULL, + `last_login_attempt` datetime DEFAULT NULL, + `forgot_exp` text COLLATE utf8_turkish_ci, + `remember_time` datetime DEFAULT NULL, + `remember_exp` text COLLATE utf8_turkish_ci, + `verification_code` text COLLATE utf8_turkish_ci, + `ip_address` text COLLATE utf8_turkish_ci, + `login_attempts` int(11) DEFAULT '0', + PRIMARY KEY (`id`), + KEY `id_index` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci; + +-- ---------------------------- +-- Records of aauth_users +-- ---------------------------- +INSERT INTO `aauth_users` VALUES ('1', 'admin@admin.com', 'dd5073c93fb477a167fd69072e95455834acd93df8fed41a2c468c45b394bfe3', 'Admin', '0', null, null, null, null, null, null, null, null, '0'); + +-- ---------------------------- +-- Table structure for `aauth_user_to_group` +-- ---------------------------- +DROP TABLE IF EXISTS `aauth_user_to_group`; +CREATE TABLE `aauth_user_to_group` ( + `user_id` int(11) NOT NULL DEFAULT '0', + `group_id` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`user_id`,`group_id`), + KEY `user_id_group_id_index` (`user_id`,`group_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of aauth_user_to_group +-- ---------------------------- +INSERT INTO `aauth_user_to_group` VALUES ('1', '1'); +INSERT INTO `aauth_user_to_group` VALUES ('1', '3'); + +-- ---------------------------- +-- Table structure for `aauth_user_variables` +-- ---------------------------- +DROP TABLE IF EXISTS `aauth_user_variables`; +CREATE TABLE `aauth_user_variables` ( + `user_id` int(11) NOT NULL, + `key` text NOT NULL, + `value` text, + KEY `user_id_index` (`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of aauth_user_variables +-- ---------------------------- diff --git a/sql/aauth.sql b/sql/aauth.sql deleted file mode 100644 index 93704cd..0000000 --- a/sql/aauth.sql +++ /dev/null @@ -1,144 +0,0 @@ --- phpMyAdmin SQL Dump --- version 3.3.9 --- http://www.phpmyadmin.net --- --- Anamakine: localhost --- Üretim Zamanı: 18 Eylül 2013 saat 10:18:09 --- Sunucu sürümü: 5.5.8 --- PHP Sürümü: 5.3.5 - -SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; - --- --- Veritabanı: `aauth2` --- - --- -------------------------------------------------------- - --- --- Tablo için tablo yapısı `aauth_groups` --- - -CREATE TABLE IF NOT EXISTS `aauth_groups` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` text, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ; - --- --- Tablo döküm verisi `aauth_groups` --- - -INSERT INTO `aauth_groups` (`id`, `name`) VALUES -(1, 'admin'), -(2, 'public'), -(3, 'default'); - --- -------------------------------------------------------- - --- --- Tablo için tablo yapısı `aauth_perms` --- - -CREATE TABLE IF NOT EXISTS `aauth_perms` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` text, - `definition` text, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - --- --- Tablo döküm verisi `aauth_perms` --- - - --- -------------------------------------------------------- - --- --- Tablo için tablo yapısı `aauth_perm_to_group` --- - -CREATE TABLE IF NOT EXISTS `aauth_perm_to_group` ( - `perm_id` int(11) DEFAULT NULL, - `group_id` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Tablo döküm verisi `aauth_perm_to_group` --- - - --- -------------------------------------------------------- - --- --- Tablo için tablo yapısı `aauth_pm` --- - -CREATE TABLE IF NOT EXISTS `aauth_pm` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `sender_id` int(11) NOT NULL, - `receiver_id` int(11) NOT NULL, - `message` text, - `date` datetime DEFAULT NULL, - `read` int(11) DEFAULT '0', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - --- --- Tablo döküm verisi `aauth_pm` --- - - --- -------------------------------------------------------- - --- --- Tablo için tablo yapısı `aauth_users` --- - -CREATE TABLE IF NOT EXISTS `aauth_users` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `email` text COLLATE utf8_turkish_ci NOT NULL, - `pass` text COLLATE utf8_turkish_ci NOT NULL, - `name` text COLLATE utf8_turkish_ci, - `banned` int(11) DEFAULT '0', - `last_login` datetime DEFAULT NULL, - `last_activity` datetime DEFAULT NULL, - `last_login_attempt` datetime DEFAULT NULL, - `forgot_exp` text COLLATE utf8_turkish_ci, - `remember_time` datetime DEFAULT NULL, - `remember_exp` text COLLATE utf8_turkish_ci, - `verification_code` text COLLATE utf8_turkish_ci, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci AUTO_INCREMENT=2 ; - --- --- Tablo döküm verisi `aauth_users` --- - -INSERT INTO `aauth_users` (`id`, `email`, `pass`, `name`, `banned`, `last_login`, `last_activity`, `last_login_attempt`, `forgot_exp`, `remember_time`, `remember_exp`, `verification_code`) VALUES -(1, 'admin@admin.com', 'admin pass', 'Admin', 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - --- -------------------------------------------------------- - --- --- Tablo için tablo yapısı `aauth_user_to_group` --- - -CREATE TABLE IF NOT EXISTS `aauth_user_to_group` ( - `user_id` int(11) NOT NULL DEFAULT '0', - `group_id` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`user_id`,`group_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Tablo döküm verisi `aauth_user_to_group` --- - -INSERT INTO `aauth_user_to_group` (`user_id`, `group_id`) VALUES -(1, 1);