「工作程式」修訂間的差異
跳至導覽
跳至搜尋
| 第32行: | 第32行: | ||
?></pre> | ?></pre> | ||
| − | ====(四) | + | ====(四)登入而不使用etable,須要判別 exec_type ,以避免反復出「登出」鈕==== |
<pre><?php | <pre><?php | ||
include_once 'userConstant.php' 或 'constant.php'; | include_once 'userConstant.php' 或 'constant.php'; | ||
| 第44行: | 第44行: | ||
if(isset($login->checkin) && $login->checkin==1){$str=…;} | if(isset($login->checkin) && $login->checkin==1){$str=…;} | ||
echo $str; | echo $str; | ||
| + | if(!isset($_REQUEST['exec_type'])){echo $html2;} | ||
| + | ?></pre> | ||
| + | |||
| + | ====(五)使用 etable ,是否登入不影響結構。須要判別 exec_type ,以避免反復出 theme==== | ||
| + | <pre><?php | ||
| + | include 'userConstant.php' 或 'constant.php'; | ||
| + | include 'theme.php'; | ||
| + | if(!isset($_REQUEST['exec_type'])){echo $html1;} // 本行須在 theme.php 與 $ET->main(); 之間 | ||
| + | include CLASS_FILE_PATH.'/database/etable.php'; | ||
| + | $ET = new etable; | ||
| + | $ET->errPrompt=…; // 本行在須登入時才出現 | ||
| + | $ET->loginTable=…; // 本行在須登入時才出現 | ||
| + | $ET->sql[0]="…"; | ||
| + | $ET->main(); | ||
if(!isset($_REQUEST['exec_type'])){echo $html2;} | if(!isset($_REQUEST['exec_type'])){echo $html2;} | ||
?></pre> | ?></pre> | ||
於 2021年7月8日 (四) 23:26 的修訂
(一)免登入,未使用資料庫(預設連資料庫,不管工作程式須不須要)
<?php include_once 'userConstant.php' 或 'constant.php'; // 載入伺服器參數 include_once 'theme.php'; // 載入 site 布景,順便會載入 site 常、變數,連資料庫 $str=…; echo $html1; echo $str; echo $html2; ?>
(二)使用 ajax 更新畫面,不靠翻頁
<?php
include_once 'userConstant.php' 或 'constant.php';
include_once 'theme.php';
include CLASS_FILE_PATH.'/database/login.php'; // 只用 login::js() ,不使用 login()
if(!isset($_REQUEST['某個透過ajax傳送的變數'])){echo $html1.login::js();}
…
if(!isset($_REQUEST['某個透過ajax傳送的變數'])){echo $html2;}
?>
(三)免登入,使用資料庫(預設連資料庫,不管工作程式須不須要)
<?php
include_once 'userConstant.php' 或 '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;
?>
(四)登入而不使用etable,須要判別 exec_type ,以避免反復出「登出」鈕
<?php
include_once 'userConstant.php' 或 'constant.php';
include_once 'theme.php'; // 載入 site 布景,順便會載入 site 常、變數,連資料庫
if(!isset($_REQUEST['exec_type'])){echo $html1;} // 本行須在 theme.php 與 $login->logon(); 之間
include_once CLASS_FILE_PATH."/database/login.php";
$login = new login;
$login->errPrompt="<br/><span style='color:red;'>僅允許………</span>";
$login->loginTable=array('tableName'=>'認證表','name'=>'帳號欄','psd'=>'密碼欄','grp'=>'群組欄','canWorkGrp'=>'通過群組');
$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 'userConstant.php' 或 'constant.php';
include 'theme.php';
if(!isset($_REQUEST['exec_type'])){echo $html1;} // 本行須在 theme.php 與 $ET->main(); 之間
include CLASS_FILE_PATH.'/database/etable.php';
$ET = new etable;
$ET->errPrompt=…; // 本行在須登入時才出現
$ET->loginTable=…; // 本行在須登入時才出現
$ET->sql[0]="…";
$ET->main();
if(!isset($_REQUEST['exec_type'])){echo $html2;}
?>