صفحه ساخت اکانتنقل قول:
[PHP]<?php
// Configuration.
// Realm database.
$r_db = "auth";
// IP (and port).
$ip = "localhost:3306";
// Username.
$user = "root";
// Password.
$pass = "password";
// Site title.
$title = "Registration Form";
$title2 = "Some Server";
// End config.
$page = '<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>' . $title . '</title>
</head>
<body style="background-color:black;color:yellow;font-family:verdana;">
<form method="post" action="' . $_SERVER["SCRIPT_NAME"] . '">
<p style="text-align:center;">
<strong>' . $title2 . ' - ' . $title . '</strong>
<br /><br /><br />
Username:
<br /><input name="username" type="text" maxlength="14" /><br />
Password:
<br /><input name="password" type="password" maxlength="12" /><br />
Email:
<br /><input name="email" type="text" maxlength="255" />
<br />
<INPUT TYPE=RADIO NAME="expansion" VALUE="0" >Original -
<INPUT TYPE=RADIO NAME="expansion" VALUE="1" >TBC -
<INPUT TYPE=RADIO NAME="expansion" VALUE="2" CHECKED >WOTLK<br />
<br /><br /><br />
<button type="submit">Submit</button>
</p>
</form>
</body>
</html>';
function error_s ($text) {
echo("<p style=\"background-color:black;color:yellow;font-family:verdana;\">" . $text);
echo("<br /><br /><a style=\"color:orange;\" href=\"" . $_SERVER["SCRIPT_NAME"] . "\">Go back...</a></p>");
};
$user_chars = "#[^a-zA-Z0-9_\-]#";
$email_chars = "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}$/";
$con = @mysql_connect($ip, $user, $pass);
if (!$con) {
error_s("Unable to connect to database: " . mysql_error());
};
if (!empty($_POST)) {
if ((empty($_POST["username"]))||(empty($_POST["password"]))||(empty($_POST["email"]))||(empty($_POST["expansion"])) ) {
error_s("You did not enter all the required information.");
exit();
} else {
$username = strtoupper($_POST["username"]);
$password = strtoupper($_POST["password"]);
$email = strtoupper($_POST["email"]);
$expansion = $_POST["expansion"];
if (strlen($username) < 5) {
error_s("Username too short.");
exit();
};
if (strlen($username) > 14) {
error_s("Username too long.");
exit();
};
if (strlen($password) < 8) {
error_s("Password too short.");
exit();
};
if (strlen($password) > 12) {
error_s("Password too long.");
exit();
};
if (strlen($email) < 4) {
error_s("Email was too short.");
exit();
};
if (strlen($email) > 255) {
error_s("Email was too long.");
exit();
};
if (preg_match($user_chars,$username)) {
error_s("Username contained illegal characters.");
exit();
};
if (preg_match($user_chars,$password)) {
error_s("Password contained illegal characters.");
exit();
};
if (!preg_match($email_chars,$email)) {
error_s("Email was in an incorrect format.");
exit();
};
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
$email = mysql_real_escape_string($email);
$qry = @mysql_query("select username from " . mysql_real_escape_string($r_db) . ".account where username = '" . $username . "'", $con);
if (!$qry) {
error_s("Error querying database: " . mysql_error());
};
if ($existing_username = mysql_fetch_assoc($qry)) {
foreach ($existing_username as $key => $value) {
$existing_username = $value;
};
};
$existing_username = strtoupper($existing_username);
if ($existing_username == strtoupper($_POST['username'])) {
error_s("That username is already taken.");
exit();
};
unset($qry);
$qry = @mysql_query("select email from " . mysql_real_escape_string($r_db) . ".account where email = '" . $email . "'", $con);
if (!$qry) {
error_s("Error querying database: " . mysql_error());
};
if ($existing_email = mysql_fetch_assoc($qry)) {
foreach ($existing_email as $key => $value) {
$existing_email = $value;
};
};
if ($existing_email == $_POST['email']) {
error_s("That email is already in use.");
exit();
};
unset($qry);
$sha_pass_hash = sha1(strtoupper($username) . ":" . strtoupper($password));
$register_sql = "insert into " . mysql_real_escape_string($r_db) . ".account (username, sha_pass_hash, email, expansion) values (upper('" . $username . "'),'" . $sha_pass_hash . "','" . $email . "','" . $expansion . "')";
$qry = @mysql_query($register_sql, $con);
if (!$qry) {
error_s("Error creating account: " . mysql_error());
};
echo("Account successfully created.");
exit();
};
} else {
echo($page);
};
?>[/PHP]
config.php
[PHP]<?php
$ip = "localhost"; //This is your servers IP address
$port = "3306"; //This is the port number your server uses
$host = "localhost"; //Your Database IP address (usually localhost)
$user = "root"; //Your Database Username
$pass = "DB password"; //Your Database Password
$chars = "characters"; //Your MaNGOS Character Database
$mangosrealm = "auth"; //Your MaNGOS Realmd Database
$mangosworld = "world"; //Your MaNGOS Mangos Database
$cod = 'utf8'; //Don't bother changing this unless you know what to do with this.
$show_server_status = "true"; //Do you want to show the Server Status? Set value's: false or true
?>[/PHP]
بازیکنان آنلاین
[PHP]<?php
include ("config.php");
$charactersff = mysql_connect("$host", "$user", "$pass") or die('Connection Failed');
mysql_select_db ("$chars");
$result = mysql_query ("SELECT name, race, class, level, gender FROM characters WHERE online = 1 ORDER BY `level` DESC LIMIT 0 , 1000");
$class = array(1=>"Warrior",2=>"Paladin",3=>"Hunter",4=>"Ro gue",5=>"Priest",6=>"DeathKnight",7=>"Shaman",8=>" Mage",9=>"Warlock",11=>"Druid");
$race = array(1=>"Human",2=>"Orc",3=>"Dwarf",4=>"Night Elf",5=>"Undead",6=>"Tauren",7=>"Gnome",8=>"Troll" ,10=>"Blood Elf",11=>"Draenei");
$gender = array(0=>"Male",1=>"Female");
?><style type="text/css">
<!--
body {
font-family: tahoma;
font-size: 11px;
color: #FFFFFF;
background-color: ;
}
td,th {
font-family: tahoma;
font-size: 11px;
color: #111;
background-color: #DFDFDF;
}
.style1 {
color: #993300;
font-weight: bold;
font-size: 18px;
}
.style2 {
color: #FF0000;
font-weight: bold;
}
.bord {
border: 1px solid #DADADA;
background-color: #CFCFCF;
}
-->
</style>
<title>Online Player</title>
<font color=#000000>
<table align=center cellpadding="2" cellspacing="2" border="0" width="350px">
<thead class="bord">
<td width="20"><center>کلاس</center></td>
<td width="30"><center>نژاد</center></td>
<td width="30"><center>لول</center></td>
<td width="130"><center>نام کاراکتر</center></td>
<td width="20"><center>شماره</center></td>
</thead>
<tbody>
<?php
while($rows = mysql_fetch_object($result))
{
$i++;
$name = $rows->name;
$level = $rows->level;
$Total_Kills = $rows->totalKills;
$Total_Honor = $rows->totalHonorPoints;
$racet = $rows->race;
$classt = $rows->class;
$gendert = $rows->gender;
echo "
<tr title=\"$race[$racet] $class[$classt] $gender[$gendert]\">
<td><center >","<img src=\"images/class/$classt.gif\">","</center></td>
<td><center >","<img src=\"images/race/$racet-$gendert.gif\">","</center></td>
<td><center>",$level,"</center></td>
<td><i>",$name,"</i></td>
<td><center>",$i,"</center></td>
</tr>";
}
mysql_close($charactersff);
?>[/PHP]