예제 #1
0
파일: Functions.php 프로젝트: comdan66/bto
function PF_Limit($conn, $UserStatus, $LimitStatus, $LimitNumber)
{
    global $DBString;
    global $Config;
    $Config['ModifyStatus'] = false;
    @session_start();
    //管理者介面
    if (substr_count(REQUEST_URI, "/admin/") > 0) {
        //如果session不見改用cookie
        if (($_SESSION['status'] == '' || $_SESSION['userid'] == "") && $_COOKIE["sessionid"] != "") {
            PF_print(1);
            if ($conn == null) {
                $conn = PF_ConnString($DBString);
            }
            $sSQLCmd = "select * from adminuser where sessionid=" . PF_ReSqlCmd($_COOKIE["sessionid"], "S") . " limit 0,1";
            $row = PF_Get_rs($conn, $sSQLCmd);
            if (mysql_num_rows($row) > 0) {
                $rs = mysql_fetch_array($row);
                $_SESSION['userid'] = $rs["userid"];
                $_SESSION['useraccount'] = $rs["Account"];
                $_SESSION['status'] = $rs["status"];
                $_SESSION['userlimit'] = $rs["userlimit"];
            }
        }
        if ($_SESSION['status'] == "999") {
            $Config['ModifyStatus'] = true;
            return null;
        }
    }
    switch ($LimitStatus) {
        case "1":
            //'只限某些會員才可以使用
            if ($UserStatus != "ALL") {
                if ($UserStatus == "9") {
                    if (substr($_SESSION['status'], 0, 2) != "99") {
                        die(PF_LG("抱歉您的角色無法使用此功能!"));
                    }
                } else {
                    if (PF_SplitCompare($UserStatus, $_SESSION['status']) == false) {
                        die(PF_LG("抱歉您的角色無法使用此功能!"));
                    }
                }
            }
            if ($LimitNumber == "") {
                return null;
            }
            if (isset($_SESSION['userlimit'])) {
                $LimitNumbers = explode(";", $LimitNumber);
                foreach ($LimitNumbers as $k => $v) {
                    if (PF_SplitCompare($_SESSION['userlimit'], $v)) {
                        $Config['ModifyStatus'] = true;
                        return null;
                    }
                }
            }
            if ($Config['ModifyStatus'] == false) {
                die(PF_LG("抱歉您的角色無法使用此功能!"));
            }
            break;
        case "0":
            //一定要會員才可以使用
            if (substr_count(REQUEST_URI, "/admin/") > 0) {
                if (substr($_SESSION['status'], 0, 1) != '9') {
                    PF_Script("alert('" . PF_LG("抱歉,請先登入") . "!');location.href='adminlogin.php'");
                    exit;
                }
            } else {
                if (PF_SplitCompare("0,1,2,3,4", substr($_SESSION['status'], 0, 1)) == false) {
                    PJ_HTMLHead();
                    PF_Script("alert('" . PF_LG("抱歉,請先登入") . "!')");
                    if ($Redirect == '') {
                        $Redirect = $_SERVER['REQUEST_URI'];
                    }
                    ?>
<form name="oForm"  method="post" language="javascript" action="<?php 
                    echo FC_WebUrl;
                    ?>
member_login.php">
<?php 
                    $cc = "";
                    $keyarray = "";
                    foreach ($_POST as $_key => $_value) {
                        if (PF_SplitCompare($keyarray, $_key) == false && $_key != 'email') {
                            if (is_array($_value)) {
                                ?>
<input type="hidden" name="<?php 
                                echo $_key;
                                ?>
" value="<?php 
                                echo implode(",", $_value);
                                ?>
">              
<?php 
                            } else {
                                ?>
	<input type="hidden" name="<?php 
                                echo $_key;
                                ?>
" value="<?php 
                                echo $_value;
                                ?>
">              
<?php 
                            }
                            $keyarray = $cc . $_key;
                            $cc = ",";
                        }
                    }
                    //exit();
                    ?>
	<input name="Redirect"  type="hidden" value="<?php 
                    echo htmlspecialchars($Redirect);
                    ?>
">
		<input type="submit" style="display:none"> 	
</form>

<SCRIPT language=JavaScript>
document.forms["oForm"].submit();
</SCRIPT>

<?php 
                    exit;
                }
            }
            //檢查是否有重覆登入
            if ($_SESSION['memberid'] != '') {
                $filename = FC_VirtualFolder . "images/temp/" . $_SESSION['memberid'];
                if (file_exists($filename)) {
                    $handle = fopen($filename, "rb");
                    $contents = "";
                    while (!feof($handle)) {
                        $contents .= fread($handle, 8192);
                    }
                    fclose($handle);
                    if ($_SESSION['sessionid'] != $contents) {
                        $_SESSION['memberid'] = "";
                        PF_Script("alert('" . PF_LG("此帳號已經有其他人在使用,請重新登入") . "');location.href='" . FC_WebUrl . "'");
                        exit;
                    }
                }
            }
            if ($UserStatus != "ALL") {
                if (PF_SplitCompare($UserStatus, $_SESSION['status']) == false) {
                    die(PF_LG("抱歉您的角色無法使用此功能!"));
                }
            }
            break;
        default:
            //'不是會員也可以使用
            break;
    }
}
예제 #2
0
파일: aacd.php 프로젝트: comdan66/bto
<?php

include_once 'include/STANDARD.php';
PF_GETRequest();
$conn = PF_ConnString($DBString);
$XmlDoc = PF_LoadXmlDoc("Setup.xml");
$PAGE_NAME = "產品檢測報告查詢系統";
$Config['FC_WebTitle'] = $PAGE_NAME . " | " . $Config['FC_WebTitle'];
PJ_HTMLHead();
?>
<script language=JavaScript>

 jQuery(document).ready(function () {
 	 
		    $('input:first').focus(); 
		    $('input').keyup(function(){
		        var inputs = $('input'); //先取得所有input元素
		        var maxlen = $(this).attr('maxlength');   //取得目前元素的maxlength
		        if( $(this).val().length == maxlen ){ //當滿足maxlength時...
		            inputs.eq( inputs.index($(this))+ 1 ).focus(); 
		        }
		    });
    
});

</script>


  <link href="css/aacd.css" rel="stylesheet" type="text/css" />
  </head>