Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1
    Join Date
    Feb 2005
    Posts
    1,411
    Tokens
    0

    Latest Awards:

    Default Membership System Problem.

    As you may or may not of seen. This tutorial from techtuts was posted:

    http://www.habboxforum.com/showthrea...ed+User+System

    I managed to follow the tutorial and complete everything that is said to do. The problem is if i enable someone to register then login it says sorry your user level is no 5. So basically only admins can use it. If anyone knows how i could sort this please reply or pm.

    Cheers.

    - Matt
    I owe rep to:

    NintendoNews & Luckyrare

  2. #2
    Join Date
    Jul 2005
    Location
    -
    Posts
    2,995
    Tokens
    0

    Latest Awards:

    Default

    I'll look it up, if you wish i can send you a already made one which you just connect to db and it will work :s

  3. #3
    Join Date
    Feb 2005
    Posts
    1,411
    Tokens
    0

    Latest Awards:

    Default

    Hey, thanks for the offer but i have loads of mods on the current one which i need to keep. Im not sure what has gone wrong because last time i put it all together as a staff area it worked briliantly.

    Thanks

    - Matt
    I owe rep to:

    NintendoNews & Luckyrare

  4. #4
    Join Date
    Jul 2005
    Location
    -
    Posts
    2,995
    Tokens
    0

    Latest Awards:

    Default

    may u post the login script like all of the login.php script

  5. #5
    Join Date
    Feb 2005
    Posts
    1,411
    Tokens
    0

    Latest Awards:

    Default

    Its the same as the one in the topic:

    <?
    oB_start();
    // allows you to use cookies.
    include("config.php");
    if (!$logged[username])
    {
    if (!$_POST[login])
    {
    echo("
    <center><form method=\"POST\">
    <table>
    <tr>
    <td align=\"right\">
    Username: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\">
    </td>
    </tr>
    <tr>
    <td align=\"right\">
    Password: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"password\">
    </td></tr><tr>
    <td align=\"center\">
    <input type=\"submit\" name=\"login\" value=\"Login\">
    </td></tr><tr>
    <td align=\"center\">
    <a href=\"register.php\">Register Here</a>
    </td></tr></table></form></center>");
    }
    if ($_POST[login]) {
    // the form has been submitted. We continue...
    $username=$_POST['username'];
    $password = md5($_POST[password]);
    // the above lines set variables with the submitted information.
    $info = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
    $data = mysql_fetch_array($info);
    if($data[password] != $password) {
    // the password was not the user's password!
    echo "Incorrect username or password!";
    }else{
    // the password was right!
    $query = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
    $user = mysql_fetch_array($query);
    // gets the user's information
    setcookie("id", $user[id],time()+(60*60*24*5), "/", "");
    setcookie("pass", $user[password],time()+(60*60*24*5), "/", "");
    // the above lines set 2 cookies. 1 with the user's id and another with his/her password.
    echo ("<meta http-equiv=\"Refresh\" content=\"0; URL=http://yoursite.com\"/>Thank You! You will be redirected");
    // modify the above line...add in your site url instead of yoursite.com
    }
    }
    }
    else
    {
    // we now display the user controls.
    echo ("<center>Welcome <b>$logged[username]</b><br /></center>
    - <a href=\"editprofile.php\">Edit Profile</a><br />
    - <a href=\"members.php\">Member List</a><br />
    - <a href=\"logout.php\">Logout</a>");
    }
    ?>
    I owe rep to:

    NintendoNews & Luckyrare

  6. #6
    Join Date
    Jul 2005
    Location
    -
    Posts
    2,995
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?
    oB_start
    ();
    // allows you to use cookies.
    include("config.php");
    if (!
    $logged[username])
    {
    if (!
    $_POST[login])
    {
    echo(
    "
    <center><form method=\"POST\">
    <table>
    <tr>
    <td align=\"right\">
    Username: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\">
    </td>
    </tr>
    <tr>
    <td align=\"right\">
    Password: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"password\">
    </td></tr><tr>
    <td align=\"center\">
    <input type=\"submit\" name=\"login\" value=\"Login\">
    </td></tr><tr>
    <td align=\"center\">
    <a href=\"register.php\">Register Here</a>
    </td></tr></table></form></center>"
    );
    }
    if (
    $_POST[login]) {
    // the form has been submitted. We continue...
    $username=$_POST['username'];
    $password md5($_POST[password]);
    // the above lines set variables with the submitted information. 
    $info mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
    $data mysql_fetch_array($info);
    if(
    $data[password] != $password) {
    // the password was not the user's password!
    echo "Incorrect username or password!";
    }else{
    // the password was right!
    $query mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
    $user mysql_fetch_array($query);
    // gets the user's information
    setcookie("id"$user[id],time()+(60*60*24*5), "/""");
    setcookie("pass"$user[password],time()+(60*60*24*5), "/""");
    // the above lines set 2 cookies. 1 with the user's id and another with his/her password. 
    echo ("<meta http-equiv=\"Refresh\" content=\"0; URL=http://PUT YOUR SITE URL IN HERE\"/>Thank You! You will be redirected");
    // modify the above line...add in your site url instead of yoursite.com
    }
    }
    }
    else
    {
    // we now display the user controls.
    echo ("<center>Welcome <b>$logged[username]</b><br /></center>
    - <a href=\"editprofile.php\">Edit Profile</a><br />
    - <a href=\"members.php\">Member List</a><br />
    - <a href=\"logout.php\">Logout</a>"
    );
    }
    ?>
    I dont see anything wrong with that :s
    May i ask what page you are having these problems?
    Last edited by Jamie.; 06-04-2006 at 08:58 AM.

  7. #7
    Join Date
    Feb 2005
    Posts
    1,411
    Tokens
    0

    Latest Awards:

    Default

    Its that page because when someone with a user level of 1 logs in. It just doesnt let them proceed on

    - Matt
    I owe rep to:

    NintendoNews & Luckyrare

  8. #8
    Join Date
    Jul 2005
    Location
    -
    Posts
    2,995
    Tokens
    0

    Latest Awards:

    Default

    Right, i will look at my code a min n compare it with yours,

    PHP Code:
    <? 
    oB_start
    (); 
    // allows you to use cookies. 
    include("config.php"); 
    if (!
    $logged[username]) 

    if (!
    $_POST[login]) 

    echo(

    <center><form method=\"POST\"> 
    <table> 
    <tr> 
    <td align=\"right\"> 
    Username: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\"> 
    </td> 
    </tr> 
    <tr> 
    <td align=\"right\"> 
    Password: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"password\"> 
    </td></tr><tr> 
    <td align=\"center\"> 
    <input type=\"submit\" name=\"login\" value=\"Login\"> 
    </td></tr><tr> 
    <td align=\"center\"> 
    <a href=\"register.php\">Register Here</a> 
    </td></tr></table></form></center>"
    ); 

    if (
    $_POST[login]) { 
    // the form has been submitted.  We continue... 
    $username=$_POST['username']; 
    $password md5($_POST[password]); 
    // the above lines set variables with the submitted information.   
    $info mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
    $data mysql_fetch_array($info); 
    if(
    $data[password] != $password) { 
    // the password was not the user's password! 
    echo "Incorrect username or password!"
    }else{ 
    // the password was right! 
    $query mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
    $user mysql_fetch_array($query); 
    // gets the user's information 
    setcookie("id"$user[id],time()+(60*60*24*5), "/"""); 
    setcookie("pass"$user[password],time()+(60*60*24*5), "/"""); 
    // the above lines set 2 cookies. 1 with the user's id and another with his/her password.   
    echo ("<meta http-equiv=\"Refresh\" content=\"0; URL=http://yoursite.com\"/>Thank You! You will be redirected"); 
    // modify the above line...add in your site url instead of yoursite.com 



    else 

    // we now display the user controls. 
    $new mysql_query("select * from pmessages where unread = 'unread' and touser = '$logged[username]'"); 
    $new mysql_num_rows($new); 
    echo (
    "<center>Welcome <b>$logged[username]</b><br /></center> 
    - <a href=\"editprofile.php\">Edit Profile</a><br /> 
    - <a href=\"members.php\">Member List</a><br /> 
    - <a href=\"messages.php\">Private Message Center (
    $new new)</a><br /> 
    - <a href=\"logout.php\">Logout</a>"
    );
    }
    ?>
    ^^ Thats my code

    Edit: try that it looks as if your missing some code
    Last edited by Jamie.; 06-04-2006 at 09:05 AM.

  9. #9
    Join Date
    Feb 2005
    Posts
    1,411
    Tokens
    0

    Latest Awards:

    Default

    Okay, thankyou.

    - Matt
    I owe rep to:

    NintendoNews & Luckyrare

  10. #10
    Join Date
    Jul 2005
    Location
    -
    Posts
    2,995
    Tokens
    0

    Latest Awards:

    Default

    Tell me if it works.

Page 1 of 2 12 LastLast

Posting Permissions

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