Professional Web Applications Themes

If statements in PHP? - Dreamweaver AppDev

How do i get something to show only if the user is logged in? For example, "log out" should only show if the user is logged in and "log in" should only show if the user is not logged in. How would i do this in PHP? Thanks for you help!...

  1. #1

    Default If statements in PHP?

    How do i get something to show only if the user is logged in? For example, "log
    out" should only show if the user is logged in and "log in" should only show if
    the user is not logged in. How would i do this in PHP? Thanks for you help!

    barbedwire103 Guest

  2. #2

    Default Re: If statements in PHP?

    barbedwire103 wrote:
    > How do i get something to show only if the user is logged in? For example, "log
    > out" should only show if the user is logged in and "log in" should only show if
    > the user is not logged in. How would i do this in PHP? Thanks for you help!
    Logging in and out is normally controlled by session variables. So, if
    you have a session variable called 'username', you would handle it like
    this:

    if (isset($_SESSION['username'])) {
    // code for logging out
    }
    else {
    // code for logging in
    }

    If you are using the DW User Authentication server behavior, you should
    be aware that it breaks in modern versions of PHP. See the following
    explanation (you need read only the first post):

    [url]http://friendsofed.infopop.net/2/OpenTopic?a=tpc&s=989094322&f=8033053165&m=3241024 21&r=324102421#324102421[/url]

    --
    David Powers
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    Co-author "PHP Web Development with DW MX 2004" (Apress)
    [url]http://computerbookshelf.com[/url]
    David Powers Guest

Similar Threads

  1. If Statements????
    By ccarterca in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: October 17th, 12:34 PM
  2. 2 sql statements in one <cfquery>
    By Kiriran in forum Coldfusion Database Access
    Replies: 12
    Last Post: May 13th, 04:07 PM
  3. Include statements
    By The Voivod in forum PHP Development
    Replies: 1
    Last Post: August 5th, 06:40 AM
  4. echo statements
    By Jay Fitzgerald in forum PHP Development
    Replies: 2
    Last Post: July 19th, 12:36 AM
  5. If/else statements - help.
    By Chris in forum PHP Development
    Replies: 1
    Last Post: June 28th, 01:55 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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139