[Astrospaces-commits] SF.net SVN: astrospaces: [89] trunk
Brought to you by:
p3net
From: <p3...@us...> - 2007-08-01 23:42:24
|
Revision: 89 http://astrospaces.svn.sourceforge.net/astrospaces/?rev=89&view=rev Author: p3net Date: 2007-08-01 16:42:24 -0700 (Wed, 01 Aug 2007) Log Message: ----------- Add user_level to users table to see if user is an admin or not. Modified Paths: -------------- trunk/develop/new-schema.sql trunk/functions/user.php Modified: trunk/develop/new-schema.sql =================================================================== --- trunk/develop/new-schema.sql 2007-08-01 23:36:20 UTC (rev 88) +++ trunk/develop/new-schema.sql 2007-08-01 23:42:24 UTC (rev 89) @@ -1,156 +1,157 @@ -DROP TABLE IF EXISTS `as_actions`; -CREATE TABLE `as_actions` ( - `action_id` int(10) unsigned NOT NULL auto_increment, - `action_timestamp` int(10) unsigned NOT NULL, - `action` int(2) unsigned NOT NULL, - `for` int(11) unsigned NOT NULL, - PRIMARY KEY (`action_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -DROP TABLE IF EXISTS `as_blog`; -CREATE TABLE `as_blog` ( - `blog_id` int(10) unsigned NOT NULL auto_increment, - `title` varchar(45) NOT NULL, - `blog_timestamp` int(10) unsigned NOT NULL, - `content` text NOT NULL, - `author_id` int(11) unsigned NOT NULL, - PRIMARY KEY (`blog_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -DROP TABLE IF EXISTS `as_blog_comment`; -CREATE TABLE `as_blog_comment` ( - `comment_id` int(10) unsigned NOT NULL auto_increment, - `post_id` int(10) unsigned NOT NULL, - `author_id` int(10) unsigned NOT NULL, - `comment` text NOT NULL, - `post_timestamp` int(10) unsigned NOT NULL, - PRIMARY KEY (`comment_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -DROP TABLE IF EXISTS `as_comments`; -CREATE TABLE `as_comments` ( - `comment_id` int(10) unsigned NOT NULL auto_increment, - `comment_timestamp` int(10) unsigned NOT NULL, - `poster_id` int(11) unsigned NOT NULL, - `recipient_id` int(11) unsigned NOT NULL, - `comment` text NOT NULL, - PRIMARY KEY (`comment_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; - -DROP TABLE IF EXISTS `as_friends`; -CREATE TABLE `as_friends` ( - `couple_id` int(10) unsigned NOT NULL auto_increment, - `user1_id` int(10) unsigned NOT NULL, - `user2_id` int(10) unsigned NOT NULL, - `accepted` tinyint(1) unsigned NOT NULL, - PRIMARY KEY (`couple_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; - -DROP TABLE IF EXISTS `as_group_resolver`; -CREATE TABLE `as_group_resolver` ( - `pair_id` int(10) unsigned NOT NULL auto_increment, - `user_id` int(10) unsigned NOT NULL, - `group_id` int(10) unsigned NOT NULL, - `join_date` int(10) unsigned NOT NULL COMMENT 'Unix timestamp', - PRIMARY KEY (`pair_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; - -DROP TABLE IF EXISTS `as_groups`; -CREATE TABLE `as_groups` ( - `group_id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(45) NOT NULL, - `founder` int(11) unsigned NOT NULL, - `create_timestamp` int(10) unsigned NOT NULL, - PRIMARY KEY (`group_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; - -DROP TABLE IF EXISTS `as_image_comments`; -CREATE TABLE `as_image_comments` ( - `comment_id` int(10) unsigned NOT NULL auto_increment, - `image_id` int(11) unsigned NOT NULL, - `post_timestamp` int(10) unsigned NOT NULL, - `author` int(11) unsigned NOT NULL, - `comment` text NOT NULL, - PRIMARY KEY (`comment_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -DROP TABLE IF EXISTS `as_images`; -CREATE TABLE `as_images` ( - `img_id` int(10) unsigned NOT NULL auto_increment, - `owner_id` int(10) unsigned NOT NULL, - `content` blob NOT NULL COMMENT 'binary image', - `desc` text NOT NULL, - `width` int(4) unsigned NOT NULL, - `height` int(4) unsigned NOT NULL, - `name` text NOT NULL, - `views` int(6) unsigned NOT NULL, - `mime_type` varchar(20) NOT NULL, - PRIMARY KEY (`img_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -DROP TABLE IF EXISTS `as_private_messages`; -CREATE TABLE `as_private_messages` ( - `message_id` int(10) unsigned NOT NULL auto_increment, - `sender_id` int(11) unsigned NOT NULL, - `recipient_id` int(11) unsigned NOT NULL, - `send_date` int(10) unsigned NOT NULL, - `subject` varchar(80) NOT NULL, - `message` text NOT NULL, - `read` tinyint(1) unsigned NOT NULL default '0', - PRIMARY KEY (`message_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -DROP TABLE IF EXISTS `as_sessions`; -CREATE TABLE `as_sessions` ( - `session_id` int(10) unsigned NOT NULL auto_increment, - `user_id` int(11) unsigned NOT NULL, - `ip` varchar(12) NOT NULL, - `last_update` int(10) unsigned NOT NULL, - PRIMARY KEY (`session_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; - -DROP TABLE IF EXISTS `as_users`; -CREATE TABLE `as_users` ( - `user_id` int(10) unsigned NOT NULL auto_increment, - `password` varchar(16) NOT NULL, - `join_date` int(10) unsigned NOT NULL COMMENT 'Unix timestamp', - `last_login` int(10) unsigned NOT NULL COMMENT 'Unix timestamp', - `time_offset` tinyint(3) unsigned NOT NULL, - `email` varchar(60) NOT NULL, - `privacy` tinyint(1) unsigned NOT NULL default '0', - PRIMARY KEY (`user_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -DROP TABLE IF EXISTS `as_static_profile_fields`; -CREATE TABLE `as_static_profile_fields` ( - `static_profile_field_id` int(10) unsigned NOT NULL auto_increment, - `user_id` int(10) unsigned NOT NULL, - `display_name` varchar(45) NOT NULL, - `blurb` text NOT NULL, - `aim` varchar(45) NOT NULL, - `yim` varchar(45) NOT NULL, - `jabber` varchar(45) NOT NULL, - `irc` varchar(45) NOT NULL, - `icq` varchar(45) NOT NULL, - `msn` varchar(45) NOT NULL, - `user_image` int(11) unsigned NOT NULL, - PRIMARY KEY (`static_profile_field_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - - -DROP TABLE IF EXISTS `as_dynamic_profile_fields`; -CREATE TABLE `as_dynamic_profile_fields` ( - `dynamic_profile_field_id` int(10) unsigned NOT NULL auto_increment, - `field_name` varchar(128) NOT NULL default 'new field', - `field_description` varchar(128), - PRIMARY KEY (`dynamic_profile_field_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -DROP TABLE IF EXISTS `as_dynamic_profile_values`; -CREATE TABLE `as_dynamic_profile_values` ( - `dynamic_profile_field_id` int(10) unsigned NOT NULL auto_increment, - `user_id` int(10) unsigned NOT NULL, - `field_name` varchar(128) NOT NULL default 'new field', - `field_value` varchar(128), -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - +DROP TABLE IF EXISTS `as_actions`; +CREATE TABLE `as_actions` ( + `action_id` int(10) unsigned NOT NULL auto_increment, + `action_timestamp` int(10) unsigned NOT NULL, + `action` int(2) unsigned NOT NULL, + `for` int(11) unsigned NOT NULL, + PRIMARY KEY (`action_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +DROP TABLE IF EXISTS `as_blog`; +CREATE TABLE `as_blog` ( + `blog_id` int(10) unsigned NOT NULL auto_increment, + `title` varchar(45) NOT NULL, + `blog_timestamp` int(10) unsigned NOT NULL, + `content` text NOT NULL, + `author_id` int(11) unsigned NOT NULL, + PRIMARY KEY (`blog_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +DROP TABLE IF EXISTS `as_blog_comment`; +CREATE TABLE `as_blog_comment` ( + `comment_id` int(10) unsigned NOT NULL auto_increment, + `post_id` int(10) unsigned NOT NULL, + `author_id` int(10) unsigned NOT NULL, + `comment` text NOT NULL, + `post_timestamp` int(10) unsigned NOT NULL, + PRIMARY KEY (`comment_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +DROP TABLE IF EXISTS `as_comments`; +CREATE TABLE `as_comments` ( + `comment_id` int(10) unsigned NOT NULL auto_increment, + `comment_timestamp` int(10) unsigned NOT NULL, + `poster_id` int(11) unsigned NOT NULL, + `recipient_id` int(11) unsigned NOT NULL, + `comment` text NOT NULL, + PRIMARY KEY (`comment_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; + +DROP TABLE IF EXISTS `as_friends`; +CREATE TABLE `as_friends` ( + `couple_id` int(10) unsigned NOT NULL auto_increment, + `user1_id` int(10) unsigned NOT NULL, + `user2_id` int(10) unsigned NOT NULL, + `accepted` tinyint(1) unsigned NOT NULL, + PRIMARY KEY (`couple_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; + +DROP TABLE IF EXISTS `as_group_resolver`; +CREATE TABLE `as_group_resolver` ( + `pair_id` int(10) unsigned NOT NULL auto_increment, + `user_id` int(10) unsigned NOT NULL, + `group_id` int(10) unsigned NOT NULL, + `join_date` int(10) unsigned NOT NULL COMMENT 'Unix timestamp', + PRIMARY KEY (`pair_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; + +DROP TABLE IF EXISTS `as_groups`; +CREATE TABLE `as_groups` ( + `group_id` int(10) unsigned NOT NULL auto_increment, + `name` varchar(45) NOT NULL, + `founder` int(11) unsigned NOT NULL, + `create_timestamp` int(10) unsigned NOT NULL, + PRIMARY KEY (`group_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; + +DROP TABLE IF EXISTS `as_image_comments`; +CREATE TABLE `as_image_comments` ( + `comment_id` int(10) unsigned NOT NULL auto_increment, + `image_id` int(11) unsigned NOT NULL, + `post_timestamp` int(10) unsigned NOT NULL, + `author` int(11) unsigned NOT NULL, + `comment` text NOT NULL, + PRIMARY KEY (`comment_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +DROP TABLE IF EXISTS `as_images`; +CREATE TABLE `as_images` ( + `img_id` int(10) unsigned NOT NULL auto_increment, + `owner_id` int(10) unsigned NOT NULL, + `content` blob NOT NULL COMMENT 'binary image', + `desc` text NOT NULL, + `width` int(4) unsigned NOT NULL, + `height` int(4) unsigned NOT NULL, + `name` text NOT NULL, + `views` int(6) unsigned NOT NULL, + `mime_type` varchar(20) NOT NULL, + PRIMARY KEY (`img_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +DROP TABLE IF EXISTS `as_private_messages`; +CREATE TABLE `as_private_messages` ( + `message_id` int(10) unsigned NOT NULL auto_increment, + `sender_id` int(11) unsigned NOT NULL, + `recipient_id` int(11) unsigned NOT NULL, + `send_date` int(10) unsigned NOT NULL, + `subject` varchar(80) NOT NULL, + `message` text NOT NULL, + `read` tinyint(1) unsigned NOT NULL default '0', + PRIMARY KEY (`message_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +DROP TABLE IF EXISTS `as_sessions`; +CREATE TABLE `as_sessions` ( + `session_id` int(10) unsigned NOT NULL auto_increment, + `user_id` int(11) unsigned NOT NULL, + `ip` varchar(12) NOT NULL, + `last_update` int(10) unsigned NOT NULL, + PRIMARY KEY (`session_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; + +DROP TABLE IF EXISTS `as_users`; +CREATE TABLE `as_users` ( + `user_id` int(10) unsigned NOT NULL auto_increment, + `password` varchar(16) NOT NULL, + `join_date` int(10) unsigned NOT NULL COMMENT 'Unix timestamp', + `last_login` int(10) unsigned NOT NULL COMMENT 'Unix timestamp', + `time_offset` tinyint(3) unsigned NOT NULL, + `email` varchar(60) NOT NULL, + `privacy` tinyint(1) unsigned NOT NULL default '0', + `user_level` tinyint(1) unsigned NOT NULL default '0', + PRIMARY KEY (`user_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +DROP TABLE IF EXISTS `as_static_profile_fields`; +CREATE TABLE `as_static_profile_fields` ( + `static_profile_field_id` int(10) unsigned NOT NULL auto_increment, + `user_id` int(10) unsigned NOT NULL, + `display_name` varchar(45) NOT NULL, + `blurb` text NOT NULL, + `aim` varchar(45) NOT NULL, + `yim` varchar(45) NOT NULL, + `jabber` varchar(45) NOT NULL, + `irc` varchar(45) NOT NULL, + `icq` varchar(45) NOT NULL, + `msn` varchar(45) NOT NULL, + `user_image` int(11) unsigned NOT NULL, + PRIMARY KEY (`static_profile_field_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + + +DROP TABLE IF EXISTS `as_dynamic_profile_fields`; +CREATE TABLE `as_dynamic_profile_fields` ( + `dynamic_profile_field_id` int(10) unsigned NOT NULL auto_increment, + `field_name` varchar(128) NOT NULL default 'new field', + `field_description` varchar(128), + PRIMARY KEY (`dynamic_profile_field_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +DROP TABLE IF EXISTS `as_dynamic_profile_values`; +CREATE TABLE `as_dynamic_profile_values` ( + `dynamic_profile_field_id` int(10) unsigned NOT NULL auto_increment, + `user_id` int(10) unsigned NOT NULL, + `field_name` varchar(128) NOT NULL default 'new field', + `field_value` varchar(128), +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + Modified: trunk/functions/user.php =================================================================== --- trunk/functions/user.php 2007-08-01 23:36:20 UTC (rev 88) +++ trunk/functions/user.php 2007-08-01 23:42:24 UTC (rev 89) @@ -424,5 +424,28 @@ $time = $time + $diff; return date('m/d/Y G:i:s', $time); } + function is_admin() + { + if($session->logged_in()) + { + $_query="SELECT `user_level` FROM " . AS_TBL_USERS . " WHERE `user_id`='" . $user->data['user_id'] . "'"; + $db->Execute($_query); + + $res = $db->FetchArray($_query); + $res = $res['user_leve']; + if($res == 1) + { + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |