配置虚拟主机给aupair
使用同一个端口,更具不同url来区分,要配置:
1、c:/WINDOWS/system32/drivers/etc目录下的host文件,添加配置信息如下:
127.0.0.1 www.aupair.net
127.0.0.1 www.uab.net
要配置apache配置文件:
#如果要基于url的多虚拟机,必须要有这个配置
NameVirtualHost *:80
#VirtualHost For Under A Bus
<VirtualHost *:80>
ServerAdmin admin@admin.com
DocumentRoot F:/WebRoot/webuab
#here is the url, you should synchronize it with the host configuration
ServerName www.uab.net
ErrorLog logs/uabdev.5ims.net-error_log
CustomLog logs/uabdev.5ims.net-access_log common
<Directory />
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from All
</Directory>
<Directory "F:/WebRoot/webuab/">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from All
</Directory>
</VirtualHost>
#VirtualHost For Aupair
<VirtualHost *:80>
ServerAdmin admin@admin.com
DocumentRoot F:/WebRoot/aupair
#here is the url, you should synchronize it with the host configuration
ServerName www.aupair.net
ErrorLog logs/uabdev.5ims.net-error_log
CustomLog logs/uabdev.5ims.net-access_log common
<Directory />
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from All
</Directory>
<Directory "F:/WebRoot/aupair/">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from All
</Directory>
</VirtualHost>
重新启动apache,
分别在浏览器中输入:
http://www.uab.net
http://www.aupair.net
成功,感谢赵坚~!
------------------------------
完成需求1:
aupair注册完成后,默认不可用,点击五个动态页面后重定向到如下内容的付款页面:
Your membership will be enabled as soon as the following has been paid:
90 Days Membership Fee GBP 20
<a>Click here to go to PayPal to make the payment</a>
添加一个过期时间lastpaytime在users表中:
ALTER TABLE users ADD `renewaldate` timestamp NOT NULL default CURRENT_TIMESTAMP
这里添加续费日期字段,默认为记录插入日期,也就是aupair注册的时候就刚刚好是续费的日期。
添加逻辑代码到page目录下的index.class.php中:
//##########payment limit
if(Context::$session->Identity == 2){
$payed = strtotime($user->renewaldate) - strtotime($thisDate);
if($payed > 0){
Context::$session->Payed=TRUE;
}else{
Context::$session->Payed=FALSE;
}
}
//##########payment limit
这里在用户登录的时候,将令牌设置到session中
在BasePage中添加权限限制,判断如果aupair登录后,Context::$session->Payed的值为false,那么就去限制操作:
也就是李总说的:"点击五个动态页面后重定向到如下内容的付款页面"。
Page目录下新建:
payTip.class.php
在template下新建:
payTip.tpl
创建一个交易信息表,字段如下:
userid
txn_id
payment_date
payment_status
建表sql:
CREATE TABLE `aupair`.`paypalinfo` (
`id` INT( 11 ) NOT NULL ,
`userid` INT( 11 ) NOT NULL ,
`txn_id` VARCHAR( 50 ) NOT NULL ,
`payment_date` DATE NOT NULL
) ENGINE = MYISAM
这里在保存的时候要有一个判断,不能让用户重复提交。
再有,如果一个用户在paypal中已经交易完成,而在返回站点的时候没有更新就发生意外,比如死机、断网、那又该怎么办呢?
------------------------------
需求2:
如果没有注册aupair,而且点击了付款连接,那么就重定向到aupair注册页面,如果注册可直接登录
------------------------------
需求3:
如果注册了,缴费了,但是时间用光了,那么也要重定向到缴费页面。
Your membership payment has expired, please pay the following to renew your membership for another 90 days
Renewal Membership Fee GBP 20
<a>Click here to go to PayPal to make the payment</a>