LiteSite/工作程式

出自六年制學程
在2021年6月14日 (一) 22:31由丁志仁對話 | 貢獻所做的修訂版本

跳轉到: 導覽搜尋

出 $html1,$html2 的條件判斷

  1. 只要沒有引用 login.php 或 etable.php 就直接出,免條件判斷。如後的一和二。
  2. !isset($_REQUEST['exec_type']) 條件是給有登入或使用 etable 的工作程式用的,只要 exec_type 沒了,就重刷新頁,同時重做 theme 和「登出」鈕
  3. !isset($_REQUEST['ajax']) 條件是給 /webContent.php 專用的,任何 theme 都不重刷

一、免登入,未使用資料庫(預設連資料庫,不管工作程式須不須要)

<?php
include_once '../../constant.php';	// 載入伺服器參數
include_once "../theme.php";		// 載入 site 布景,順便會載入 site 常、變數,連資料庫
$str=…;
echo $html1;
echo $str;
echo $html2;
?>

二、免登入,使用資料庫(預設連資料庫,不管工作程式須不須要)

<?php
include_once '../../constant.php';	// 載入伺服器參數
include_once "../theme.php";		// 載入 site 布景,順便會載入 site 常、變數,連資料庫
$result=DB::queryF("…");
$str=…;
while($row=mysqli_fetch_assoc($result)){$str.=…;}
echo $html1;
echo $str;
echo $html2;
?>

三、登入,須要判別 exec_type ,以避免反復出「登出」鈕

<?php
include_once '../../constant.php';	// 載入伺服器參數
include_once "../theme.php";		// 載入 site 布景,順便會載入 site 常、變數,連資料庫
if(!isset($_REQUEST['exec_type'])){echo $html1;}	// 本行須在 theme.php 與 $login->logon(); 之間
$nowMsg="僅允許…看…。";
include_once CLASS_FILE_PATH."/database/login.php";
$login = new login;
$login->loginTable=…;
$login->logon();
if(isset($login->checkin) && $login->checkin==1){
	$str=…;
}
echo $str;
if(!isset($_REQUEST['exec_type'])){echo $html2;}
?>

四、使用 etable ,是否登入不影響結構。須判別 exec_type ,以避免反復出 theme

<?php
include_once '../../constant.php';	// 載入伺服器參數
include_once "../theme.php";		// 載入 site 布景,順便會載入 site 常、變數,連資料庫
if(!isset($_REQUEST['exec_type'])){echo $html1;}	// 本行須在 theme.php 與 $ET->main(); 之間
$nowMsg="僅允許…看…。";
include_once CLASS_FILE_PATH."/database/etable.php";
$ET = new etable;
$ET->loginTable=…;	// 本行在須登入時才出現
$ET->sql[0]="…";
$ET->main();
if(!isset($_REQUEST['exec_type'])){echo $html2;}
?>