A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: How to make a FORM (html) apparead in a PHP file than requeired be log-in to be shown

  1. #1
    Registered User
    Join Date
    May 2014
    Posts
    1

    How to make a FORM (html) apparead in a PHP file than requeired be log-in to be shown

    The question is simple

    But I'm kinda a newbie so I'm gonna try to tell what's the problem and why i ask this

    I'm doing a login system than, for different users showing different services, and until the moment all the login process has successfully ended just fine and works perfectly, BUT:

    some of this services (i.e. File uploading) i wanna add include the use of a form, the forms are HTML, and the "session_start()" are PHP like all of you must know, so this is the question.

    (already try with echo/print, btw)

    Is there any way to add a form (html based) inside a PHP script to actually works depending of if it's working or not the session_start()?

    With the "Session_start()" i mean if he is or not log-in Have in mind that the service is gonna be used by the person who login

    Here is the code

    PHP Code:
    <?php
    session_start
    ();
    echo 
    $_SESSION['username'];
    echo 
    $_SESSION['name'];
    echo 
    $_SESSION['test'];
    if (
    $_SESSION['class'] === 7){
    print 
    '<html><form action="upload.php" method="post" enctype="multipart/form-data"><br /><input type="file" name="info" /><br /><br /><input type="submit" value="Subir" /></form></html>';
    } elseif (
    $_SESSION['class'] === or 2) {
    echo 
    "también esto se muestra";
    } elseif (
    $_SESSION['class'] === 7) {
    echo 
    "esto también";
    } elseif (
    $_SESSION['class'] === 7) {
    echo 
    "esto también";
    }


    Thanks in advance

    PS: Any suggestion to improve the question, or question you have for clarification would be greatly appreciated too, just say it.

  2. #2
    Junior Member
    Join Date
    Oct 2008
    Posts
    13
    in your login script just add
    PHP Code:
    <?php
     $_SESSION
    ['login'] = true;
    then
    PHP Code:
    if ($_SESSION['login'] == true){
    echo 
    '<html><form action="upload.php" method="post" enctype="multipart/form-data"><br /><input type="file" name="info" /><br /><br /><input type="submit" value="Subir" /></form></html>';


Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center