InternalExpertCoding Posted March 8, 2013 Share Posted March 8, 2013 Basically, This is doing my head in. Basically, Mccode V2. When I edit a user(Whether it be to edit money,crystals,days) Anything, They completely loose the house they currently had. To per say they have House #5, When I edit the user(And after I click back to home), They loose House #5, And back into House #1. I have been away for quite awhile, But, No excuse for this doing my head in. Lol... Any suggestions/help appreciated. Will post code if someone is willing to help. Thank you in Advance, IEC Quote Link to comment Share on other sites More sharing options...
sniko Posted March 8, 2013 Share Posted March 8, 2013 It could be that you're editing their maxwill back to 100. Post code, please. Quote Link to comment Share on other sites More sharing options...
InternalExpertCoding Posted March 8, 2013 Author Share Posted March 8, 2013 function edit_user_begin() { global $db,$ir,$c,$h,$userid; if($ir['user_level'] != 2) { die("403"); } print "<h3>Editing User</h3> You can edit any aspect of this user. <br /> <form action='staff_users.php?action=edituserform' method='post'> User: ".user_dropdown($c,'user')."<br /> <input type='submit' value='Edit User' /></form> OR enter a user ID to edit: <form action='staff_users.php?action=edituserform' method='post'> User: <input type='text' name='user' value='0' /><br /> <input type='submit' value='Edit User' /></form>"; } function edit_user_form() { global $db,$ir,$c,$h,$userid; if($ir['user_level'] != 2) { die("403"); } $d=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us on u.userid=us.userid WHERE u.userid={$_POST['user']}"); $itemi=$db->fetch_row($d); $itemi['hospreason']=htmlspcl($itemi['hospreason']); $itemi['jail_reason']=htmlspcl($itemi['jail_reason']); $itemi['willmax'] = ($itemi['willmax'] > $itemi['maxwill']) ? $itemi['willmax'] : $itemi['maxwill'] ; print "<h3>Editing User</h3> <form action='staff_users.php?action=editusersub' method='post'> <input type='hidden' name='userid' value='{$_POST['user']}' /> <font color=red>Warnings: </font><input type='text' name='Warnings' value='{$itemi['Warnings']}' /><br /><br /> Username: <input type='text' name='username' value='{$itemi['username']}' /><br /> Login Name: <input type='text' name='login_name' value='{$itemi['login_name']}' /><br /> Duties: <input type='text' name='duties' value='{$itemi['duties']}' /><br /> Staff Notes: <input type='text' name='staffnotes' value='{$itemi['staffnotes']}' /><br /> Level: <input type='text' name='level' value='{$itemi['level']}' /><br /> Money: \$<input type='text' name='money' value='{$itemi['money']}' /><br /> Bank: \$<input type='text' name='bankmoney' value='{$itemi['bankmoney']}' /><br /> Crystals: <input type='text' name='crystals' value='{$itemi['crystals']}' /><br /> Bank Crystals: <input type='text' name='bankcrystals' value='{$itemi['bankcrystals']}' /><br /> Mail Ban: <input type='text' name='mailban' value='{$itemi['mailban']}' /><br /> Mail Ban Reason: <input type='text' name='mb_reason' value='{$itemi['mb_reason']}' /><br /> Forum Ban: <input type='text' name='forumban' value='{$itemi['forumban']}' /><br /> Forum Ban Reason: <input type='text' name='fb_reason' value='{$itemi['fb_reason']}' /><br /> Hospital time: <input type='text' name='hospital' value='{$itemi['hospital']}' /><br /> Hospital reason: <input type='text' name='hospreason' value='{$itemi['hospreason']}' /><br /> Jail time: <input type='text' name='jail' value='{$itemi['jail']}' /><br /> Jail reason: <input type='text' name='jail_reason' value='{$itemi['jail_reason']}' /><br /> House: ".house2_dropdown($c, "maxwill", $itemi['maxwill'])."<br /> <h4>Stats</h4> Strength: <input type='text' name='strength' value='{$itemi['strength']}' /><br /> Agility: <input type='text' name='agility' value='{$itemi['agility']}' /><br /> Guard: <input type='text' name='guard' value='{$itemi['guard']}' /><br /> Labour: <input type='text' name='labour' value='{$itemi['labour']}' /><br /> IQ: <input type='text' name='IQ' value='{$itemi['IQ']}' /><br /> <input type='submit' value='Edit User' /></form>"; } function edit_user_sub() { global $db,$ir,$c,$h,$userid; if($ir['user_level'] != 2) { die("403"); } $go=0; if(!isset($_POST['level'])) { $go=1; } if(!isset($_POST['money'])) { $go=1; } if(!isset($_POST['bankmoney'])) { $go=1; } if(!isset($_POST['crystals'])) { $go=1; } if(!isset($_POST['strength'])) { $go=1; } if(!isset($_POST['agility'])) { $go=1; } if(!isset($_POST['guard'])) { $go=1; } if(!isset($_POST['labour'])) { $go=1; } if(!isset($_POST['IQ'])) { $go=1; } if(!isset($_POST['username'])) { $go=1; } if(!isset($_POST['login_name'])) { $go=1; } if($go) { print "You did not fully fill out the form."; $_POST['user']=$_POST['userid']; edit_user_form(); } else { $_POST['level']=(int) $_POST['level']; $_POST['strength']=abs((int) $_POST['strength']); $_POST['agility']=abs((int) $_POST['agility']); $_POST['guard']=abs((int) $_POST['guard']); $_POST['labour']=abs((int) $_POST['labour']); $_POST['IQ']=abs((int) $_POST['IQ']); $_POST['money']=(int) $_POST['money']; $_POST['bankmoney']=(int) $_POST['bankmoney']; $_POST['cybermoney']=(int) $_POST['cybermoney']; $_POST['crystals']=(int) $_POST['crystals']; $_POST['mailban']=(int) $_POST['mailban']; $_POST['forumban']=(int) $_POST['forumban']; $maxwill=abs((int) $_POST['maxwill']); //check for username usage $u=$db->query("SELECT * FROM users WHERE username='{$_POST['username']}' and userid != {$_POST['userid']}"); if($db->num_rows($u) != 0) { print "That username is in use, choose another."; print "<br /><a href='admin.php?action=edituser'>> Back</a>"; $h->endpage(); exit; } $oq=$db->query("SELECT * FROM users WHERE userid={$_POST['userid']}"); $rm=$db->fetch_row($oq); $will=($rm['will'] > $maxwill) ? $maxwill: $rm['will']; $energy=10+$_POST['level']*2; $nerve=3+$_POST['level']*2; $hp=50+$_POST['level']*50; $db->query("UPDATE users SET username='{$_POST['username']}', level={$_POST['level']}, money={$_POST['money']}, crystals={$_POST['crystals']}, energy=$energy, brave=$nerve, maxbrave=$nerve, maxenergy=$energy, hp=$hp, maxhp=$hp, hospital={$_POST['hospital']}, jail={$_POST['jail']}, duties='{$_POST['duties']}', staffnotes='{$_POST['staffnotes']}', mailban={$_POST['mailban']}, mb_reason='{$_POST['mb_reason']}', forumban={$_POST['forumban']}, fb_reason='{$_POST['fb_reason']}', hospreason='{$_POST['hospreason']}', jail_reason='{$_POST['jail_reason']}', login_name='{$_POST['login_name']}', will=$will, maxwill=$maxwill WHERE userid={$_POST['userid']}"); $db->query("UPDATE userstats SET strength={$_POST['strength']}, agility={$_POST['agility']}, guard={$_POST['guard']}, labour={$_POST['labour']}, IQ={$_POST['IQ']} WHERE userid={$_POST['userid']}"); stafflog_add("Edited user {$_POST['username']} [{$_POST['userid']}]"); print "User edited...."; } } ?> Of course, I have my case functions and all also. Been so long since I have coded Mccode, I cannot completely remember everything properly. :( Quote Link to comment Share on other sites More sharing options...
InternalExpertCoding Posted March 8, 2013 Author Share Posted March 8, 2013 Quick Update... I'm Assuming that $itemi['willmax'] = ($itemi['willmax'] > $itemi['maxwill']) ? $itemi['willmax'] : $itemi['maxwill'] ; Is calling that your willmax is what your current will was prior to edit? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.