Magnie
02-18-2010, 07:00 PM
Okay, I have been working to make a Cash/Money Mod for my adoptables site and now that I have it working, I want to make it so I can change it in the Admin CP instead of opening up the MySQL and changing the settings from there. I've gotten the needed code put into the file. So I the required form showing ( So I can see it and put input in it ) but when I press Submit it won't change.
Here is the changed code:
// We are managing users...
if($do == "edit"){
$user = $more;
$query = "SELECT * FROM ".$prefix."users WHERE username = '".$user."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > 0){
//The user actually exists, so allow us to edit them...
$article_title = "User Editor - Editing ".$user."'s Account";
$article_content = "Here you can edit the user's account using the form below.<br>";
$i=0;
while ($i < 1) {
$email=@mysql_result($result,$i,"email");
$usergroup=@mysql_result($result,$i,"usergroup");
$i=0;
while ($i < 1) {
$email=@mysql_result($result,$i,"email");
$usergroup=@mysql_result($result,$i,"usergroup");
$i++;
}
$query = "SELECT * FROM ".$prefix."users WHERE username = '".$user."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i=0;
while ($i < 1) {
$money=@mysql_result($result,$i,"money");
$i++;
}
//************************************************** **********************************************
// BEGIN THE FORM
//************************************************** **********************************************
$article_content = $article_content."<form name='form1' method='post' action='admpost.php'>
<p>
<input name='delete' type='checkbox' id='delete' value='yes'>
<img src='templates/icons/delete.gif'> Delete This User. <strong>This cannot be undone!</strong></p>
<p>Assign New Password:
<input name='pass1' type='password' id='pass1'>
</p>
<p>Passwords may contain letters and numbers only. Leave the box blank to keep the current password.</p>
<p>
<input name='emailpwchange' type='checkbox' id='emailpwchange' value='yes'>
Email the user the new password (Only takes effect if setting a new password) </p>
<p>Change Email Address:
<input name='email' type='text' id='email' value='".$email."'>
</p>
<p><u>".$user."'s Money:</u> ".$money."</p>
<p>Change ".$user."'s Money To:<br>
<input name='money' type='text' id='money' value='".$money."'></p>
<p><u>".$user."'s Current Usergroup:</u> Group ".$usergroup."</p>
<p>Change ".$user."'s Usergroup To:<br>
<select name='level' id='level'>
<option value='nochange' selected>Do not change</option><br><br>";
// We need to stop here and fetch our usergroups...
$query = "SELECT * FROM ".$prefix."groups";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num) {
$groupname=@mysql_result($result,$i,"groupname");
$groupid=@mysql_result($result,$i,"gid");
$article_content = $article_content."<option value='".$groupid."'>Group ".$groupid." :: ".$groupname."</option>";
$i++;
}
$article_content = $article_content."</select>
</p>
<p> <input name='page' type='hidden' id='page' value='users'>
<input name='username' type='hidden' id='username' value='".$user."'>
</p>
<p>
<input type='submit' name='Submit' value='Submit'>
</p>
</form>";
Any ideas on how I'm suppose to save it in the Database? ( If you want screen shots of the web page, tell me. )
Edit: Never mind, I found out how to do it. :D
Here is the changed code:
// We are managing users...
if($do == "edit"){
$user = $more;
$query = "SELECT * FROM ".$prefix."users WHERE username = '".$user."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > 0){
//The user actually exists, so allow us to edit them...
$article_title = "User Editor - Editing ".$user."'s Account";
$article_content = "Here you can edit the user's account using the form below.<br>";
$i=0;
while ($i < 1) {
$email=@mysql_result($result,$i,"email");
$usergroup=@mysql_result($result,$i,"usergroup");
$i=0;
while ($i < 1) {
$email=@mysql_result($result,$i,"email");
$usergroup=@mysql_result($result,$i,"usergroup");
$i++;
}
$query = "SELECT * FROM ".$prefix."users WHERE username = '".$user."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i=0;
while ($i < 1) {
$money=@mysql_result($result,$i,"money");
$i++;
}
//************************************************** **********************************************
// BEGIN THE FORM
//************************************************** **********************************************
$article_content = $article_content."<form name='form1' method='post' action='admpost.php'>
<p>
<input name='delete' type='checkbox' id='delete' value='yes'>
<img src='templates/icons/delete.gif'> Delete This User. <strong>This cannot be undone!</strong></p>
<p>Assign New Password:
<input name='pass1' type='password' id='pass1'>
</p>
<p>Passwords may contain letters and numbers only. Leave the box blank to keep the current password.</p>
<p>
<input name='emailpwchange' type='checkbox' id='emailpwchange' value='yes'>
Email the user the new password (Only takes effect if setting a new password) </p>
<p>Change Email Address:
<input name='email' type='text' id='email' value='".$email."'>
</p>
<p><u>".$user."'s Money:</u> ".$money."</p>
<p>Change ".$user."'s Money To:<br>
<input name='money' type='text' id='money' value='".$money."'></p>
<p><u>".$user."'s Current Usergroup:</u> Group ".$usergroup."</p>
<p>Change ".$user."'s Usergroup To:<br>
<select name='level' id='level'>
<option value='nochange' selected>Do not change</option><br><br>";
// We need to stop here and fetch our usergroups...
$query = "SELECT * FROM ".$prefix."groups";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num) {
$groupname=@mysql_result($result,$i,"groupname");
$groupid=@mysql_result($result,$i,"gid");
$article_content = $article_content."<option value='".$groupid."'>Group ".$groupid." :: ".$groupname."</option>";
$i++;
}
$article_content = $article_content."</select>
</p>
<p> <input name='page' type='hidden' id='page' value='users'>
<input name='username' type='hidden' id='username' value='".$user."'>
</p>
<p>
<input type='submit' name='Submit' value='Submit'>
</p>
</form>";
Any ideas on how I'm suppose to save it in the Database? ( If you want screen shots of the web page, tell me. )
Edit: Never mind, I found out how to do it. :D