Jump to content

spInGoBlin

Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

spInGoBlin's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, Have you tried refreshing the page after selection, and using hidden fields to store the selection? : 1. <form id="form1" name="form1" method="post" action="form1.php?go=yes"> 2. in option list: <select name="List_box" onclick="Refresh(0)"> 3. Add a hidden text box: <input type="hidden" name="ListSelection"> 4. Add Javascript function: function Refresh() { form01["ListSelection"].value = form01["List_Box"].value; document.form01.submit(); } 5. After that refer to selected field as $ListSelection in PHP Hope that helps.
  2. 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.
  3. Thank You sanfly! It worked perfectly, after I remembered to use start_session(), too :) Problem solved
  4. I'm trying to separate some users (with admin rights) from others, so that they can view and enter some data that will be hidden from others in many consequent windows. My login page goes like this: if (isset($_POST['Submit'])) { $username = $_POST['username']; $password = $_POST['password']; $result = mysql_query("Select * From admin where username='$username'",$link); if(mysql_num_rows($result)>0) { $row = mysql_fetch_array($result, MYSQL_BOTH); if($password == $row["password"]) { $_SESSION['adminok'] = "ok"; $_SESSION['username'] = "username"; $_SESSION['password'] = "password"; header("Location: admin.php"); } else {$msg = "Password incorrect";} } else {$msg = "Username incorrect";} } ?> There's a row in the SQL table (admin_rights) that's either 0 or 1 (true/false). how can I pass this variable on to another php page to filter out some rows from other SQL tables, depending on this variable? I reckon it should go something like this: $clientsresult = mysql_query("Select * from clients",$link); $numcli = mysql_num_rows($clientsresult); $nc = 0; while($clients = mysql_fetch_array($clientsresult, MYSQL_BOTH)){ [b]if ($isadmin) {[/b] $nc++; $client[$clients['client_ID']] = $clients['name']; } } Well, this seems simple, but how shall I get the [b]$isadmin[/b] from login page? This is also simple I know :) but I'm having awsome trouble. Help please! Thanks.
×
×
  • Create New...

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.