Ok i found this race change script on AC Web and im going to use it on my site. however i need a bit of help since i've never done this before. Here's the script:
Code:
Ok Here is the final ^.^ Created by ProphetX And a bit eddited by me its for mangos/Trinity if you want it for arcemu just edit the Red with the Green
"$query = 'SELECT guid, account, name, race, class, gender FROM '.$characterTable;"
"$query = 'SELECT guid, acct, name, race, class, gender FROM '.$characterTable;"
Quote:
Originally Posted by ghbsraziel View Post
<?php
/*
PHP Race Changer
By Prophet
*******
*/
$dbServer = 'serverIp'; // default localhost
$dbUser = 'User';
$dbPass = 'pass';
$characterDB = 'characterdatabase';
$characterTable = 'Charactertable';
$characterLimit = '1'; //Max characters to show on the page
$races = array(
1 => "Human",
2 => "Orc",
3 => "Dwarf",
4 => "Night Elf",
5 => "Undead",
6 => "Tauren",
7 => "Gnome",
8 => "Troll",
10 => "Blood Elf",
11 => "Draenei");
$genders = array(
0 => "Male",
1 => "Female");
//Connect
$link = mysql_connect($dbServer, $dbUser, $dbPass) or die(mysql_error());
mysql_select_db($characterDB) or die(mysql_error());
if (isset($_POST['changeSubmit'])) {
$result = mysql_query("UPDATE $characterTable SET race={$_POST['race']}, gender={$_POST['gender']} WHERE guid={$_POST['id']}") or die(mysql_error());
if ($result) echo '<p style="color: #00CC00;">Race changed successfully</p>';
}
$query = 'SELECT guid, account, name, race, class, gender FROM '.$characterTable;
if (isset($_GET['searchName'])) {
$query .= " WHERE name LIKE '{$_GET['searchName']}%'";
}
$query .= ' LIMIT '.$characterLimit;
$result = mysql_query($query) or die(mysql_error());
?>
<form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<label for="searchName">Search characters:</label> <input type="text" name="searchName" id="searchName" size="25" value="<?php echo $_GET['searchName']; ?>" /> <input type="submit" value="Search" />
</form>
<table border="1">
<?php
//Show the characters
while ($row = mysql_fetch_array($result)) { ?>
<tr>
<form id="<?php echo $row['guid']; ?>" method="post" action="<?php echo $_SERVER['PHP_SELF']."?searchName=".$_GET['searchName']; ?>">
<td><?php echo $row['name']; ?></td>
<td><?php getRace($row['race']); ?></td>
<td><?php getGender($row['gender']); ?></td>
<td><input type="hidden" name="id" value="<?php echo $row['guid']; ?>" /><input type="submit" name="changeSubmit" value="Set Race" /></td>
</form>
</tr>
<?php } ?>
</table>
<?php
//Clean up
mysql_free_result($result);
mysql_close($link);
//Function...
function getRace($race) {
global $races;
$output = '<select name="race">';
foreach ($races as $key=>$val) {
$output .= '<option value="'.$key.'"';
if ("$key" == "$race") {
$output .= ' selected="selected"';
}
$output .= '>'.$val.'</option>';
}
$output .= '</select>';
echo $output;
return true;
}
function getGender($gender) {
global $genders;
$output = '<select name="gender">';
foreach ($genders as $key=>$val) {
$output .= '<option value="'.$key.'"';
if ("$key" == "$gender") {
$output .= ' selected="selected"';
}
$output .= '>'.$val.'</option>';
}
$output .= '</select>';
echo $output;
return true;
}
?>
and dont forget to thanks ProphetX!
Now what i want to do with this is instead of SEARCHING for the characters by typing in a name. I want it to make you Log into your account and get all your characters from your account and list them. If anyone could help me with this ill +Rep you as much as i can, ill also repost it on AC Web and up here for everyone to use.
Credits to ProphetX for making xD
thanks in advance.