PHP歷理 檢視模板和標籤庫

onestopweb發表於2024-08-10
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title><?php echo $titlebar;?></title>
    <link rel="stylesheet" href="/_/_js/layui/css/layui.css">
    <link rel="stylesheet" href="/_/_css/base.css">
    <script src="/_/_js/layui/layui.js"></script>
    <script src="/_/_js/jquery-1.10.1.min.js"></script>
</head>
<?php echo $setextCss;?>
<body>
<div class="t-cont">
    <blockquote class="layui-elem-quote">
        <h2><?php echo $titlebar;?></h2>
        <p><span>當時時間:<?php echo date("Y-m-d H:i:s");?></span></p>
    </blockquote>
    <div class="layui-card layui-panel m-body" id="top">
        <div class="layui-card-header">
            <h3><?php echo $tags;?></h3>
        </div>
        <div class="layui-card-body ui-view">
            <?php echo $view;?>
        </div>
    </div>
    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12 m-foot">
        <p><a href="#top" class="g-r">TOP&nbsp;&nbsp;</a> ICbA1.0 of Chaoyi <a href="###">@留言</a></p>
    </div>
</div>
<script src="/_/_js/foot.js"></script>
</body>
</html>
<?php

function se_tags_textSql($conn,$sql){
    $result = sqlGetOne($conn,$sql);
    $html  = $result['news'].PHP_EOL;
    return $html;

}

function se_view_dl($name,$value){
    $html ="<dl><dt>{$name}:</dt>".PHP_EOL;
    $html .=$value.PHP_EOL;
    $html .=" </dl>".PHP_EOL;
    return $html;
}

function se_view_dlArr($name,$str){
    $html ="<dl><dt>{$name}:</dt>".PHP_EOL;
    $arr = strtoarr($str);
    foreach ($arr as $key => $value) {
        if($key==0){
            $html .= "<dd>首要的:$value</dd>".PHP_EOL;
        }else{
            $number = $key+1;
            $html .= "<dd>第{$number}個:$value</dd>".PHP_EOL;
        }
    }
    $html .=" </dl>".PHP_EOL;
    return $html;
}

function se_view_dlSql($name,$conn,$sql){
    $html ="<dl><dt>{$name}:</dt>".PHP_EOL;
    $result = sqlGetOne($conn,$sql);
    $html .=$result['news'].PHP_EOL;
    $html .=" </dl>".PHP_EOL;
    return $html;
}

function se_view_imgSql($src,$conn,$sql){
    $html="<img class='pimg'  src='$src' height='100px' title='主圖' alt='主圖' />";
    $result = mysqli_query($conn,$sql);
    while ($res = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
        $html .= "<img class='pimg' src='{$res['img']}' height='100px' title='{$res['tit']} &#10;{$res['cont']}' alt='{$res['tit']}' />".PHP_EOL;
    }
    return $html;
}
<?php
ini_set('session.gc_maxlifetime', 86400);
session_start();
define('CHAOYI',true);
require  $_SERVER['DOCUMENT_ROOT'].'/_/_php/data/database.php';
require ROOT.'_php/data/common.php';
require ROOT.'_php/data/config.php';
require ROOT.'_php/temp/se.inc.php';

//重新定義標題
$titlebar = '檢視使用者';

//安全設定
if(!isset($_GET['f'])){
    mysqli_close($conn);
    echo prompt('獲取不到資料','index.php',5,3);
    exit;
}
$f = trim($_GET['f']);
$id = destr($f);
if(!is_numeric($id)){
    mysqli_close($conn);
    echo prompt('解碼不符合條件','index.php',5,3);
    exit;
}

//設定頁面展示的最大高寬
$getw = trim($_GET['w']);
if(!is_numeric($getw)||$getw==0){
    $getu = destr($_GET['u']);
    if(is_numeric($getu)){
        $sqlse = "SELECT seewidth FROM u11aa WHERE id=$getu LIMIT 1";
        $resse=sqlGetOne($conn,$sqlse);
        $getw = $resse['seewidth'];
    }else{
        $getw = 960;
    }
}
$setextCss = "<style type='text/css'>.t-cont { max-width: {$getw}px !important;} .m-foot{max-width: {$getw}px !important;}</style>";

$ssql = "SELECT id, unum, ucode, uname, upwd, wximg, wxnum, cname, tel, addr, ps, level_id, role_id, bond_id, sort, sessid, isnow, aduser_id, upuser_id, adtime, uptime FROM u11 WHERE id=$id LIMIT 1";
$result = sqlGetOne($conn, $ssql);

/**
 * 生成HTML頁面
 */

//生成標籤HTML
$tags = se_tags_textSql($conn,"SELECT CONCAT(b.tag,a.unum,a.cname) AS news FROM u11 a LEFT JOIN u11level b ON a.level_id = b.id WHERE a.id={$result['id']} LIMIT 1");

//生成預覽HTML
$view =se_view_imgSql($result['wximg'],$conn,"SELECT img, tit, cont FROM u11img WHERE user_id = {$result['id']} ORDER BY sort ASC LIMIT 10");
$view .= '<hr>';
$view .= se_view_dl('編號ID',$result['id']);
$view .= se_view_dl('會員號',$result['unum']);
$view .= se_view_dl('會員密碼',$result['ucode']);
$view .= se_view_dl('登陸名',$result['uname']);
$view .= se_view_dl('登陸密碼',$result['upwd']);
$view .= se_view_dl('微信圖片',$result['wximg']);
$view .= se_view_dl('微訊號',$result['wxnum']);
$view .= se_view_dl('真實姓名',$result['cname']);
$view .= se_view_dlArr('電話號碼',$result['tel']);
$view .= se_view_dlArr('聯絡地址',$result['addr']);
$view .= se_view_dl('使用者備註',$result['ps']);
$view .= se_view_dlSql('使用者等級',$conn,"SELECT CONCAT(tag,' ', tit,' -&gt; ', cont) AS news FROM u11level WHERE id = {$result['level_id']} LIMIT 1");
$view .= se_view_dlSql('使用者許可權',$conn,"SELECT CONCAT(tit,' -&gt; ', cont) AS news FROM u11role WHERE id = {$result['role_id']} LIMIT 1");
$view .= se_view_dlSql('使用者關係',$conn,"SELECT CONCAT(tit,' -&gt; ', cont) AS news FROM u11bond WHERE id = {$result['bond_id']} LIMIT 1");
$view .= se_view_dl('排序',$result['sort']);
$view .= se_view_dl('生成連結','http://192.168.1.70/?i=HDU676750001onestopweb');
$view .= se_view_dlSql('新增使用者',$conn,"SELECT CONCAT(b.tag,a.unum,a.cname) AS news FROM u11 a LEFT JOIN u11level b ON a.level_id = b.id WHERE a.id={$result['aduser_id']} LIMIT 1");
$view .= se_view_dl('新增時間',$result['adtime']);
$view .= se_view_dlSql('修改使用者',$conn,"SELECT CONCAT(b.tag,a.unum,a.cname) AS news FROM u11 a LEFT JOIN u11level b ON a.level_id = b.id WHERE a.id={$result['upuser_id']} LIMIT 1");
$view .= se_view_dl('修改時間',$result['uptime']);

mysqli_close($conn);
include ROOT . '_php/temp/se.tpl.php';
?>

效果圖:

相關文章