Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder darksecu's Avatar
    Join Date
    Dec 2011
    Location
    India
    Posts
    99
    Thanks
    11
    Thanked 1 Time in 1 Post

    placing php before a java redirect

    PHP Code:
    <script>
    <!--

    /*
    Count down then redirect script
    By JavaScript Kit (http://javascriptkit.com)
    Over 400+ free scripts here!
    */

    //change below target URL to your own
    var targetURL="*****.php?get=****8&&getid='.$id.'"
    //change the second to start counting down from
    var countdownfrom='.$clicktime.'


    var currentsecond=document.redirect.redirect2.value=countdownfrom+1
    function countredirect(){
    if (
    currentsecond!=1){
    currentsecond-=1
    document
    .redirect.redirect2.value=currentsecond
    }
    else{
    window.location=targetURL
    return
    }
    setTimeout("countredirect()",1000)
    }

    countredirect()
    //-->
    </script>'; 
    Before
    PHP Code:
    window.location=targetURL
    return 
    I Want to place $_SESSION['namestatus'] == 'name';
    how can i do it .. please help me ..
    Last edited by darksecu; 06-02-2012 at 06:26 AM. Reason: Solved

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,396
    Thanks
    12
    Thanked 569 Times in 562 Posts
    The question is: Why would you want to do that?

    It seems like you want to set a PHP SESSION variable "shortly before" you leave the current page. This is not possible. All the PHP code has long been executed before any Javascript code will start to execute.

    So if you want to set this SESSION variable at exactly this moment, you'd have to do it either in the page you redirect to or via an Ajax request ... and then only redirect after the Ajax request has finished.

  • #3
    New Coder darksecu's Avatar
    Join Date
    Dec 2011
    Location
    India
    Posts
    99
    Thanks
    11
    Thanked 1 Time in 1 Post
    never tried ajax, can you give me some codes which shows countdown and after countdown is to 0 it set $_SESSION and redirect to link we set there...

    or

    when countdown ends it shows users captcha , when users type correct words it set $_SESSION and redirect...

  • #4
    New Coder darksecu's Avatar
    Join Date
    Dec 2011
    Location
    India
    Posts
    99
    Thanks
    11
    Thanked 1 Time in 1 Post
    Placed a count down auto submit form with some hidden get values, using those get values as security token on next page ...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •