Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 02-18-2010, 07:00 PM
Magnie's Avatar
Magnie Magnie is offline
Pythonic
 
Join Date: Dec 2009
Location: Polaris, the Planet
Posts: 34
Gender: Male
Credits: 4,999
Magnie
Send a message via ICQ to Magnie
Default Help: Admin.php File [Answered]

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:

PHP 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
Reply With Quote
  #2  
Old 02-19-2010, 06:37 PM
redheadturkey redheadturkey is offline
Senior Member
 
Join Date: Jan 2010
Posts: 136
Gender: Female
Credits: 10,366
redheadturkey is on a distinguished road
Default RE: Help: Admin.php File [Answered]

a friend is working on something similar for me as well, but they are having the same problem ---- how did you manage to do it? ;)
Reply With Quote
  #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: 4,999
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
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
But the file is there so why am I getting this error? Lazrgatr Questions and Supports 4 11-15-2015 11:33 AM
A little pointer for tab file location? Infernette Questions and Supports 6 08-22-2014 11:51 AM
There no file with Config.php digly Questions and Supports 13 06-15-2014 10:56 AM
Download Mysidia File digly Questions and Supports 2 06-08-2014 06:04 AM
Odd file superdude44 Questions and Supports 11 06-16-2013 09:21 PM


All times are GMT -5. The time now is 11:55 AM.

Currently Active Users: 15776 (0 members and 15776 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636