Question: I tried make 1 form to make login with different user level, so i tried to login with correct user and password (user level and admin level) then it redirect me to <http://localhost/dashboard/> (when it suppose direct to index.html if level user or direct to index.php if level admin) but when i tried input wrong username and password it succeed redirect to index.php.

here's my code :

```
session_start();

include "koneksi.php";

$username = $_POST['username'];
$password = $_POST['password'];

$query = mysqli_query($koneksi, "SELECT * from user WHERE log_usr='$username' AND pas_usr='$password'");
$exitCount=mysqli_num_rows($query);
    if($exitCount==1){
            $data = mysqli_fetch_array($query);
            $id = $row['log_usr'];
            $lvl = $row['sts_usr'];

            if ($lvl=='A')
            {
                $link = '../index.html';
            }
            elseif($lvl='U')
            {
                $link = '../index.php';
            }
        $_SESSION['username'] = $username;
        header ('location:".$link.'');
        exit();
    }else{
        echo "<script>alert('Username dan Password tidak valid.'); window.location = 'index.php'</script>";
    }

```

Answer: 
As per `p` being defined as `struct cdev *p`, `p` is very much a "memory address" but that's not *all* it is - it also has a *type* attached to it.

Since the expression `*ptr` is "the object pointed to by `ptr`", that *also* has the type attached, so you can logically do `(*ptr).member`.

And, since `ptr->member` is identical to `(*ptr).member`, it too is valid.

Bottom line is, your contention that "pointers [aren't] *much* more than memory addresses" is correct. But they are a *little* bit more :-)

---

In terms of `&ptr->member`, you seem to be reading that as `(&ptr)->member`, which is not correct.

Instead, as per C precedence rules, it is actually `&(ptr->member)`, which means the *address of the member of that structure.*

These precedence rules are actually specified by the ISO C standard (C11 in this case). From `6.5 Expressions`, footnote `85`:

> 
> The syntax specifies the precedence of operators in the evaluation of an expression, which is the same as the order of the major subclauses of this subclause, highest precedence first.
> 
> 
> 

And, since `6.5.2 Postfix operators` (the bit covering `->`) comes before `6.5.3 Unary operators` (the bit covering `&`), that means `->` evaluates first.
`->member` has higher precedence than `&`.

```
&p->kobj

```

parses as

```
&(p->kobj)

```

i.e. it's taking the address of the `kobj` member of the struct pointed to by `p`.