php关闭连接没有工作

时间:2017-05-02 05:39:06

标签: php

我不是PHP开发人员。 但是我从一个独立开发者那里得到了这个网站但是当我使用它时,服务器告诉我你已经超出了你的可用连接。我写信给服务器支持,他们告诉我你必须在每个页面上关闭你的连接 据我所知,PHP并不需要像ASP,VB或C#那样关闭连接。但是我添加了连接关闭语句并没有解决问题。那么任何人都可以快速查看源代码并给我一个小小的提示。我将不胜感激。

    <?php  //header('Location:');

    require_once('include/session.php');
    require_once('include/connection.php');

    $title = 'title';
    echo '<meta charset=utf-8" />';


    // ============== Post user and pass =====================
    if(isset($_POST['submit'])){
        $user = mysqli_real_escape_string($connect, $_POST['uid']);
        $pass = mysqli_real_escape_string($connect, $_POST['pass']);
        $hashed_pass = sha1($pass);

    // ============== log in Validation =====================
        $valid = mysqli_query($connect, "SELECT uid, pass FROM users_tbl 
                    WHERE uid = '$user' AND pass ='$hashed_pass' LIMIT 1");
        $row = mysqli_num_rows($valid);
        if($row !=0 ) {
            //start the session()
            $getUidAndLevel = mysqli_query($connect, "SELECT uid, level  FROM users_tbl 
                    WHERE uid = '$user' AND pass ='$hashed_pass' LIMIT 1");
            $foundUser = mysqli_fetch_array($getUidAndLevel);
            $_SESSION ['uid'] = $foundUser['uid'];
            $level = $foundUser['level'];

            switch ($level){
                case '2':
                    header('Location: superAndUnitInd/superIndex.php');
                break;

                case '3':
                    header('Location: superAndUnitInd/unitHeadIndex.php');
                break;

                case '4':
                    header('Location: superAndUnitInd/coopSuperIndex.php');
                break;

                case '5':
                    header('Location: specialists/index.php');
                break;

                case '7':
                    header('Location: faqAndAnswers/showFAQ.php');
                break;

                case '8':
                    header('Location: depHead/index.php');
                break;

                case '9':
                    header('Location: minis/index.php');
                break;

                case '10':
                    header('Location: admin/index.php');
                break;

            }
            /*if($level == '2'){
                header('Location: superAndUnitInd/superIndex.php');
            }elseif($level == '3'){
                header('Location: superAndUnitInd/unitHeadIndex.php');
            }elseif($level == '4'){
                header('Location: superAndUnitInd/coopSuperIndex.php');
            }elseif($level == '5'){
                header('Location: specialists/index.php');
            }elseif($level == '7'){
                header('Location: faqAndAnswers/showFAQ.php');
            }elseif($level == '8'){
                header('Location: depHead/index.php');
            }elseif($level == '9'){
                header('Location: minis/index.php');
            }elseif($level == '10'){
                header('Location: admin/index.php');
            }*/
        }else{
            $err = '<p class="errMsg fontNaskh" style="width:100%">بيانات الدخول غير صحيحة !</p>';  
            goto a;

        }
    }

a:  
?>




<!DOCTYPE html>
<!--[if IE 6]>
<html id="ie6" class="ie"lang="en-US">
<![endif]-->
<!--[if IE 7]>
<html id="ie7"  class="ie"lang="en-US">
<![endif]-->
<!--[if IE 8]>
<html id="ie8"  class="ie"lang="en-US">
<![endif]-->
<!--[if IE 9]>
<html id="ie9"  class="ie"lang="en-US">
<![endif]-->
<!--[if gt IE 9]>
<html class="ie"lang="en-US">
<![endif]-->
<!--[if !IE]>
<html lang="en-US">
<![endif]-->

<!-- START HEAD -->
<head>
    <meta charset="UTF-8" />

    <!-- this line will appear only if the website is visited with an iPad -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.2, user-scalable=yes" />
    <title><?php if(isset($title)){echo $title;}else{echo 'البرنامج الإلكتروني للنماذج والأساليب الإشرافية للمشرف التربوي';} ?></title>

    <!--<link rel='stylesheet' id='responsive-css'  href='css/master.css' type='text/css'/>-->

    <style>
        set 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);color:#515742!important}
    </style>

</head>
<!-- END HEAD -->


<!-- START BODY -->
<body class="home page no_js responsive stretched" >

    <!--<div id="overlay"></div>-->

    <!--============== loader ============
    <div class="loader"></div>-->

    <!-- START WRAPPER -->




    <!--========= MOBILE ================-->
    <script type='text/javascript' src='js/jquery.tweetable.js'></script>
    <script type='text/javascript' src='js/responsive.js'></script>
    <script type='text/javascript' src='js/jquery.mobilemenu.js'></script>

    <!--<link rel='stylesheet' href='css/bootstrap.css' type='text/css'/>-->
</body>
<!-- END BODY -->
</html>

<?php mysqli_close($connect);?>

我很抱歉这个很长的源代码已被删除,但我删除了很多我认为你不会感兴趣的内容。再次,我不是PHP开发人员,我是VB,C#和ASP.NET开发人员。< / p>

0 个答案:

没有答案