Search Results

Search found 4 results on 1 pages for 'user280381'.

Page 1/1 | 1 

  • Prevent redirect loop in mod_rewrite

    - by user280381
    I'm writing a rule in my htaccess that basically says this: If the request is for the homepage And a cookie has not been set Rewrite the page with /addCookie.php Then in addCookie.php, we set the cookie and redirect back to the homepage. This is all fine, but if the user doesn't accept cookies, we get an infinite loop of redirects. I'm new to mod_rewrite, I've done a lot of searching, but can't break the loop. I have this so far: RewriteCond %{ENV:REDIRECT_STATUS} 200 RewriteRule .* - [S=1] RewriteCond %{REQUEST_URI} "^/$" RewriteCond %{HTTP_COOKIE} !device_detected RewriteRule ^ addCookie.php [L] Is what I'm trying to do possible? I could add a query string on the redirect from addCookie.php, but I'd much rather keep the requests identical. Any suggestions kindly welcome.

    Read the article

  • mysql boolean joins

    - by user280381
    I want to use a JOIN to return a boolean result. Here's an example of the data... t1 id | data | 1 | abcd | 2 | 2425 | 3 | xyz | t2 id | data | t1_id | 1 | 75 | 2 | 2 | 79 | 2 | 3 | 45 | 3 | So with these two tables I want to select all the data from t1, and also whether a given variable appears in t2.data for each id. So say the variable is 79, the results should be id | data | t2_boolean 1 | abcd | 0 2 | abcd | 1 3 | xyz | 0 So I'm thinking some sort of join is needed, but without a WHERE clause. I've been banging my head about this one. Is it possible? I really need it inside the same statement as I want to sort results by the boolean field. As the boolean needs to be a field, can I put a join inside of a field? Thanks...

    Read the article

  • Switch two items in associative array PHP

    - by user280381
    Example: $arr = array('apple'='sweet','grapefruit'='bitter','pear'='tasty','banana'='yellow'); I want to switch the positions of grapefruit and pear, so the array will become 'apple'='sweet','pear'='tasty','grapefruit'='bitter','banana'='yellow') I know the keys and values of the elements I want to switch, is there an easy way to do this? Or will it require a loop + creating a new array? Thanks

    Read the article

  • jquery: How can I trigger click() without editing the element state?

    - by user280381
    I need to trigger a click function assigned to a checkbox, but without actually changing it's checked state (which click() does). Scenario: I have a form with several checkboxes that when selected reveal a textarea. This works fine, but I also need to call the click() function on $(document).ready() My code is below, please note I have very limited access to changing the generated html. I have an object (admin_panels) which will store each checkbox and the texarea it should bring up. var admin_panels = {"checkbox-id" : "textarea-id"}; $(document).ready(function(){ for (var elem in admin_panels) { $("#" + elem).click(admin_slide); // $("#" + elem).click(); } }) function admin_slide() { if ($(this).is(":checked")) { $("#" + admin_panels[this.id] + "-wrapper").slideDown(); }else{ $("#" + admin_panels[this.id] + "-wrapper").slideUp(); } } Thanks

    Read the article

1