Rank System Error

Codes here !

Moderators: macek, egami, gesf

Littlemurder
New php-forum User
New php-forum User
Posts: 1
Joined: Sat Jun 21, 2014 11:36 pm

Rank System Error

Postby Littlemurder » Sat Jun 21, 2014 11:53 pm

Hey

Guys im new to php coding well i have this problem inside my mysql database i have rank int default 0

Now when It set default 0 It suppose to see the user as regular user In If they rank says 1 It sees them as staff now when a person signs up It say they staff member when they rank Is set at 0 this Is what I have In my php coding

Top of the page

Code: Select all

<?php
    require("../common.php");
     
    if(empty($_SESSION['user']))
    {
        header("Location: ../index.php");
        exit;
    }
?>



The rank system Info

Code: Select all

<?php
echo $_SESSION['username'];

if($_SESSION['rank'] == 1) {
    echo "Staff Member";
} else if($_SESSION['rank'] == 0) {
    echo "Regular User";
}
?>



can u guys tell me the problem please In this what I have on the login

Code: Select all

       if($row['rank'] = 1) {
                $staffMember = true;
       } else {
                $staffMember = false;
            }
        }

        if($login_ok)
        {
            unset($row['password']);
            $_SESSION['user'] = $row;
            $_SESSION['action_token'] = generate_secure_token();
            $_SESSION['username'] = $_POST['username'];
            if($staffMember = true) {
      $_SESSION['rank'] = 1;
       } else {
      $_SESSION['rank'] = 0;
       }

Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest