资讯详情

PHP / Ajax:如何在$ _SESSION变量值上显示/隐藏DIV?

我在网上搜索了很多主题,讨论了会话变量以及如何通过Ajax从Javacript得到它们。但是,虽然我已经能够做到这一点,但这并不能完全解决我的问题。

目的

在线库存管理。

约束条件

只有通过身份验证的用户才能管理在线库存

未经身份验证的用户隐藏库存管理控件

各部分必须独立获得认证通知,以便相应地显示/隐藏其控制

代码样本

authenticate.php

project.js

index.php

atv.php

atv-inventory-list.php

sectionhandler.php

index.php

...

...

...

authenticate.php

require_once "data/data_access.php";

$userName = "";

$password = "";

if (isset($_REQUEST["userName"])) $userName = $_REQUEST["userName"];

if (isset($_REQUEST["password"])) $password = $_REQUEST["password"];

$isAuthentic = isAuthenticUser($userName, $password);

$_SESSION["isAuthentic"] = $isAuthentic;

echo $isAuthentic;

// I try to use the below-written function where ever I need to show/hide elements.

function isCurrentUserAuthenticated() {

return isset($_SESSION["isAuthentic"]) && $_SESSION["isAuthentic"];

}

?>

project.js

$(document).ready(function() {

$("#newAtvDialog").dialog({

autoOpen: false,

closeOnEscape: true,

modal: true,

width: 1000

});

$("#newAtvAjaxForm").ajaxForm(function(data) {

$("#newAtvDialog").dialog("close");

$("#section").load("sectionhandler.php?section=atv&type=-1&make=0&year=0&category=0", function(event) { $("button").button(); });

});

});

atv.php

Add New ATV

标签: smafj440atvs二极管smafj150atvs二极管

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

 锐单商城 - 一站式电子元器件采购平台  

 深圳锐单电子有限公司