If statements in PHP?

Ask a Question related to Dreamweaver AppDev, Design and Development.

  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. Similar Questions and Discussions

    1. If Statements????
      guys i was wondering if anybody here could help me. I have a page done up with all dynamic text and attributes on it that come from a management...
    2. 2 sql statements in one <cfquery>
      hi. is it possible to do something like this? <cfquery datasource="chDev" name="test"> SELECT * FROM test WHERE id = #url.id# INSERT INTO test...
    3. conditional sql statements
      I have a shopping cart that I want to load items in that come from a huge scrolling form. In other words, when someone clicks on a category in our...
    4. Include statements
      I am currently using a perl script to process form data. I don't want to lose the functionality I have with this script but need to output the data...
    5. If/else statements - help.
      Sorry to post so much code all at once but I'm banging my head against the wall trying to get this to work! Does anyone have any idea where I'm...
  3. #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

Posting Permissions

  • You may not post new threads
  • You may 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