2015-10-10 89 views
0

我正在運行一個代碼,該代碼應該從數據庫抽取調查問卷供用戶進行有效會話評估。運行以下PHP代碼時,頁面返回空白(503)

但是,該頁面在運行此php代碼時返回空白不完整頁面。

我在這裏錯過了什麼嗎?


<?php 
    session_start(); 

    try 
    { 
     if(!isset($_SESSION['logged-in'])) 
     { 
      header("Location: ../index.php"); 
     } 
    } 
    catch(Exception $e) 

    { 

    } 


    // php classes 
    require_once("../classes/database.php"); 
    require_once("../classes/questionnaire.php"); 
    require_once("../classes/competency.php"); 
    require_once("../classes/candidate.php"); 
    require_once("../classes/participant.php"); 
    require_once("../classes/progress.php"); 
    require_once("../classes/user.php"); 
    require_once("../classes/page.php"); 


    // candidate details 
    if($_SESSION['usertype'] == 'candidate') // if user is doing a self evaluation 
    { 
     $candidatename = User::getName($_SESSION['id']); 
     $candidateusername = $_SESSION['username']; 

     // questionnaire object 
     $q = new Questionnaire(Questionnaire::getQuestionnaireName($_SESSION['id'])); 

    } 

    else if($_SESSION['usertype'] == 'participant') // if user is evaluating their candidate 
    { 
     $candidatename = User::getName(Participant::getCandidateID(NULL, $_SESSION['id'])); 
     $candidateusername = Participant::getCandidate($_SESSION['id']); 

     // questionnaire object 
     $q = new Questionnaire(Questionnaire::getQuestionnaireName(Participant::getCandidateID(NULL, $_SESSION['id']))); 

    } 


    $candidateID = User::getUID($candidateusername); 

    // objects 
    $page = new Page('evaluation'); 

    $user = new User($_SESSION['username']); 

    // page height 

    $pagename = $page->name; 
    $page->setHeight(0, true, $q->numCompetencies()); 


?> 

這是HTML必須是輸出

<!-- CSS --> 
    <link rel="stylesheet" type="text/css" href="../css/screen.css" media="screen" /> 
    <link rel="stylesheet" type="text/css" href="../css/ie.css" /> 
    <link rel="stylesheet" type="text/css" href="../css/custom.css" /> 
    <link rel="stylesheet" type="text/css" href="../css/evaluation.css" /> 
    <link rel="stylesheet" type="text/css" href="../css/progress-bar.css" /> 
    <link rel="stylesheet" type="text/css" href="../css/error.css" /> 

    <!-- JAVASCRIPT --> 
    <script type="text/javascript" language="javascript" src="../js/slide/help.js"></script> 
    <script type="text/javascript" language="javascript" src="../js/jquery-1.7.1.min.js"></script> 
    <script type="text/javascript" language="javascript" src="../js/slide/evaluation.js"></script> 
    <script type="text/javascript" language="javascript" src="../js/slide/questionnaire.js"></script> 
    <script type="text/javascript" language="javascript" src="../js/validation/validateevaluation.js"></script> 
    <script type="text/javascript" language="javascript" src="../js/instructions.js"></script> 

</head> 

