11月9日~11月10日<br />繼續aupair的付費功能,不過好多東西都忘記了,這還要在想一下李總的需求。</p><p>配置虛擬機器主機給aupair</p><p>使用同一個連接埠,更具不同url來區分,要配置:</p><p>1、c:/WINDOWS/system32/drivers/etc目錄下的host檔案,添加配置資訊如下:<br />127.0.0.1 www.aupair.net<br />127.0.0.1 www.uab.net</p><p>要配置apache設定檔:</p><p>#如果要基於url的多虛擬機器,必須要有這個配置<br />NameVirtualHost *:80</p><p>#VirtualHost For Under A Bus<br /><VirtualHost *:80><br /> ServerAdmin admin@admin.com<br /> DocumentRoot F:/WebRoot/webuab</p><p>#here is the url, you should synchronize it with the host configuration<br /> ServerName www.uab.net<br /> ErrorLog logs/uabdev.5ims.net-error_log<br /> CustomLog logs/uabdev.5ims.net-access_log common<br /><Directory /><br /> Options FollowSymLinks MultiViews<br /> AllowOverride All<br /> Order allow,deny<br /> Allow from All<br /></Directory><br /><Directory "F:/WebRoot/webuab/"><br />Options FollowSymLinks<br />AllowOverride All<br />Order allow,deny<br />Allow from All<br /></Directory><br /></VirtualHost></p><p>#VirtualHost For Aupair<br /><VirtualHost *:80><br /> ServerAdmin admin@admin.com<br /> DocumentRoot F:/WebRoot/aupair<br />#here is the url, you should synchronize it with the host configuration<br /> ServerName www.aupair.net<br /> ErrorLog logs/uabdev.5ims.net-error_log<br /> CustomLog logs/uabdev.5ims.net-access_log common<br /><Directory /><br /> Options FollowSymLinks MultiViews<br /> AllowOverride All<br /> Order allow,deny<br /> Allow from All<br /></Directory><br /><Directory "F:/WebRoot/aupair/"><br />Options FollowSymLinks<br />AllowOverride All<br />Order allow,deny<br />Allow from All<br /></Directory><br /></VirtualHost></p><p>重新啟動apache,<br />分別在瀏覽器中輸入:</p><p>http://www.uab.net</p><p>http://www.aupair.net</p><p>成功,感謝趙堅~!</p><p>------------------------------<br />完成需求1:<br />aupair註冊完成後,預設不可用,點擊五個動態網頁面後重新導向到如下內容的付款頁面:<br />Your membership will be enabled as soon as the following has been paid:</p><p>90 Days Membership Fee GBP 20</p><p><a>Click here to go to PayPal to make the payment</a></p><p>添加一個到期時間lastpaytime在users表中:<br />ALTER TABLE users ADD `renewaldate` timestamp NOT NULL default CURRENT_TIMESTAMP</p><p>這裡添加續約日期欄位,預設為記錄插入日期,也就是aupair註冊的時候就剛剛好是續約的日期。</p><p>添加邏輯代碼到page目錄下的index.class.php中:<br />//##########payment limit<br />if(Context::$session->Identity == 2){<br />$payed = strtotime($user->renewaldate) - strtotime($thisDate);<br />if($payed > 0){<br />Context::$session->Payed=TRUE;<br />}else{<br />Context::$session->Payed=FALSE;<br />}<br />}<br />//##########payment limit<br />這裡在使用者登入的時候,將令牌設定到session中</p><p>在BasePage中添加許可權限制,判斷如果aupair登入後,Context::$session->Payed的值為false,那麼就去限制操作:</p><p>也就是李總說的:"點擊五個動態網頁面後重新導向到如下內容的付款頁面"。</p><p>Page目錄下建立:<br />payTip.class.php</p><p>在template下建立:<br />payTip.tpl</p><p>建立一個交易資訊表,欄位如下:<br />userid<br />txn_id<br />payment_date<br />payment_status<br />建表sql:</p><p>CREATE TABLE `aupair`.`paypalinfo` (<br />`id` INT( 11 ) NOT NULL ,<br />`userid` INT( 11 ) NOT NULL ,<br />`txn_id` VARCHAR( 50 ) NOT NULL ,<br />`payment_date` DATE NOT NULL<br />) ENGINE = MYISAM </p><p>這裡在儲存的時候要有一個判斷,不能讓使用者重複提交。<br />再有,如果一個使用者在paypal中已經交易完成,而在返回網站的時候沒有更新就發生意外,比如死機、斷網、那又該怎麼辦呢?</p><p>------------------------------<br />需求2:<br />如果沒有註冊aupair,而且點擊了付款串連,那麼就重新導向到aupair註冊頁面,如果註冊可直接登入</p><p>------------------------------<br />需求3:<br />如果註冊了,繳費了,但是時間用光了,那麼也要重新導向到繳費頁面。<br />Your membership payment has expired, please pay the following to renew your membership for another 90 days</p><p>Renewal Membership Fee GBP 20</p><p><a>Click here to go to PayPal to make the payment</a><br />