「LiteSite/工作程式」修訂間的差異
跳至導覽
跳至搜尋
(→三、登入) |
|||
| 第24行: | 第24行: | ||
?></pre> | ?></pre> | ||
| − | === | + | ===三、登入,須要判別 exec_type ,以避免反復出「登出」鈕=== |
<pre><?php | <pre><?php | ||
include_once '../../constant.php'; // 載入伺服器參數 | include_once '../../constant.php'; // 載入伺服器參數 | ||
於 2021年6月14日 (一) 22:23 的修訂
- !isset($_REQUEST['exec_type']) 條件是給一般工作程式用的,只要 exec_type 沒了,就重刷新的 theme
- !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 ,是否登入不影響結構
<?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;}
?>