stop displaying form elements after authentication
Results 1 to 4 of 4

Thread: stop displaying form elements after authentication

  1. #1
    Member
    Join Date
    Apr 2004
    Posts
    49

    stop displaying form elements after authentication

    How i can stop form elements to display after authenticating.

    Code:
    <FORM METHOD="get" ACTION="<?php echo $PHP_SELF ?>">
    enter username<input name="user" type="text"><br><br>
    enter password<input name="pass" type="text"/><br><br>
    <input type="submit" value="signin">
    <input type="hidden" name="abc" value="abc">
    </form>
    e.g
    I display this form, after submitting, the same page is displayed, but now form elements should not be displayed how i can manage this.

  2. #2
    Custom User
    Join Date
    Oct 2001
    Posts
    503
    You're using php, aren't you (I saw "php" somewhere in your code, I know I did!). Why don't you write a php page that takes an argument when it's loading. Say the page is called form.php, if you open form.php, it will show you the form, but if you open form.php?done=1 or something like that (I'm not exactly sure how php works, and how you would do that) it will show you the page without the form.

    You would do this by having an if statement in form.php that displays the form if done is not 1 and displays the page without the form if done is 1.

    I believe something like that should work, but as I said, I'm no php monkey.

    ac

  3. #3
    Senior Member
    Join Date
    Aug 2001
    Posts
    251
    Well, I assume that you have some kind of authentication check for that username/password,
    so:
    PHP Code:
    if (!$user_is_authenticated) {
    ?&
    gt;
    &
    lt;form>
    &
    lt;/form>
    &
    lt;?
    } else {
    echo 
    "Hello $username!";

    I don't know if you use sessions, but they are really handy for such things, because then you don't have to log in to every page. and the session variables are accessible to each page, so if you wanted to keep the username/password in the session variables and then check them everytime or something (storing username/password combinations in plaintext is a dangerous practice, you'll probably want to hash them using md5() or something...)
    The owl of Minerva spreads its wings only with the falling of dusk. -Hegel

  4. #4
    Member
    Join Date
    Apr 2004
    Posts
    49
    Thanks I have done by checking by using of hidden element, in form
    Code:
    if($hidden==true)
    {
    }

Posting Permissions

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