> This was added in a separate file and included that file in all the files including index.php In index.php I registered a variable s_authed and initialised it to 0 ----------------------------- //index.php include "include.php"; session_register("s_authed"); $s_authed = 0; // initialize session flag ----------------------------->> And after sign up I am authenticating the user in a separate file and setting a flag s_authed to 1 ----------------------------- //auth.php if(check for authentication) { ........ $HTTP_SESSION_VARS['s_authed']=1; } ----------------------------->> Now in the main.php I am checking ----------------------------- //main.php if($s_authed==1) { //Display login form code goes here } else { display "authentication required"; } ----------------------------->> This is working fine. Even when I copy and paste the URL to another browser it is showing authentication required page. When I used if (!isset($_SESSION['sessionname'])) { //Display login form code goes here } in main.php it is not working. I mean that it display the page even when I copy and paste URL in a new browser window. Seems like an essay :) Why is it so. Is that my previous method was correct or any mistakes I did? -murugesan ----- Original Message ----- From: "Paul Fitzpatrick" To: Sent: Tuesday, August 26, 2003 10:43 PM Subject: RE: [PHP] Session problem in back button [quote] > > Hi, > > This will stop them seeing the login once they are in a registered > session > Only diplay the login form if NOT a registered session variable > 'sessionname' (or some other session variable) > > > If (!isset($_SESSION['sessionname'])) > { > //Display login form code goes here > } > > Cheers. > > > > > -----Original Message----- > From: murugesan [mailto:mukeshgct@hotmail.com] > Sent: Monday, August 25, 2003 9:55 AM > To: murugesan; Cody Phanekham; php-general@lists.php.net > Subject: [PHP] Session problem in back button > > Hello all, > Now i have a problem in back button. > After signing in when I click back button It goes to login page. > But > when I click the forward button it is going to the main page. > How can I prevent this. > > -murugesan > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >[/quote] [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => <001201c36bf5$59718fc0$6458fea9@BEAST> [htmlstate] => on_nl2br [postusername] => Murugesan [ip] => mukeshgct@hotma [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> [PHP] Session problem in back button - PHP Development

[PHP] Session problem in back button - PHP Development

Seems confusing. ------------------------- //include.php session_name("sessionname"); session_start(); -------------------------->> This was added in a separate file and included that file in all the files including index.php In index.php I registered a variable s_authed and initialised it to 0 ----------------------------- //index.php include "include.php"; session_register("s_authed"); $s_authed = 0; // initialize session flag ----------------------------->> And after sign up I am authenticating the user in a separate file and setting a flag s_authed to 1 ----------------------------- //auth.php if(check for authentication) { ........ $HTTP_SESSION_VARS['s_authed']=1; } ----------------------------->> Now in the main.php I am checking ----------------------------- //main.php if($s_authed==1) { //Display login form code goes here } else { display ...

  1. #1

    Default Re: [PHP] Session problem in back button

    Seems confusing.

    -------------------------
    //include.php
    session_name("sessionname");
    session_start();
    -------------------------->>
    This was added in a separate file and included that file in all the files
    including index.php
    In index.php I registered a variable s_authed and initialised it to 0

    -----------------------------
    //index.php
    include "include.php";
    session_register("s_authed");
    $s_authed = 0; // initialize session flag
    ----------------------------->>

    And after sign up I am authenticating the user in a separate file
    and setting a flag s_authed to 1
    -----------------------------
    //auth.php
    if(check for authentication)
    {
    ........
    $HTTP_SESSION_VARS['s_authed']=1;
    }
    ----------------------------->>
    Now in the main.php
    I am checking
    -----------------------------
    //main.php

    if($s_authed==1)
    {
    //Display login form code goes here
    }
    else
    {
    display "authentication required";
    }
    ----------------------------->>



    This is working fine. Even when I copy and paste the URL to another browser
    it is showing authentication required page.
    When I used

    if (!isset($_SESSION['sessionname']))
    {
    //Display login form code goes here
    }

    in main.php
    it is not working. I mean that it display the page even when I copy and
    paste URL in a new browser window.

    Seems like an essay :)
    Why is it so.
    Is that my previous method was correct or any mistakes I did?



    -murugesan






    ----- Original Message -----
    From: "Paul Fitzpatrick" <pfitzdodo.com.au>
    To: <php-generallists.php.net>
    Sent: Tuesday, August 26, 2003 10:43 PM
    Subject: RE: [PHP] Session problem in back button

    >
    > Hi,
    >
    > This will stop them seeing the login once they are in a registered
    > session
    > Only diplay the login form if NOT a registered session variable
    > 'sessionname' (or some other session variable)
    >
    >
    > If (!isset($_SESSION['sessionname']))
    > {
    > //Display login form code goes here
    > }
    >
    > Cheers.
    >
    >
    >
    >
    > -----Original Message-----
    > From: murugesan [mailto:mukeshgcthotmail.com]
    > Sent: Monday, August 25, 2003 9:55 AM
    > To: murugesan; Cody Phanekham; php-generallists.php.net
    > Subject: [PHP] Session problem in back button
    >
    > Hello all,
    > Now i have a problem in back button.
    > After signing in when I click back button It goes to login page.
    > But
    > when I click the forward button it is going to the main page.
    > How can I prevent this.
    >
    > -murugesan
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >
    >
    Murugesan Guest

  2. #2

    Default RE: [PHP] Session problem in back button


    Hi,

    This will stop them seeing the login once they are in a registered
    session
    Only diplay the login form if NOT a registered session variable
    'sessionname' (or some other session variable)


    If (!isset($_SESSION['sessionname']))
    {
    //Display login form code goes here
    }

    Cheers.




    -----Original Message-----
    From: murugesan [mailto:mukeshgcthotmail.com]
    Sent: Monday, August 25, 2003 9:55 AM
    To: murugesan; Cody Phanekham; [email]php-generallists.php.net[/email]
    Subject: [PHP] Session problem in back button

    Hello all,
    Now i have a problem in back button.
    After signing in when I click back button It goes to login page.
    But
    when I click the forward button it is going to the main page.
    How can I prevent this.

    -murugesan

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, visit: http://www.php.net/unsub.php
    Paul Fitzpatrick Guest

Similar Threads

  1. ASP and Back Button problem.
    By GW in forum Web Design
    Replies: 1
    Last Post: November 6th, 06:41 PM
  2. back button problem
    By Hypo in forum ASP.NET General
    Replies: 3
    Last Post: July 24th, 09:19 PM
  3. [PHP] back button and session variables
    By Matt Matijevich in forum PHP Development
    Replies: 0
    Last Post: July 17th, 06:36 PM
  4. back button and session variables
    By John Carpenter in forum PHP Development
    Replies: 0
    Last Post: July 17th, 03:03 PM
  5. Back button on the browser problem
    By shimonsim@talamus.com in forum ASP.NET General
    Replies: 3
    Last Post: June 29th, 12:26 PM

Bookmarks

Posting Permissions

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