"user_username" TEXT,
"user_email" TEXT,
"user_desc" TEXT,
- "user_status" INTEGER
+ "user_status" TEXT
)';
$groupsql = '
$DB_CONNECTION->query($groupmemsql);
}
+function gwvp_GetUserStatus($userid)
+{
+ $conn = gwvp_ConnectDB();
+
+ $sql = "select user_status from users where users_id='$userid'";
+
+ $res = $conn->query($sql);
+
+ $return = null;
+ foreach($res as $val) {
+ $spl = explode(";", $val);
+
+ $return["statusid"] = $spl[0];
+ $return["extstatus"] = $spl[1];
+ }
+
+}
+
+function gwvp_SetUserStatus($userid, $status, $extendedstatus=null)
+{
+ /*
+ * user statues
+ * 0 - all good
+ * 1 - locked
+ * 2 - password locked
+ * 3 - awaiting registration completion
+ * 4 - awaiting password reset
+ * where use status = 3,4 the key for unlock is set as the extended status
+ * i.e. if a user goes thru registration, when the validation email gets to
+ * them they'll have a key in their email (128 or 256 bit), thats what
+ * the extended status field is used for
+ */
+
+ $conn = gwvp_ConnectDB();
+
+ if($extendedstatus != null) {
+ $sql = "update users set user_status='$status;$extendedstatus' where users_id='$userid'";
+ } else {
+ $sql = "update users set user_status='$status;0' where users_id='$userid'";
+ }
+
+ return $conn->query($sql);
+
+}
+
function gwvp_forceDisconnect()
{
return $return;
}
-function gwvp_getGroup($gid)
+function gwvp_getGroup($gid = null, $gname = null)
{
/*
* $groupsql = '
*/
$conn = gwvp_ConnectDB();
- $sql = "select * from groups where groups_id='$gid'";
+ if($gid != null) {
+ $sql = "select * from groups where groups_id='$gid'";
+ } else if ($gname != null) {
+ $sql = "select * from groups where groups_name='$gname'";
+ } else return false;
$res = $conn->query($sql);
$return = false;