Note that there are some explanatory texts on larger screens.

plurals
  1. POInternet Explorer + Jquery Load = Logout user
    primarykey
    data
    text
    <p>I have a strange problem. I am fixing a web page. In some pages jquery is loaded with the following line</p> <pre><code>&lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt; </code></pre> <p>In Internet explorer, if I load a page that contains this line and then click somewhere else in the web page, it doesnt matter where, the user is logged out. It seems actually that this function is executed at last (PHP language is used)</p> <pre><code>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"); } </code></pre> <p>The session is destroyed, the user session is deleted from the database and the page is redirected to the index.php. If in the login page is selected "Remember me" in order to save a cookie then the page works properly. </p> <p>In the 2 different pages that I load jquery I added this line on the top</p> <pre><code>&lt;?php session_set_cookie_params(1800); session_start(); ?&gt; </code></pre> <p>It saves the session cookie correctly but nothing happens at the end as the user is again logged out.</p> <p>The jquery is loaded only in 2 pages to load when it is only needed. I tried to put it on the general header but the same problem takes place. When i removed the jquery line the page worked normal except of course the functions that needed it. So it's like a dead end.</p> <p>I remind this happens only on IE (tested on IE 8 and IE 10). In the other browsers it works fine</p> <p>This is the jquery code that it is supposed to be executed in one of the pages</p> <pre><code>&lt;script type="text/javascript" src="js/jquery.min.2012_09_29.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/jquery.opacityrollover.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/jquery.galleriffic.js"&gt;&lt;/script&gt; &lt;!-- Optionally include jquery.history.js for history support --&gt; &lt;script type="text/javascript" src="js/jquery.history.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(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); }); }); &lt;/scipt&gt; </code></pre> <p>And</p> <pre><code>&lt;script type="text/javascript"&gt; 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: '&amp;lsaquo; Previous Photo', nextLinkText: 'Next Photo &amp;rsaquo;', nextPageLinkText: 'Next &amp;rsaquo;', prevPageLinkText: '&amp;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 &gt; 0) prevPageLink.css('visibility', 'visible'); var lastPage = this.getNumPages() - 1; if (this.displayedPage &lt; 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; }); /****************************************************************************************/ }); &lt;/script&gt; </code></pre> <p>This is gallerrific jquery plug in</p> <p>Any ideas? Thank you</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload