This topic is locked

changing user ability and log off

7/4/2007 3:55:43 AM
PHPRunner General questions
D
diaster author

another issue.

after a user has entered his data, i wish to remove him/her from "user group" user to "user group" none, and log them off the database, so they cannot make more than one record. when they log back on they are now in the none "user group" and can only edit their previous data but not add anymore records. I must be careful though, cause "user group" admin still needs to be able to add records and not get his user status changed nor logged off, fun huh?

J
Jane 7/4/2007

Ted,
to change user group user Before record added event on the Events tab:

global $conn;

if ($_SESSION["UserID"]!="admin")

{

$str = "update UserTable set UserGroup='none' where UserName='".$_SESSION["UserID"]."'";

db_exec($str,$conn);

}



where UserName and UserGroup are your actual field names, UserTable is your actual table name.

D
diaster author 7/4/2007

Ted,

to change user group user Before record added event on the Events tab:
where UserName and UserGroup are your actual field names, UserTable is your actual table name.


It is not working! I get parse errorrs, then i chnage code around a bit and get sybtax errors. Could you tell me what

if ($_SESSION["UserID"]!="admin") is doing, do I need my fields in there, should that be "usergroup" and "user" as in if usergooup (field) is set to user, then
all the other code you included. below has my tables and names inserted, once again I do not have a userid field, I do have an int field "ID"
$str = "update Users set Group='none' where Username='".$_SESSION["UserID"]."'";

db_exec($str,$conn);
is that supposed to return a user name? My thought was, call for field and if setting is curently "user" change it to "none"

J
Jane 7/5/2007

Ted,
Following code compares logged user name with admin username. If this user isn't admin you can change his usergroup to none:

if ($_SESSION["UserID"]!="admin")


You can post here your actual event code and structure of Users table and I'll try to help you to write proper code.