小编Jos*_* T.的帖子

动态创建子域

我正在使用MVC框架(Yii)创建一个网站,我需要动态创建子域名,即http://company.website.com

So, in order to achieve this I've added a DNS wildcard (*.website.com). Now the problem is that my application controllers are all the same for www.website.com and for company.website.com. For example, I have a User controller with Register action (user/register). Now if I go to www.website.com/user/register I can register, but I can do exactly the same if I go to company.website.com/user/register. And this behaviour is the same for all my controllers.

I realize everything is …

wildcard-subdomain yii

5
推荐指数
1
解决办法
5788
查看次数

DB结构:两个表还是一个?

我有两个数据:1)用户和2)投资组合.每个用户只有一个投资组合.在注册过程中,用户必须填写以下字段:

  • 名字
  • 组合标题
  • 投资组合网址
  • 电子邮件
  • 密码

我目前的数据库结构如下所示:

CREATE TABLE `User` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `email` varchar(80) NOT NULL,
  `password` varchar(128) NOT NULL,
  `firstName` varchar(30) NOT NULL,
  `lastName` varchar(30) NOT NULL,
  `ip` varchar(15) NOT NULL,
  `lastVisit` int(10) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '2',
  `created` int(10) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id_UNIQUE` (`id`),
  UNIQUE KEY `email_UNIQUE` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;


CREATE TABLE `Portfolio` (
  `userId` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `url` …
Run Code Online (Sandbox Code Playgroud)

database-design

2
推荐指数
1
解决办法
153
查看次数

标签 统计

database-design ×1

wildcard-subdomain ×1

yii ×1