|

- 帖子
- 2372
- 精华
- 33
- 积分
- 3209
- 银子
- 8640 两
- 小鲸鱼
- 590 条
- 在线时间
- 1247 小时
- 注册时间
- 2007-11-23
- 最后登录
- 2009-1-7
   
|
楼主
发表于 2008-1-6 20:41
| 只看该作者
[code=php]
<?php
/*
SPORA for Ascent v1.4
Simple Page Of Registration of Accounts for Ascent
It is made in the form of one page with fields of input of the
information of an account and the list of players being on a server.
Original Creation by mirage666 for MaNGOS http://pomm.da.ru/
Modified for Ascent by Kandyman http://www.burning-wow.com
*/
$lang="en"; // Language ("en" - english, "ru" - russian)
$title="mywow"; // Insert the title of your server here
$host="127.0.0.1"; // HOST for Character database
$user="root"; // USER for Character database
$password="99game.org"; // PASS for Character database
$db="as_character"; // NAME of Character database
$hostr="127.0.0.1"; // HOST for Logonserver database
$userr="root"; // USER for Logonserver database
$passwordr="99game.org"; // PASS for Logonserver database
$dbr="as_logon"; // NAME of Logonserver database
$database_encoding = 'utf8'; // Set encoding
$img_base = "img/"; // Image dir
$server = "127.0.0.1"; // Ascent Server Address
$port = "8129"; // Ascent Server Port
$lock_acc=0; // Lock created account to IP address (1 - on, 0 - off)
$lock_reg=0; // Registration only one (or more) account from one IP address
// 0 - not limit, 1 - one acc, 2 - two acc, etc...
$country_db = new DBLayer($hostr, $userr, $passwordr, $dbr);
$uniqcoun = $country_db->query("SELECT * FROM `country`");
if(mysql_num_rows($uniqcoun) == 0){
echo "No Data";
exit;}
while ($result=mysql_fetch_array($uniqcoun,MYSQL_ASSOC))
{
$a=$a."<option value=".$result["country"].">".$result["country"]."</option>";
}
Switch ($lang)
{
case "en":
$button="create_en.gif";
$text = Array(
'acc' => 'Creation of account',
'create' => 'is completed !',
'failed' => 'was not possible !',
'not_all' => 'Fields are filled not all',
'taken' => 'is already taken !',
'playerson' => 'players online',
'off' => 'is offline',
'name' => 'Account Name',
'password' => 'Password',
'ip_limit' => Array('From your IP ',' accounts are already created'),
'char' => Array('Name','Race','Class','LvL','Location'),
);
break;
}
class DBLayer
{
var $link_id;
var $query_result;
var $saved_queries = array();
var $num_queries = 0;
function DBLayer($db_host, $db_username, $db_password, $db_name)
{
$this->link_id = @mysql_connect($db_host, $db_username, $db_password, true);
if ($this->link_id)
{
if (@mysql_select_db($db_name, $this->link_id))
return $this->link_id;
else
error('Unable to select database. MySQL reported: '.mysql_error(), __FILE__, __LINE__);
}
else
error('Unable to connect to MySQL server. MySQL reported: '.mysql_error(), __FILE__, __LINE__);
}
function query($sql)
{
$this->query_result = @mysql_query($sql, $this->link_id);
if ($this->query_result)
{
++$this->num_queries;
return $this->query_result;
}
else
{
return false;
}
}
function result($query_id = 0, $row = 0)
{
return ($query_id) ? @mysql_result($query_id, $row) : false;
}
function fetch_assoc($query_id = 0)
{
return ($query_id) ? @mysql_fetch_assoc($query_id) : false;
}
function fetch_row($query_id = 0)
{
return ($query_id) ? @mysql_fetch_row($query_id) : false;
}
function num_rows($query_id = 0)
{
return ($query_id) ? @mysql_num_rows($query_id) : false;
}
function affected_rows()
{
return ($this->link_id) ? @mysql_affected_rows($this->link_id) : false;
}
function insert_id()
{
return ($this->link_id) ? @mysql_insert_id($this->link_id) : false;
}
function get_num_queries()
{
return $this->num_queries;
}
function get_saved_queries()
{
return $this->saved_queries;
}
function free_result($query_id = false)
{
return ($query_id) ? @mysql_free_result($query_id) : false;
}
function escape($str)
{
if (function_exists('mysql_real_escape_string'))
return mysql_real_escape_string($str, $this->link_id);
else
return mysql_escape_string($str);
}
function error()
{
$result['error_sql'] = @current(@end($this->saved_queries));
$result['error_no'] = @mysql_errno($this->link_id);
$result['error_msg'] = @mysql_error($this->link_id);
return $result;
}
function close()
{
if ($this->link_id)
{
if ($this->query_result)
@mysql_free_result($this->query_result);
return @mysql_close($this->link_id);
}
else
return false;
}
}
function error($message, $file, $line, $db_error = false)
{
global $siteerrors;
$s = "\t\t".'Error: <strong>'.$message.'.</strong>'."\n";
echo $s;
}
function test_realm(){
global $server, $port;
$s = @fsockopen("$server", $port, $ERROR_NO, $ERROR_STR,(float)0.5);
if($s){@fclose($s);return true;} else return false;
}
function get_realm_name(){
global $hostr, $userr, $passwordr, $dbr, $database_encoding;
$realm_db = new DBLayer($hostr, $userr, $passwordr, $dbr);
$realm_db->query("SET NAMES $database_encoding");
$query = $realm_db->query("SELECT * FROM `realmlist`");
$result = $realm_db->fetch_assoc($query);
$realm_db->close();
unset($realm_db);
return($result['name']);
}
if (empty($_POST['username']) and empty($_POST['passw']) and empty($_POST['email']))
{
$cont=' <TR>
<TD rowSpan=7><IMG height=110
src="'.$img_base.'pixel.gif" width=15></TD>
<TD vAlign=center align=left width=190><B
style="FONT-SIZE: 8pt;"><LABEL
for=username>'.$text["name"].':</LABEL>?</b><BR><INPUT
id=username style="WIDTH: 175px" tabIndex=1 maxLength=16
size=18 name=username></TD>
<TD rowSpan=7><IMG height=1 src="'.$img_base.'pixel.gif" width=15></TD></TR>
<TR><TD width=190 height=1></TD></TR>
<TR><TD width=190 height=1></TD></TR>
<TR>
<TD vAlign=center align=left width=190><B
style="FONT-SIZE: 8pt;"><LABEL
for=passw>'.$text["password"].':</LABEL>?</B><BR><INPUT id=passw
style="WIDTH: 175px" tabIndex=2 type=password maxLength=16
size=18 name=passw></TD></TR>
<TR>
<TD height="24" align=left vAlign=center><B
style="FONT-SIZE: 8pt;">
<LABEL
for=label>Country:</LABEL>
?</B><BR>
<label>
<select name="country" id="country">'.$a.'
</select>
</label></TD>
</TR>
<TR>
<TD vAlign=center align=left width=190><B
style="FONT-SIZE: 8pt;"><LABEL
for=email>E-mail:</LABEL>?</B><BR><INPUT id=email
style="WIDTH: 175px" tabIndex=2 maxLength=50
size=18 name=email></TD></TR>
<TR>
<TD align=left>
</TD></TR>
<TR>
<TD align=left colSpan=3>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD><IMG height=39
src="'.$img_base.'pixel.gif" width=19></TD>
<TD><INPUT class=button
style="WIDTH: 168px; HEIGHT: 39px" tabIndex=3 type=image
alt=Create src="'.$img_base.$button.'"
value=Create border=0></TD>
</TR></TBODY></TABLE></TD></TR>';
}
elseif (empty($_POST['username']) or empty($_POST['passw']) or empty($_POST['email']))
{
$cont='<TR><TD rowSpan=6><IMG height=152 width=1 src="'.$img_base.'pixel.gif"><TD align=Center><SMALL class=error>
'.$text["not_all"].'
<br><br><br><br></SMALL></TD></TD></TR><br>';
}
else
{
$username = htmlspecialchars(trim("$_POST[username]"));
$passw = trim($_POST['passw']);
$email = htmlspecialchars(trim($_POST['email']));
$ip = getenv('REMOTE_ADDR');
$country=htmlspecialchars(trim($_POST['country']));
// ???????? ? ????????
$realm_db = new DBLayer($hostr, $userr, $passwordr, $dbr);
$realm_db->query("SET NAMES $database_encoding");
//if ($_POST['flags'] == 1){$tbc = "8";} else {$tbc = "0";}
$tbc = "8";
$uniqueuser = $realm_db->query("SELECT `login` FROM `accounts` WHERE `login` = '$username'");
$logincheck = mysql_num_rows($uniqueuser);
$ip_cr=0;
if ($lock_reg!=0){
$query = $realm_db->query("SELECT `lastip` FROM `accounts` WHERE `lastip`='$ip'");
while($result = $realm_db->fetch_assoc($query)) $ip_cr++;
}
if (($ip_cr>=$lock_reg) && ($lock_reg!=0))
{
$cont='<TR><TD rowSpan=6><IMG height=152 width=1 src="'.$img_base.'pixel.gif"><TD align=Center><SMALL class=error>
'.$text["ip_limit"][0].$ip.'<br>'.$ip_cr.$text["ip_limit"][1].'
<br><br><br><br></SMALL></TD></TD></TR><br>';
}
elseif ($logincheck > 0)
{
$cont='<TR><TD rowSpan=6><IMG height=152 width=1 src="'.$img_base.'pixel.gif"><TD align=Center><SMALL class=error>
'.$text["name"].'<br><strong>'.$username.'</strong><br>'.$text["taken"].'
<br><br><br><br></SMALL></TD></TD></TR><br>';
}
else
{
if($realm_db->query("INSERT INTO `accounts` (`login`,`password`,`email`,`lastip`,`gm`,`banned`,`flags`,`country`) VALUES ('$username','$passw','$email','$ip','0','0','$tbc','$country')"))
{
$cont='<TR><TD rowSpan=6><IMG height=152 width=1 src="'.$img_base.'pixel.gif"><TD align=Center><SMALL>
'.$text["acc"].'<br><strong>'.$username.'</strong><br>'.$text["create"].'
<br><br><br><br></SMALL></TD></TD></TR><br>';
}
else
{
$cont='<TR><TD rowSpan=6><IMG height=152 width=1 src="'.$img_base.'pixel.gif"><TD align=Center><SMALL class=error>
'.$text["acc"].'<br><strong>'.$username.'</strong><br>'.$text["failed"].'
<br><br><br><br></SMALL></TD></TD></TR><br>';
}
}
$realm_db->close();
unset($realm_db);
}
function make_players_array(){
global $host, $user, $password, $db, $database_encoding, $pl_array;
$i=0;
$ascent_db = new DBLayer($host, $user, $password, $db);
$ascent_db->query("SET NAMES $database_encoding");
$query = $ascent_db->query("SELECT * FROM `characters` WHERE `online`='1' ORDER BY `name`");
while($result = $ascent_db->fetch_assoc($query))
{
$char_data = ($result['level']);
$char_gender = ($result['gender']);
//$res_pos=get_zone_name($result['mapId'], $result['positionX'], $result['positionY']);
$pl_array[$i] = Array($result['name'], $result['race'], $result['class'], $char_data, $res_pos, $char_gender);
$i++;
}
$ascent_db->close();
unset($ascent_db);
return $i;
}
$onlineplayers=make_players_array();
if (!$sort = &$_GET['s']) $sort=0;
if (!$flag = &$_GET['f']) $flag=0;
if ($flag==0) { $flag=1; $sort_type='<'; }
else { $flag=0; $sort_type='>'; }
$link=$_SERVER['PHP_SELF']."?f=".$flag."&s=";
if (!empty($pl_array))
{
usort($pl_array, create_function('$a, $b', 'if ( $a['.$sort.'] == $b['.$sort.'] ) return 0; if ( $a['.$sort.'] '.$sort_type.' $b['.$sort.'] ) return -1; return 1;'));
}
$list="";
$i=0;
while ($i < $onlineplayers)
{
$name=$pl_array[$i][0];
$race=$pl_array[$i][1];
$class=$pl_array[$i][2];
$res_race = $def['character_race'][$race];
$res_class = $def['character_class'][$class];
$lvl=$pl_array[$i][3];
$loc=$pl_array[$i][4];
$gender=$pl_array[$i][5];
$list.= "
<tr class=txt>
<td></td>
<td>$name</td>
<td align='center'><img alt=$res_race src='".$img_base.$race."-$gender.gif' height='18' width='18'></td>
<td align='center'><img alt=$res_class src='".$img_base."$class.gif' height='18' width='18'></td>
<td align='center'>$lvl</td>
<td >$loc</td>
</tr>";
$i++;
}
if (test_realm())
{
$title.=(' ('.$onlineplayers.' '.$text["playerson"].')');
} else
{
$title.=(' '.$text["off"]);
}
// Main part !!!
?>
<HTML><HEAD><META HTTP-EQUIV="Pragma" CONTENT="no-cache"><TITLE>wowlord</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1251"><LINK
id=bnetstyle href="<?php print $img_base ?>style.css" type=text/css
rel=stylesheet>
<SCRIPT language=javascript>
<!--
var styleSheet;
var agt = navigator.userAgent.toLowerCase();
var appVer = navigator.appVersion.toLowerCase();
var verInt = parseInt(appVer);
var ie = (appVer.indexOf('msie') != -1);
var opera = (agt.indexOf('opera') != -1);
var mozilla = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('opera')==-1)
&& (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1)
&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var ns4 = (mozilla && (verInt == 4));
if (ie && !opera) {
document.styleSheets["bnetstyle"].addRule ("input", "background-color: #040D1A");
document.styleSheets["bnetstyle"].addRule ("input", "border-style: solid");
document.styleSheets["bnetstyle"].addRule ("input", "border-width: 1px");
document.styleSheets["bnetstyle"].addRule ("input", "border-color: #7F7F7F");
document.styleSheets["bnetstyle"].addRule ("input", "color: #FFAC04");
document.styleSheets["bnetstyle"].addRule ("textarea", "background-color: #040D1A");
document.styleSheets["bnetstyle"].addRule ("textarea", "border-style: solid");
document.styleSheets["bnetstyle"].addRule ("textarea", "border-width: 1px");
document.styleSheets["bnetstyle"].addRule ("textarea", "border-color: #7F7F7F");
document.styleSheets["bnetstyle"].addRule ("textarea", "color: #FFAC04");
document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-Base-Color: #012158");
document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-Arrow-Color: #7F7F7F");
document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-3dLight-Color: #7F7F7F");
document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-DarkShadow-Color: black");
document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-Highlight-Color: black");
document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-Shadow-Color: #00B3FF");
document.styleSheets["bnetstyle"].addRule ("select", "background-color: #040D1A");
document.styleSheets["bnetstyle"].addRule ("select", "color: #FFAC04");
document.styleSheets["bnetstyle"].addRule ("select.gray", "background-color: #040D1A");
document.styleSheets["bnetstyle"].addRule ("select.gray", "color: #FFAC04");
document.styleSheets["bnetstyle"].addRule ("ul.thread", "margin-left: 22px;");
}
//-->
</SCRIPT>
</HEAD>
<BODY text=#cccc99 vLink=#aaaaaa link=#ffffbb bgColor=#000000 leftMargin=0
topMargin=0 marginheight="0" marginwidth="0">
<FORM name=login_form method=post>
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD align=middle>
<TABLE cellSpacing=0 cellPadding=0 background="<?php print $img_base ?>back_create.jpg" border=0 style="background-repeat: no-repeat;">
<TBODY>
<TR>
<TD vAlign=top>
<DIV style="POSITION: relative">
<DIV
style="LEFT: 130px; WIDTH: 400px; POSITION: absolute; TOP: 0px"></DIV></DIV></TD>
<TD><IMG height=169 src="<?php print $img_base ?>pixel.gif"
width=1></TD>
<TD></TD></TR>
<TR>
<TD><IMG height=1 src="<?php print $img_base ?>pixel.gif"
width=203></TD>
<TD>
<TABLE cellSpacing=0 cellPadding=0 width=220 border=0>
<TBODY>
<?php print $cont ?></TBODY></TABLE></TD>
<TD><IMG height=1 src="<?php print $img_base ?>pixel.gif"
width=217></TD></TR>
<TR>
<TD colSpan=3>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD colSpan=3><IMG height=17
src="<?php print $img_base ?>pixel.gif" width=1></TD></TR>
<TR>
<TD width=106><IMG height=1
src="<?php print $img_base ?>pixel.gif" width=106></TD>
<TD width=410 align="center"><SMALL>
Realmlist:</font><br />
main.wowlord.com<br />
<br />
<font color= #468ba5 >Accepted Client(s):</font><br />
<font color="white">2.1.X-2.2.X<br />
<br />
<font color="white">[</font><a href="http://www.wowlord.com/"> <font color="#468ba5">Home</font> </a><font color="white">]</font>
<font color="white">[</font><a href="http://forums.wowlord.com/"> <font color="#468ba5">Forums</font> </a><font color="white">]</font><br />
<br /><br />
<font color="red">You have to choose the country where you are living,for it is easy for you to find your compatriots and make friends all over the world.Once you choose your country name,it will attach to your character.If you are one patriot,you should do that.Just for fun!</SMALL></TD>
<TD width=124><IMG height=1
src="<?php print $img_base ?>pixel.gif" width=124></TD></TR>
<TR>
<TD colSpan=3><IMG height=100
src="<?php print $img_base ?>pixel.gif"
width=1></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></FORM></BODY></HTML>
[/code] |
|