<body onload="viewCompetency('#st1')"> 
    <!-- WEBSITE --> 
    <!-- BANNER --> 
    <div class="banner"> 
     <div class="container"> 
      <!-- logo div --> 
      <div class="span-5 logo"></div> 
      <!-- menu div --> 
      <!-- main menu --> 


     </div> 
    </div> 
    <div class="topseparator"></div> 



    <!-- PAGE CONTENT --> 
    <div class="container indexdesktop"> 

     <?php include("../common/minidashboard.php"); ?> 

     <!-- desktop content --> 
     <div class="span-24" style="height: <?php print $page->height.'px'; ?>"> 

      <!-- CONTENT MODULEBOX --> 
      <div class="modulebox-classy"> 

       <div class="pageheading"><h3><span class="blue">REDMA 360 </span><span class="grey">EVALUATION</span></h3></div> 

       <div class="contentwide"> 
        <div class="iconswide" id="addcand"></div> 


        <p>Kindly give very candid feedback to the person whose name appears below (candidate)</p> 


        <!-- INSTRUCTIONS --> 
        <p>&nbsp;</p> 
        <div class="instructions" id="instructionswidth-evaluation"> 
         <div class="instructions-heading" onclick="showInstructions()"><div class="instructions-icon"></div>INSTRUCTIONS</div> 
         <div class="instructions-content" id="instructions-content"> 
         <p>Click the <span class="italic">Accordian Menu</span> to show the competency you want to evaluate. Give a rating on the drop-down select box according to the <span class="italic">Scoring Key</span> below. When you have completed scoring <span class="italic">ALL</span> competencies in the <span class="italic">Questionnaire</span>, a <span class="strong italic">Done</span> button will show. Click <span class="strong italic">Done</span> to complete your evaluation.</p> 
         <p><h5 class="strong white">SCORING KEY:</h5><ol><li>Demonstrates <span class="strong italic">almost none</span> of the behaviour</li><li>Demonstrates <span class="strong italic">some</span> of the behaviour</li><li>Demonstrates <span class="strong italic">about half</span> of the behaviour</li><li>Demonstrates <span class="strong italic">majority</span> of the behaviour</li><li>Demonstrates the behaviour <span class="strong italic">fully</span></li></ol></p> </div> 
        </div> 
       </div> 




       <div class="contentwide" id="evaluationwidth"> 

       <!-- Display Questionnaire --> 
       <h3>Welcome to Redma360 Evaluation</h3> 
       <h4 class="grey"><span class="blue">QUESTIONNAIRE:</span> <?php print Questionnaire::getQuestionnaireName($user->username);?><br />        
       <?php 

        print '<span class="blue">CANDIDATE:</span> '.strtoupper($candidatename); 

        if($user->usertype == 'participant') // if user is evaluating their candidate 
        { 
         print '<br /><span class="blue">PARTICIPANT ('.Participant::getPartType($user->username).'):</span> '.strtoupper($user->name); 
        } 
       ?> 
       </h4> 

       <!-- Evaluation Accordian -->  
       <div class="evaluation-container"> 
        <form action="evaluationaction.php" name="saveForm" id="saveForm" method="post" > 
         <?php $competenciesEvaluatedArr = Questionnaire::displayEvaluationCompetencies($q->getName(), User::getUID($candidateusername), $user->id); ?> 
         <input type="hidden" name="saveButton" id="saveButton" /> 
        </form> 
       </div> 
       <?php 
        if($user->competenciesdone == $q->numCompetencies()) 
        { 
       ?> 
       <div class="evaluationthankyou" id="evaluationthankyou">Thank you!</div> 
       <div class="evaluationsubmitbutton" id="evaluationsubmitbutton"> 
        <form action="evaluationdone.php" name="doneForm" method="post" > 
         <input type="image" name="doneButton" src="../images/button-done-large.png" /> 
        </form> 
       </div> 
       <?php 
        } 
       ?> 
      </div>  


      <!-- progress bar --> 
     <div class="sidebar-progress" id="sideprogress-evaluation"> 
      <div class="content" id="progress"> 

       <!-- sidebar heading --> 
       <div class="sidebar-subheading-color-blue" id="evaluation-sidebar-heading">See the progress and number of competencies answered so far below. </div> 

       <!-- progress bar --> 
       <div class="content"> 
        <?php Progress::getProgressBar(User::getNumGraded(User::getUID($_SESSION['username'])), Questionnaire::getNumCompetencies($q->getID())); ?> 
        <p>&nbsp;</p> 
       </div> 

       <div class="modulebox-display"> 

        <h4>Competencies Answered So Far</h4> 

        <table class="competenciesevaluated"> 
         <thead> 
          <tr> 
           <th>Competency</th> 
          </tr> 
         </thead> 
         <tbody> 
          <?php 
           foreach($competenciesEvaluatedArr as $arr) 
           { 
            print '<tr> 
               <td>'.$arr.'</td> 
              </tr>'; 
           } 
          ?> 
         </tbody> 
        </table> 

       </div> 

      </div> 
     </div> 
     </div> 



     </div> 



    </div> 

    <!-- FOOTER --> 
    <?php include("../common/footer.php"); ?> 
</body> 

+0

標題( 「位置:../index.php」)嘗試更換:標題( 「地點:的index.php」),甚至更好的提供完整的地址是http的index.php –

回答

0

添加退出(0),之後的頭部(.... ),它可以解決你的問題。

try 
    { 
     if(!isset($_SESSION['logged-in'])) 
     { 
      header("Location: ../index.php"); 
      exit(0);//Add this line 
     } 
    } 
    catch(Exception $e) 

    { 

    } 
+0

的insted的謝謝,沒有解決它。 – Felix

+0

@Felix如果你解決了你的問題,你能接受解決方案嗎?如果有人遇到同樣的問題,他們很容易解決。 –

0

原來我在包含的questionnaire.php文件中缺少一個類。 把錯誤報告給我的PHP文件是非常有用的。

感謝