Results 1 to 2 of 2

Thread: can someone help me please

  1. #1
    Join Date
    Sep 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default can someone help me please

    hello i'm trying to do a user system but i don't have a very good ideea what should i do from where should i start. i've started with the login form and the code for it . but on the way i've got some problems the code doesn't work can you help me please ?




    Code:
    <?php
    if($logged_in == 1) {
       echo 'lol';
    } else {
    ?>
    <div id="login">
    <div class="content">
    <form id="form1" method="POST" name="login" action="<? $_SERVER['PHP_SELF'] ?>">
    <fieldset>
    <legend>Sign-In</legend>
    <label for="inputtext1">Client ID:</label>
    <input  type="text" id= "username" name="username"/>
    <label for="inputtext2">Password:</label>
    <input  type="password" id="password" name="password" />
    <input  type="submit" name="login" value="Log In" />
    
    </fieldset>
    </form>
    </div>
    </div>
    <?php
    if (!isset($_SESSION['username']) || !isset($_SESSION['id'])) {
            $logged_in = 0;
            return;
        } else {
    
            if (!get_magic_quotes_gpc()) {
    
            $username = mysql_real_escape_string(stripslashes($_POST['username']));
            $password = mysql_real_escape_string(stripslashes(md5($_POST['password'])));
            }
            $sql = mysql_query("SELECT username, password FROM members WHERE username ='" .
                $username . "'") or die(tmp_mysql_error());
            if (mysql_numrows($sql) == 1) {
                $set = mysql_fetch_array($sql);
                if ($password == $set['password']) {
                    $_SESSION['username'] = $set['username'];
                    $_SESSION['id'] = $set['id'];
                    $_SESSION['usrlvl'] = $set['usrlvl'];
                }
            }
        }
    
    }
    ?>

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Code:
    <form id="form1" method="POST" name="login" action="<? $_SERVER['PHP_SELF'] ?>">
    Replace that with this:
    Code:
    <form id="form1" method="POST" name="login" action="">
    Jeremy | jfein.net

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
  •