- Joined
- Jul 13, 2007
- Messages
- 39
- Reaction score
- 0
CREDITS
Legend- PHP script+ idea
Hdx- Scripting the damn thing
Me
The PHP
BH_login
BH_results
download DLL
Run the SQL
enjoy
WHAT IS IT?
its a npc that will give info about who has a bounty on thier head. once a player who has bounty is killed, the "hunter" will get the gold alocated by the client
the client enteres the bounty on the PHP files.
for more info visit the ACDB website!
Legend- PHP script+ idea
Hdx- Scripting the damn thing
Me
The PHP
BH_login
Code:
<html>
<head>
/*//////////////////////////////////////////////////////////////////////////////////////
//Edit the next line to fit the needs of your server (Usually your server's/site's name)
//////////////////////////////////////////////////////////////////////////////////////*/
<title>CHANGE ME</title>
<center><table>
<tr><td colspan=2 align=center>
<body>
<body bgcolor="#000000" text="#FFFFFF">
<h1>Welcome to the Bounty Hunter page.</h1>
<h1>Use at your own risk!</h1>
<h2>You must login to place a bounty.</h2>
<h2>Enter in the appropriate information below.</h2>
<h2>You must be logged out of the game for this to work</h2>
<?php
echo "<form name=myform method=post action='BH_Results.php'>";
echo "<tr><td colspan=2 align=center><font size=6>Enter your info here.</td></tr>";
echo "<tr><td width=125>Account: </td><td><input type=text name=account value=''></td></tr>";
echo "<tr><td width=125>Your Character's Name: </td><td><input type=text name=character value=''></td></tr>";
echo "<tr><td width=125>Password: </td><td><input type=password name=password value=''></td></tr>";
echo "<tr><td></td></tr>";
echo "<tr><td colspan=2 align=center><font size=6>Now input the character you want a target on.</td></tr>";
echo "<tr><td width=125>Target: </td><td><input type=text name=hunted value=''></td></tr>";
echo "<tr><td width=125>Bounty Price: </td><td><input type=text name=price value=''> In gold: eg. 200 gold</td></tr>";
echo "<tr><td colspan=2 align=center><br><input type=submit name=submit value='Place Bounty'></td></tr>";
echo "</form>";
?>
<table border="1" cellspacing="4" cellpadding="4">
<tr>
<th><font face="Arial, Helvetica, sans-serif">Name</font></th>
<th><font face="Arial, Helvetica, sans-serif">Race</font></th>
<th><font face="Arial, Helvetica, sans-serif">Class</font></th>
<th><font face="Arial, Helvetica, sans-serif">Level</font></th>
</tr>
<h2>Players available to have a bounty placed on them.</h2>
<?
/*////////////////////////////////////////////////////////////////////////
// Info needed to connect to your databases. MAKE SURE YOU EDIT THIS PART!
////////////////////////////////////////////////////////////////////////*/
$username="root"; //Username to connect to MYSQL
$pass="CHANGE ME"; //Password for MYSQL
$database="CHANGE ME"; //Database that contains Bounty table
$accountdb="CHANGE ME"; //Database that contains account info
$chardb="CHANGE ME"; //Database that contains character info
$Host="localhost"; //Where the databases are located
$Port="3306"; //Port used to connect to the databases
////////////////////////////////////////////////////////////////////////
// YOU SHOULDN'T HAVE TO EDIT BELOW THIS LINE.
////////////////////////////////////////////////////////////////////////
//Connect to character database
$con = mysql_connect($Host.":".$Port, $username, $pass) or die(mysql_error());
mysql_select_db($chardb) or die(mysql_error());
$query="SELECT guid,name,race,class,gender,level FROM characters where (level) >= 10 ORDER BY level DESC";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$guid=mysql_result($result,$i,"guid");
$name=mysql_result($result,$i,"name");
$race=mysql_result($result,$i,"race");
$class=mysql_result($result,$i,"class");
$level=mysql_result($result,$i,"level");
// Checking Race
if($race==1)
$race2="Human";
if($race==2)
$race2="Orc";
if($race==3)
$race2="Dwarf";
if($race==4)
$race2="Night Elf";
if($race==5)
$race2="Undead";
if($race==6)
$race2="Tauren";
if($race==7)
$race2="Gnome";
if($race==8)
$race2="Troll";
if($race==10)
$race2="Blood Elf";
if($race==11)
$race2="Draenei";
//Checking Class
if($class==1)
$class2="Warrior";
if($class==2)
$class2="Paladin";
if($class==3)
$class2="Hunter";
if($class==4)
$class2="Rogue";
if($class==5)
$class2="Priest";
if($class==7)
$class2="Shaman";
if($class==8)
$class2="Mage";
if($class==9)
$class2="Warlock";
if($class==11)
$class2="Druid";
?>
<tr>
<td><font face="Arial, Helvetica, sans-serif"><? echo $name; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $race2; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $class2; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $level; ?></font></td>
</tr>
<?
$i++;
}
?>
</body>
</head>
</html>
BH_results
Code:
<html>
<head>
<title>CHANGE ME</title>
<center><table>
<tr><td colspan=2 align=center>
<body>
<body bgcolor="#000000" text="#FFFFFF">
<?php
$hunted=$_POST["hunted"];
$character=$_POST["character"];
$hours=$_POST["hours"];
// Info needed to connect to databases
$username="root"; //Username to connect to MYSQL
$pass="CHANGE ME"; //Password for MYSQL
$database="CHANGE ME"; //Database that contains characters' info
$accountdb="CHANGE ME"; //Database that contains account info
$chardb="CHANGE ME"; //Database that contains your character info
$Host="localhost"; //Where the databases are located
$Port="3306"; //Port used to connect to the databases
if(isset($_POST['submit']))
{
//players account name, password and character name
$account = $_POST['account'];
$password = $_POST['password'];
$character = $_POST['character'];
$hunted = $_POST['hunted'];
$cost1 = $_POST['price'];
$cost = $cost1*10000;
?>
<h2><?php echo $_POST["character"]; ?> has placed a bounty on <?php echo $_POST["hunted"]; ?> for a cost of <?php echo $cost1; ?> gold.</h2>
<?
//Connect to character database
$con = mysql_connect($Host.":".$Port, $username, $pass) or die(mysql_error());
mysql_select_db($chardb) or die(mysql_error());
//Remove bullshit characters from user entered data
$character = mysql_real_escape_string(html_entity_decode(htmlentities($character)));
//Get acct id
$query = "SELECT acct FROM characters WHERE name = '".$character."'";
$result = mysql_query($query) or die(mysql_error());
$numrows = mysql_num_rows($result);
echo "<tr><td align=center>";
//if no rows exist, the character does not exist
if($numrows == 0)
{
die("No such character exists on that account!");
}
$row = mysql_fetch_array($result);
$acct = $row[0];
mysql_close();
//Connect to accounts database
$con = mysql_connect($Host.":".$Port, $username, $pass) or die(mysql_error());
mysql_select_db($accountdb) or die(mysql_error());
//Remove bullshit characters from user entered data
$account = mysql_real_escape_string(html_entity_decode(htmlentities($account)));
$password = mysql_real_escape_string(html_entity_decode(htmlentities($password)));
$query = "SELECT login, acct, password FROM accounts WHERE login ='".$account."' AND password = '".$password."' AND acct = '".$acct."'";
$result = mysql_query($query) or die(mysql_error());
$numrows = mysql_num_rows($result);
//if no rows, user entered invalid data
if ($numrows == 0)
{
die("Account name or password is incorrect!");
}
mysql_close();
echo "</td></tr>";
}
/*
This is where we will get info about the player putting a bounty on someone's character.
This is also where we will find out some info about the player about to be hunted.
*/
//players account name, password and character name
$account = $_POST['account'];
$password = $_POST['password'];
$character = $_POST['character'];
$hunted = $_POST['hunted'];
$cost1 = $_POST['price'];
$cost = $cost1*10000;
//Connect to character database
$con = mysql_connect($Host.":".$Port, $username, $pass) or die(mysql_error());
mysql_select_db($chardb) or die(mysql_error());
//Gathering Info on the person placing the bounty.
$query="select guid,acct from characters where name like '".$character."'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$Eguid=mysql_result($result,$i,"guid");
$Eacct=mysql_result($result,$i,"acct");
$i++;
}
//Connect to character database
$con = mysql_connect($Host.":".$Port, $username, $pass) or die(mysql_error());
mysql_select_db($chardb) or die(mysql_error());
//Gathering info about the target
$query="select guid,name,level,acct from characters where name like '".$hunted."'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$Hguid=mysql_result($result,$i,"guid");
$Hname=mysql_result($result,$i,"name");
$Hlevel=mysql_result($result,$i,"level");
$Hacct=mysql_result($result,$i,"acct");
$i++;
}
/*
This is where we are inserting the bounty into the database.
First though, we have to check if the same bounty is in the database.
*/
//Connect to character database
$con = mysql_connect($Host.":".$Port, $username, $pass) or die(mysql_error());
mysql_select_db($database) or die(mysql_error());
//Inserting the job into the database
$query=("INSERT INTO bountyhunter (client, target, bounty)
VALUES
('$Eguid','$Hguid','$cost')");
$result=mysql_query($query);
//mysql_query($query) or die(mysql_error());
mysql_close();
/*
Updating the player's gold that is purchasing the bounty.
*/
//Connect to character database
$con = mysql_connect($Host.":".$Port, $username, $pass) or die(mysql_error());
mysql_select_db($chardb) or die(mysql_error());
mysql_query("UPDATE characters SET gold = (gold -'$cost')
WHERE name like '$character'");
//$result=mysql_query($query);
//mysql_query($query) or die(mysql_error());
mysql_close();
?>
download DLL
To view the content, you need to sign in or register
Run the SQL
enjoy
To view the content, you need to sign in or register
WHAT IS IT?
its a npc that will give info about who has a bounty on thier head. once a player who has bounty is killed, the "hunter" will get the gold alocated by the client
the client enteres the bounty on the PHP files.
for more info visit the ACDB website!