Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End PHP Session

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #156960
    Junni
    Participant

    is there any way to send PHP session to a URL??

    such as if

    <form action="http://index.rathorint.com/" method="post">
    <input type="text" name="name">
    <button type="submit" name="submit">
    

    os is there any way to start a session in another url, which is already running on page, such as i want to send PHP session to lottery.rathorint.com from index.rathorint.com

    #156965
    __
    Participant

    Yes, though there are drawbacks for security (session hijacking is much easier) and usability (session id’s get stuck in history/bookmarks/search engines, breaking your session state).

    #156969
    Junni
    Participant

    then what is the proper way to handle it, i am working on a site and i want to send same session to the next url, such as

    session is running on index.rathorint.com and i want to send it to lottery.rathorint.com , is that possible in good manner , avoiding hacking

    #157003
    __
    Participant

    If the two domains share a common parent (that you control), then you can configure the session cookie to apply to all your subdomains:

    <?php
    
    // these are simply the default values;
    // we have to include them in order to set the $domain argument
    $ttl = 0;
    $path = '/';
    
    // note the leading dot (.) in the domain
    $domain = ".rathorint.com";
    
    session_set_cookie_params( $ttl,$path,$domain );
    session_start();
    
    #157219
    ugnelakys
    Participant

    Hi

    try $_COOKIES as well.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Back End’ is closed to new topics and replies.