Jump to content

Archived

This topic is now archived and is closed to further replies.

spInGoBlin

Login trouble

Recommended Posts

If you can, please compare 2 pages:
1. [a href=\"http:///www.noon.ee/dbase/addrecord_wlog.php\" target=\"_blank\"]page with login/session_start[/a]
2. [a href=\"http://www.noon.ee/dbase/addrecord_woutlog.php\" target=\"_blank\"]page without login/session start[/a]

The goal is to display an extra row if certain (admin rights) people are logged in (based on SQL row "admin_rights"). Piece of "login.php":
[code]        if($password == $row["password"])
        {
            
            $_SESSION['adminok'] = "bad";
            $_SESSION['username'] = "username";
            $_SESSION['password'] = "password";
            header("Location: admin.php");
            if ($row['admin_rights'] == 1) {
                $_SESSION['adminok'] = "good";
            }
[/code]
This far it works, the extra row is there:
[code]<?php if ($adm == "good") {
echo '<tr><td class="tableheader" width="50%">Müügiarve?</td><td class="tablecont" width="50%"><select name="selectSales" onclick="Refresh(0)" size="1">';
    echo '<option value = 1>Jah</option>';
    echo '<option value = 0>Ei</option>';

echo '</select></td></tr>';
} else {};
?>[/code]
But the other goal is for the form to refresh whenever a field is changed, displaying different results. This works in [b]addrecord_woutlog.php[/b] but not in [b]addrecord_wlog.php[/b]. And there is only one difference as far as I can see:
addrecord_woutlog.php:
[code]checklogin();
session_start();
$adm=$_SESSION['adminok'];
[/code]
addrecord_wlog.php:
[code]//checklogin();
//session_start();
$adm=$_SESSION['adminok'];
[/code]
Everything else is the same.
Can anyone please help me to pin the problem? Can there be a problem with the session_start()? Is there anything I'm missing/not aware of? Thank you.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.