Previous Thread
Next Thread
Print Thread
Rate Thread
#211893 09/26/2001 1:22 PM
Joined: Mar 2000
Posts: 528
Junior Member
Junior Member
Offline
Joined: Mar 2000
Posts: 528
I posted this before and only drew one response - and I know there is someone PHP savvy enough to tell me where I went wrong...

My issue is this. The below code is NOT picking up my $Title variable. The page will show the existing variable in the text box - you can type over it, and the original will echo AND stay in the database.

however - the $groups is changing correctly. Anyone see a problem? Here is the code:


<?
// ------------------------------------------------------------------------
// WWWThreads - PHP// Wired Community Software
// Rick Baker ([email protected])
// (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] != 'Moderator') && ($user[U_Status] != 'Administrator')){
$html -> not_right ("You must be logged in, and be a valid administrator or moderator to access this.",$Cat);
}

// -----------------------------------
// Find out what groups they belong to
$Username_q = addslashes($User);
$query = "
SELECT Mem_Groups, Mem_Title
FROM ssb_members
WHERE Mem_Username = '$Username_q'
";
$sth = $dbh -> do_query($query);
list($Groups,$Title) = $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

$Groups_q = addslashes($Groups);
$Title_q = addslashes($Title);

// --------------------------
// Update the User's profile

$query = "
UPDATE ssb_members
SET Mem_Groups = '$Groups_q',
Mem_Title = '$Title_q'
WHERE Mem_Username = '$Username_q'
";
$dbh -> do_query($query);

// ---------------------
// Send the confirmation

echo "$Title,$Groups";

$html -> send_header("This users membership listing has 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 membership listing has been changed.");
echo "<TABLE BORDER=0 WIDTH="$theme[tablewidth]" ALIGN="$theme[tablealign]"><TR><TD class="cleartable"><span class="onbody">";
echo "This users membership listing has been changed. You will now be returned to the main administration page.";
echo "</span></TD></TR></TABLE>";

// ----------------
// send the footer

$html -> send_footer();?>


Thanks in advance!

Sponsored Links
Joined: Aug 2000
Posts: 262
Enthusiast
Enthusiast
Offline
Joined: Aug 2000
Posts: 262
okey don't know everything but, is it able to grab the username? $Username_q = addslashes($User); will not work, it has to be $Username_q = addslashes($Username);
what you gotta do, is echo out some statements after the query to see if it is beging grabbed at all. and figure out why it isn't being grabbed. after list($Groups,$Title) = $dbh -> fetch_array($sth); $dbh -> finish_sth($sth); add echo "$Title, $Groups"; and see if it echos out. are you getting errors? everything seems to look okey except for the username dilly.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,833
Joined: January 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)