Mang-Berto Posted April 6, 2012 Posted April 6, 2012 Good day sa inyong lahat, papaano ba gawin yung ganon? yung auto delete ang mga accounts na hindi nag lolog in within 2 months? maraming salamat sa sasagot, have a peaceful and meaningful lenten season to all of us, God bless Quote
Mang-Berto Posted April 10, 2012 Author Posted April 10, 2012 ay ganun po ba sir Remix? maraming salamat po Quote
espriketic Posted April 10, 2012 Posted April 10, 2012 <?php // Original Script created by : Wouter2004 // Simple edits to make it fully working by : martin (http://martint.net) // Updated by : Kisuka // Change these variables. $mysqlserver = "127.0.0.1"; // IP of the mySQL server. $db = "ragnarok"; // Your ragnarok database. $user = "ragnarok"; // mySQL username. $pass = "ragnarok"; // mySQL password. $date = "2012-02-20"; // Delete all account of users that haven't logged in since (YYYY-MM-DD). // ---------------------------------------------------------- // Dont edit anything below unless you know what your doing!! // ---------------------------------------------------------- mysql_connect($mysqlserver,$user, $pass) or die(mysql_error()); mysql_select_db($db) or die(mysql_error()); $num = 0; $result = mysql_query("SELECT * FROM `login` WHERE lastlogin < '$date 00:00:00' ") or die(mysql_error()); echo("<h2>This script will now clean up your database!</h><b<b"); while ($row = mysql_fetch_array($result)){ //Fetch all the login accounts in an array. $result2 = mysql_query("SELECT * FROM `char` WHERE account_id = ".$row[account_id]." ") or die(mysql_error()); $num++; echo("<b".$num."- Account: ".$row[account_id]."- Name: ".$row[userid].""); while ($row2 = mysql_fetch_array($result2)){ //Fetch all the char id's in an array. mysql_query("DELETE FROM `global_reg_value` WHERE char_id = ".$row2[char_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `inventory` WHERE char_id = ".$row2[char_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `skill` WHERE char_id = ".$row2[char_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `cart_inventory` WHERE char_id = ".$row2[char_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `pet` WHERE char_id = ".$row2[char_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `friends` WHERE char_id = ".$row2[char_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `char` WHERE char_id = ".$row2[char_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `auction` WHERE seller_id = ".$row2[char_id]." ") or die(mysql_error()); // Check for a homunculus. $result3 = mysql_query("SELECT * FROM `homunculus` WHERE char_id = ".$row2[char_id]." ") or die(mysql_error()); $row3 = mysql_fetch_array($result3); $num_results3 = mysql_num_rows($result3); if ($num_results3 > 0){ mysql_query("DELETE FROM `homunculus` WHERE char_id = ".$row2[char_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `skill_homunculus` WHERE homun_id = ".$row3[homun_id]." ") or die(mysql_error()); } // Check if guild leader. $result4 = mysql_query("SELECT * FROM `guild` WHERE char_id = ".$row2[char_id]." ") or die(mysql_error()); $row4 = mysql_fetch_array($result4); $num_results4 = mysql_num_rows($result4); if ($num_results4 > 0){ mysql_query("DELETE FROM `guild` WHERE char_id = ".$row2[char_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `guild_alliance` WHERE guild_id = ".$row4[guild_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `guild_castle` WHERE guild_id = ".$row4[guild_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `guild_expulsion` WHERE guild_id = ".$row4[guild_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `guild_member` WHERE guild_id = ".$row4[guild_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `guild_position` WHERE guild_id = ".$row4[guild_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `guild_skill` WHERE guild_id = ".$row4[guild_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `guild_storage` WHERE guild_id = ".$row4[guild_id]." ") or die(mysql_error()); }else{ mysql_query("DELETE FROM `guild_member` WHERE char_id = ".$row2[char_id]." ") or die(mysql_error()); } mysql_query("DELETE FROM `hotkey` WHERE char_id = ".$row2[char_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `mail` WHERE dest_id = ".$row2[char_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `memo` WHERE char_id = ".$row2[char_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `quest` WHERE char_id = ".$row2[char_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `quest_objective` WHERE char_id = ".$row2[char_id]." ") or die(mysql_error()); } mysql_query("DELETE FROM `storage` WHERE account_id = ".$row[account_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `global_reg_value` WHERE account_id = ".$row[account_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `login` WHERE account_id = ".$row[account_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `party` WHERE leader_id = ".$row[account_id]." ") or die(mysql_error()); mysql_query("DELETE FROM `sc_data` WHERE account_id = ".$row[account_id]." ") or die(mysql_error()); } ?> I don't own this code Quote
Mang-Berto Posted April 11, 2012 Author Posted April 11, 2012 @kentbsece - saan ko po siya ilalagay? sorry for the noob question Quote
espriketic Posted April 26, 2012 Posted April 26, 2012 open notepad, copy/paste the code and save it as delete.php or something you want but it must be .php upload the file and when you want to delete accounts, just go to the location of that file. http://www.mysite.com/delete.php Quote
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.