I shamelessly stole the php skeleton from a guy whose name escapes me but he wrote this clever php script for Minilogin support. Anyway, great job whatever your name was!
I wrote this quick for use with our world server at PEQ today and it seems to work well, but I advise you to backup your database before using this tool just to be safe.
What this does is clears all buffs from the character you specify. This does not fix the problem, but it does let you manage the issue until either KLS or myself identify the cause of this problem and implement a fix.
Anyway, use this at your own risk.
Code:
<?php
$DB_ADDY = ""; //address:port for the MySQL server
$DB_USER = ""; //username to login to MySQL with
$DB_PASS = ""; //password to login to MySQL with
$DB_DB = ""; //database name
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PEQ - Player Character Buff Removal</title>
<style type="text/css">
<!--
body,td,th {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 14px;
color: #CCCCCC;
}
body {
background-color: #000000;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style1 {font-size: 9px}
.formelements {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
color: #FFFFFF;
background-color: #333333;
border: thin solid #666666;
}
a {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 14px;
color: #CCCCCC;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #CCCCCC;
}
a:hover {
text-decoration: underline;
color: #CCCCCC;
}
a:active {
text-decoration: none;
color: #CCCCCC;
}
.style4 {font-size: 10px}
-->
</style>
</head>
<body>
<div align="center"><?php
if(!isset($_POST['Submit'])) {
?>
<br />
<br />
<form id="form1" name="form1" method="post" action="index.php">
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right" valign="top"><div align="right">Account Name: </div></td>
<td align="left" valign="top"><input name="accountname" type="text" class="formelements" id="accountname" size="30" maxlength="30" />
<br />
<span class="style1">*must be a valid account name for this server only.</span></td>
</tr>
<tr>
<td align="right" valign="top"><div align="right">Character Name: </div></td>
<td align="left" valign="top"><input name="charactername" type="text" class="formelements" id="charactername" size="64" maxlength="64" />
<br />
<span class="style1">*must be a valid character name for the account name provided above.</span></td>
</tr>
<tr>
<br />
<td colspan="2" align="center" valign="top"><input name="Submit" type="submit" class="formelements" value="Remove All Buffs" /> <input name="Reset" type="reset" class="formelements" value="Clear" /></td>
</tr>
</table>
</form>
<?php
} else {
$link = mysql_connect($DB_ADDY,$DB_USER,$DB_PASS);
mysql_select_db($DB_DB,$link);
$sql_select_charid = "select c.id from account a inner join character_ c on a.id = c.account_id where a.name like '".($_REQUEST['accountname'])."' and c.name like '".($_REQUEST['charactername'])."'";
$res = mysql_query($sql_select_charid,$link) or die ("MySQL server database error: ".mysql_error());
$row_count = mysql_num_rows($res);
if($row_count == 1) {
$row = mysql_fetch_row($res);
$characterid = $row[0];
if($characterid >= 0) {
$sql_select_character_profile = "select profile from character_ where id = ".$characterid;
$res = mysql_query($sql_select_character_profile,$link) or die ("MySQL server database error: ".mysql_error());
if($res) {
$row = mysql_fetch_row($res);
$profile_data = $row[0];
$before_length = strlen($profile_data);
$i = 5506;
while($i < 6008) {
$profile_data[$i] = 0;
$i++;
}
$after_length = strlen($profile_data);
if($before_length == $after_length) {
$sql_profile_update = "update character_ set profile = '$profile_data' where id = '$characterid'";
// echo "<p>$sql_profile_update</p>";
mysql_query($sql_profile_update,$link) or die ("MySQL server database error: ".mysql_error());
echo "<p>Successfully removed all buffs from character ".($_REQUEST['charactername'])." (".$characterid.")!</p>";
// echo "<p>Before the update, profile length was $before_length bytes. After the update, profile length is $after_length</p>.";
}
else {
echo "ERROR: Unable to process request to clear buffs for character = ".($_REQUEST['charactername'])."($characterid) because your profile lengths did not match. Please notify a GM.";
}
}
else {
echo "ERROR: Unable to retrieve character profile data for character = ".($_REQUEST['charactername'])."($characterid). Please notify a GM.";
}
}
else {
echo "ERROR: Obtained an invalid character id (id = ".$characterid.").";
}
}
else {
echo "ERROR: Unable to retrieve data for character ".($_REQUEST['charactername']).".";
}
}
?>
<br />
<br />
</body>
</html>