2013-04-19 1 views
1

이상한 문제가 있습니다. 웹 페이지를 수정 중입니다. 내가이 줄을 포함하는 페이지를로드 한 후 사용자가 로그 아웃되는 경우, 문제가 나던, 웹 페이지에서 다른 곳을 클릭하면 일부 페이지에서 JQuery와는 Internet Explorer에서 다음 줄Internet Explorer + Jquery Load = 사용자 로그 아웃

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> 

와 함께로드됩니다 . 이 기능이 세션이 파괴

function logout() 
{ 
global $db; 
session_start(); 

/* Delete the user from table online */ 
mysql_query("DELETE FROM online WHERE user_id='$_SESSION[user_id]'"); 

/* Update the table last seen in table users */ 
$date_now = date("Y-m-d"); 
$time_now = date("H:i"); 
$date_last_seen = $date_now. ' '. $time_now; 

mysql_query("UPDATE users SET date_last_seen = '$date_last_seen' 
WHERE id='$_SESSION[user_id]'"); 

if(isset($_SESSION['user_id']) || isset($_COOKIE['user_id'])) { 
mysql_query("update `users` set `ckey`= '', `ctime`= '' 
where `id`='$_SESSION[user_id]' OR `id` = '$_COOKIE[user_id]'") or die(mysql_error()); 
}   

/************ Delete the sessions****************/ 
unset($_SESSION['user_id']); 
unset($_SESSION['user_name']); 
unset($_SESSION['user_level']); 
unset($_SESSION['HTTP_USER_AGENT']); 
session_unset(); 
session_destroy(); 

/* Delete the cookies*******************/ 
setcookie("user_id", '', time()-60*60*24*COOKIE_TIME_OUT, "/"); 
setcookie("user_name", '', time()-60*60*24*COOKIE_TIME_OUT, "/"); 
setcookie("user_key", '', time()-60*60*24*COOKIE_TIME_OUT, "/"); 

header("Location: index.php"); 
} 

는 사용자 세션이 데이터베이스에서 삭제되고 페이지가의 index.php로 리디렉션 (PHP 언어를 사용하는) 마지막에 실행되는 것을 실제로 보인다. 쿠키를 저장하기 위해 로그인 페이지에서 "내 계정 정보 기억"을 선택한 경우 페이지가 제대로 작동합니다. 내가 제대로 세션 쿠키를 저장하지만, 사용자가 다시 로그 아웃으로 아무것도 끝에 발생하지 상단

<?php 
session_set_cookie_params(1800); 
session_start(); 
?> 

에이 라인을 추가 jQuery를로드 2 개의 다른 페이지에서

.

jquery는 필요할 때만로드 할 수 있도록 2 페이지로만로드됩니다. 나는 일반 머리글에 넣으려고했지만 같은 문제가 발생합니다. jquery 줄을 제거했을 때 페이지는 물론 필요한 기능을 제외하고는 정상적으로 작동했습니다. 그래서 그것은 막 다른 길과 같습니다.

IE (IE 8 및 IE 10에서 테스트 됨)에서만 발생합니다. 다른 브라우저에서는 잘 작동

에서이이이 페이지

<script type="text/javascript" src="js/jquery.min.2012_09_29.js"></script> 
<script type="text/javascript" src="js/jquery.opacityrollover.js"></script> 
<script type="text/javascript" src="js/jquery.galleriffic.js"></script> 

<!-- Optionally include jquery.history.js for history support --> 
<script type="text/javascript" src="js/jquery.history.js"></script> 

<script type="text/javascript"> 
$(document).ready(function() { 
$('a#img_thumb').click(function() { 
    var del_name=$(this).attr('href'); 
    del_name=del_name.replace('#',''); 
    $('input[id="delete_image"]').attr('value',del_name); 
}); 
}); 
</scipt> 

그리고

<script type="text/javascript"> 
     jQuery(document).ready(function($) { 
      // We only want these styles applied when javascript is enabled 
      $('div.navigation').css({'width' : '96px', 'float' : 'right'}); 
      $('div.content').css('display', 'block'); 

      // Initially set opacity on thumbs and add 
      // additional styling for hover effect on thumbs 
      var onMouseOutOpacity = 0.80; 
      $('#thumbs ul.thumbs li, div.navigation a.pageLink').opacityrollover({ 
       mouseOutOpacity: onMouseOutOpacity, 
       mouseOverOpacity: 1.0, 
       fadeSpeed:   'fast', 
       exemptionSelector: '.selected' 
      }); 

      // Initialize Advanced Galleriffic Gallery 
      var gallery = $('#thumbs').galleriffic({ 
       delay:      1000, 
       numThumbs:     10, 
       preloadAhead:    10, 
       enableTopPager:   false, 
       enableBottomPager:   false, 
       imageContainerSel:   '#slideshow', 
       controlsContainerSel:  '#controls', 
       captionContainerSel:  '#caption', 
       loadingContainerSel:  '#loading', 
       renderSSControls:   true, 
       renderNavControls:   true, 
       playLinkText:    'Play Slideshow', 
       pauseLinkText:    'Pause Slideshow', 
       prevLinkText:    '&lsaquo; Previous Photo', 
       nextLinkText:    'Next Photo &rsaquo;', 
       nextPageLinkText:   'Next &rsaquo;', 
       prevPageLinkText:   '&lsaquo; Prev', 
       enableHistory:    true, 
       autoStart:     false, 
       syncTransitions:   true, 
       defaultTransitionDuration: 200, 
       onSlideChange:    function(prevIndex, nextIndex) { 
        // 'this' refers to the gallery, which is an extension of $('#thumbs') 
        this.find('ul.thumbs').children() 
         .eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end() 
         .eq(nextIndex).fadeTo('fast', 1.0); 

        // Update the photo index display 
        this.$captionContainer.find('div.photo-index') 
         .html('Photo '+ (nextIndex+1) +' of '+ this.data.length); 
       }, 
       onPageTransitionOut:  function(callback) { 
        this.fadeTo('fast', 0.0, callback); 
       }, 
       onPageTransitionIn:  function() { 
        var prevPageLink = this.find('a.prev').css('visibility', 'hidden'); 
        var nextPageLink = this.find('a.next').css('visibility', 'hidden'); 

        // Show appropriate next/prev page links 
        if (this.displayedPage > 0) 
         prevPageLink.css('visibility', 'visible'); 

        var lastPage = this.getNumPages() - 1; 
        if (this.displayedPage < lastPage) 
         nextPageLink.css('visibility', 'visible'); 

        this.fadeTo('fast', 1.0); 
       } 
      }); 

      /**************** Event handlers for custom next/prev page links **********************/ 

      gallery.find('a.prev').click(function(e) { 
       gallery.previousPage(); 
       e.preventDefault(); 
      }); 

      gallery.find('a.next').click(function(e) { 
       gallery.nextPage(); 
       e.preventDefault(); 
      }); 

      /****************************************************************************************/ 

      /**** Functions to support integration of galleriffic with the jquery.history plugin ****/ 

      // PageLoad function 
      // This function is called when: 
      // 1. after calling $.historyInit(); 
      // 2. after calling $.historyLoad(); 
      // 3. after pushing "Go Back" button of a browser 
      function pageload(hash) { 
       // alert("pageload: " + hash); 
       // hash doesn't contain the first # character. 
       if(hash) { 
        $.galleriffic.gotoImage(hash); 
       } else { 
        gallery.gotoIndex(0); 
       } 
      } 

      // Initialize history plugin. 
      // The callback is called at once by present location.hash. 
      $.historyInit(pageload, "advanced.html"); 

      // set onlick event for buttons using the jQuery 1.3 live method 
      $("a[rel='history']").live('click', function(e) { 
       if (e.button != 0) return true; 

       var hash = this.href; 
       hash = hash.replace(/^.*#/, ''); 

       // moves to a new page. 
       // pageload is called at once. 
       // hash don't contain "#", "?" 
       $.historyLoad(hash); 

       return false; 
      }); 

      /****************************************************************************************/ 
     }); 
    </script> 

중 하나에서 실행되도록 가정되는 jQuery 코드이다 gallerrific JQuery와 플러그인

아이디어가 있으십니까? 감사합니다.

+0

아마 관련이 없지만 스크립트 포함 경로에서 http를 놓친 것 같습니다. –

+0

@Oshawott는 중요하지 않습니다.이 구문은 요청 프로토콜을 불가 지론으로 만듭니다. – moonwave99

+1

"해결됨"이라고 말하는 대신 대답을 승인 된 것으로 표시하거나 자신의 답변을 작성하여 수락하십시오. – Antony

답변

1

문제는 welcome.php 페이지에있었습니다 (이 양식은 welcome.php? p = new_page1 welcome.php? p = new_page2 등으로로드됩니다). 문제는 welcome.php 코드에서 사용자를 로그 아웃하는 잊어 버린 endsession() 스크립트입니다. 내가 jquery 디버그를 사용하고 마지막으로 스크립트를 삭제 찾았습니다. @ KLK1에 대한 힌트를 주셔서 감사합니다 .-)

+0

그래서 문제는 Internet Explorer와 관련이 없었습니까? 탐색기에서만 작동하지 않는다는 의미는 아닙니다. –

0

JS 코드를 게시 할 수 있습니까? 이 문제를 일으키는 IE에서 JQuery의 이벤트 연결 이벤트에 관한 것입니다.

js : .on("click", function(){...})에 이와 비슷한 항목이 있습니까?

+0

나는 질문을 업데이 트했습니다. 당신은 확인할 수 있습니다. – Stathis

+0

JQuery의 이벤트 바인딩을 디버깅하는 방법을 알았습니다. 3 일 전, 파이어 폭스와 같은 유형의 문제가있었습니다. jQuery 이벤트를 디버깅하는 방법에 대한 많은 주제가 있습니다. 확실하지 않습니다. 단지 아이디어 일뿐입니다. – KLK1

+0

당신이 옳았습니다.디버그를 사용하고 문제를 발견했습니다. 환영 페이지에서 잊혀진 종료 세션 함수였습니다. 나보다 먼저 다른 누군가가 그걸 거기 놓는다. 이유가 없어. 어쨌든 당신의 지원에 대해 대단히 감사합니다. – Stathis