I have written a hack for a WWWThreads message board forum that allows you to enter/modify data in a separate table....but only a few of the fields are WRITING when I try updating.
I have a Username, User Number, Group, Rank, and Join Date. The Rank and Join date are not updating, but the Groups DOES update. I echoed $Title, $Joined, etc - and it is not grabbing them from the input page, but it DOES grab the $Groups and displays it correctly.
Here is the entire code:
<?
// ------------------------------------------------------------------------
// WWWThreads - PHP// Wired Community Software
// Rick Baker (rbaker@wcsoft.net)
// (c) Copyright 1999-2000
// ------------------------------------------------------------------------
// Require the library
require ("../main.inc.php");
// -----------------
// Get the user info
$Username = $w3t_myname;
$Password = $w3t_mypass;
$userob = new user;
$user = $userob -> authenticate("$Username","$Password","U_Username, U_Password");
$html = new html;
// -----------------------------
// Make sure they should be here
if ($user[U_Status] != 'Administrator'){
$html -> not_right ("You must be logged in, and be a valid administrator to access this.",$Cat);
}
// -----------------------------------
// Find out what groups they belong to
$Username_q = addslashes($User);
$query = "
SELECT Mem_Number, Mem_Groups, Mem_Title, Mem_Joined
FROM ssb_members
WHERE Mem_Username = '$Username_q'
";
$sth = $dbh -> do_query($query);
list($Number,$Groups,$Title,$Joined) = $dbh -> fetch_array($sth);
$dbh -> finish_sth($sth);
// -------------------------------
// Now let's get all of the groups
$query = "
SELECT Grp_Name, Grp_Id
FROM ssb_groups
";
$sth = $dbh -> do_query($query);
// --------------------------------------------------------------------
// Now we chug through the groups. If it was checked, we add them to
// the group. If it was unchecked we remove them from it.
$total = 0;
while ( list($Name,$Id) = $dbh -> fetch_array($sth)) {
$total++;
if ($HTTP_POST_VARS[$Id]) {
if (!ereg("-$Id-",$Groups)) {
$Groups .= "$Id-";
}
}
else {
$Groups = preg_replace("/-$Id-/","-",$Groups);
}
}
$dbh -> finish_sth($sth);
// -----------------------
// Format the query words
$Number_q = addslashes($Number);
$Groups_q = addslashes($Groups);
$Title_q = addslashes($Title);
$Joined_q = addslashes($Joined);
// --------------------------
// Update the User's profile
$query = "
UPDATE ssb_members
SET Mem_Number = '$Number_q',
Mem_Groups = '$Groups_q',
Mem_Title = '$Title_q',
Mem_Joined = '$Joined_q'
WHERE Mem_Username = '$Username_q'
";
$dbh -> do_query($query);
// ---------------------
// Send the confirmation
$html -> send_header("This users groups have been changed.",$Cat,"<META HTTP-EQUIV=\"Refresh\" content=\"5;url=$config[phpurl]/admin/login.php?Cat=$Cat\">",$user[U_Username],0,0,$user);
$html -> table_header("This users groups have been changed.");
echo "<TABLE BORDER=0 WIDTH=\"$theme[tablewidth]\" ALIGN=\"$theme[tablealign]\"><TR><TD class=\"cleartable\"><span class=\"onbody\">";
echo "This users groups have been changed. You will now be returned to the main administration page.";
echo "</span></TD></TR></TABLE>";
// ----------------
// send the footer
$html -> send_footer();?>
Anyone see anything odd?? Thanks for the help.
Medar