View Single Post
  #3  
Old 03-04-2010, 07:37 PM
Magnie's Avatar
Magnie Magnie is offline
Pythonic
 
Join Date: Dec 2009
Location: Polaris, the Planet
Posts: 34
Gender: Male
Credits: 6,478
Magnie
Send a message via ICQ to Magnie
Default RE: Help: Admin.php File [Answered]

Read ALL of this before you start making changes on your website. Also, it is not my fault if you mess your own website up, not me. I had to remake my website when I messed something up, so take great care when you work this out. ( I'm just trying to make it obvious it's not my fault if you ruin something. :P )

There is a file called admpost.php. Go to line 878 it should say "else if($page == "users"){" then go down a bit and you should see something like:

$username = $_POST["username"];

$username = secure($username);

Then copy and paste that and change it to:

$moneys = $_POST["moneys"];

$moneys = secure($moneys);

And put it after the list of the variables and posts and secures. ( 'moneys' should be whatever the 'input id/name' is on admin.php ) Then go down to line 931 and a little bit after that you should see:

$query = "UPDATE ".$prefix."users SET email='".$email."' WHERE username='".$username."'";

mysql_query($query);

Then copy that and paste it under that then change it to:

$query = "UPDATE ".$prefix."users SET money='".$moneys."' WHERE username='".$username."'";

mysql_query($query);

Then save it and try it on a 'test' account. Notes:
1. This is just if you have already created the cash/money column in the users table.
2. Make sure, on the input id/name is different from the variable. I made a mistake and put:

<input name='money' type='text' id='money' value='".$money."'>

instead of something different like:

<input name='moneys' type='text' id='moneys' value='".$money."'>

If you don't have the cash/money column then run a MySql query and put:

ALTER TABLE users
ADD money INT(11) NULL DEFAULT '0'

in it. Then change 'users' to what ever the table name is for the users. Mine is 'adopt_users' so I changed it to:

ALTER TABLE adopt_users
ADD money INT(11) NULL DEFAULT '0'

Then run the query.

Note: There may be some files that require changing to work correctly, like the "register.php" has:

mysql_query("INSERT INTO ".$prefix."users VALUES ('', '$username', '$pass1','$email','3','1', '$date', '0','','','','','','','')");

( *cough* This is a copy from some other MySql/PHP stuff I'm doing, so there may be some extra ,'' things that are different from yours *cough* ) and you will need to add a ,'0' before the )" but after the ,'' ( lol ) so, just a warning that you probably need to fix those sorts of things.

If you have read everything closely, then you may begin making changes. :P ( I'll make a more detailed explanation some other day, you'll just have to remind me. :P )
Reply With Quote