Przedszkolak
Postów: 19 Ostrzeżeń: 4
Data rejestracji: 06.12.2008 15:14
Złamana licencja
|
Witam jak umieścić rozbudowane skrypty w podstronie?
Chciałbym umieśic taki skrypt:
<?php
/*
(c) 2008 Welshtotem at AC Web and Kitty at WoWPS
*/
define('roSSECURE',true); // tested in configuration file - change
define('CFG_FILE', "configuration.php"); // configuration file - change name
require_once(CFG_FILE); // main configuration - included must be first, becouse there is defined variable $lang used in lang.php
require_once('lang.php'); // translations + contains function to write log, do not remove!
include_once('dblayer.php');// database manipulating class (methods)
$realm_up = 0; // is realm up?
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_account_c($name = '')
{
global $hostr, $userr, $passwordr, $dbr, $database_encoding, $text;
$result = array();
$realm_db = new DBLayer($hostr, $userr, $passwordr, $dbr, $text);
$realm_db->query("SET NAMES ".$database_encoding);
$query = $realm_db->query("SELECT * FROM `account` WHERE `username`='".$name."'");
if ($query)
$result = $realm_db->fetch_assoc($query);
$realm_db->close();
unset($realm_db);
return ($result['username']);
}
function get_realm_uptime() {
global $host, $user, $password, $db, $database_encoding, $text;
$mangos_db = new DBLayer($host, $user, $password, $db, $text);
$mangos_db->query("SET NAMES ".$database_encoding);
$query = $mangos_db->query("SELECT * FROM `uptime` ORDER BY `starttime` DESC");
$result = $mangos_db->fetch_assoc($query);
$mangos_db->close();
unset($mangos_db);
return($result['starttime']);
}
function check_email($email = '')
{
global $cfg_mail_need;
$pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$";
if (!$cfg_mail_need)
return 1;
if (strlen($email) < 6)
return 0;
if (!eregi($pattern, $email))
return 0;
return 1;
}
if (empty($_POST['username']) and empty($_POST['passw']) and empty($_POST['email']))
{
$cont='<TR>
<TD><IMG src="'.$img_base.'pixel.gif" width=25 alt="">
</TD>
<TD vAlign=middle align=left>
<div
style="FONT-SIZE: 8pt; COLOR: white; LETTER-SPACING: 3px; FONT-VARIANT: small-caps">
<LABEL>'.$text["name"].':</LABEL>
</div>
<INPUT class="old" id=username style="WIDTH: 175px" tabIndex=1 maxLength=16 size=18 name=username>
</TD>
<TD><IMG src="'.$img_base.'pixel.gif" width=1 alt="">
</TD>
</TR>
<TR>
<TD> </td>
<TD vAlign=middle align=left width=190>
<div style="FONT-SIZE: 8pt; COLOR: white; LETTER-SPACING: 3px; FONT-VARIANT: small-caps">
<LABEL>'.$text["password"].':</LABEL>
</div>
<INPUT class="old" id=passw style="WIDTH: 175px" tabIndex=2 type=password maxLength=12 size=18 name=passw>
</TD>
<TD> </td>
</TR>
<TR>
<TD> </td>
<TD vAlign=middle align=left width=190>
<DIV style="FONT-SIZE: 8pt; COLOR: white; LETTER-SPACING: 3px; FONT-VARIANT: small-caps">
<LABEL>'.$text["tbc"].':</LABEL>
</div>
<select size="1" name="tbc">
<option selected value="2">Burning Crusade</option>
<option value="1">Classic WoW</option>
<option value="2">The Lich King</option>
</select>
</TD>
<TD> </td>
</TR>
<TR>
<TD> </td>
<TD vAlign=middle align=left width=190>
<div style="FONT-SIZE: 8pt; COLOR: white; LETTER-SPACING: 3px; FONT-VARIANT: small-caps">
<LABEL>E-mail: '.($cfg_mail_need?'':('('.$text['label_optional'].')')).'</LABEL>
</div>
<INPUT class="old" id=email style="WIDTH: 175px" tabIndex=4 maxLength=50 size=18 name=email>
</TD>
<TD> </td>
</TR>
<TR>
<TD> </td>
<TD colspan=2 align=left>
<INPUT class=button
style="WIDTH: 168px; HEIGHT: 39px" tabIndex=5 type=image
alt="Create" src="'.$img_base.$button.'"
value="Create">
</TD>
</TR>';
}
elseif (empty($_POST['username']) or empty($_POST['passw']) or ($cfg_mail_need && empty($_POST['email'])) )
{
$cont = '
<TR>
<TD rowSpan=6><IMG width=1 src="'.$img_base.'pixel.gif" alt="">
</TD>
<TD align=Center>
<SMALL class=error>'.$text["not_all"].'<br><br><a href="" onClick="history.go(-1)">'.$text["backtext"].'</a>
</SMALL>
</TD>
</TR>';
}
else
{
$username = htmlspecialchars(trim($_POST['username']));
$passw = trim($_POST['passw']);
$email = htmlspecialchars(trim($_POST['email']));
$tbc = trim($_POST['tbc']);
$ip = $_SERVER['REMOTE_ADDR'];
if (!check_email($email)) { // bad format!
$cont='<TR><TD rowSpan=6><IMG width=1 src="'.$img_base.'pixel.gif" alt=""></TD><TD align=Center><SMALL class=error>
'.$text['bad_email'].'<br><br><a href="" onClick="history.go(-1)">'.$text["backtext"].'</a></SMALL></TD></TR>';
}
else if (!strcasecmp($username, $passw)) { // same strings!
$cont='<TR><TD rowSpan=6><IMG width=1 src="'.$img_base.'pixel.gif" alt=""></TD><TD align=Center><SMALL class=error>
'.$text['same_strings'].'<br><br><a href="" onClick="history.go(-1)">'.$text["backtext"].'</a></SMALL></TD></TR>';
}
else if (strlen($username) < 4 || strlen($passw) < 4) { // too short!!!
$cont='<TR><TD rowSpan=6><IMG width=1 src="'.$img_base.'pixel.gif" alt=""></TD><TD align=Center><SMALL class=error>
'.$text['short_strings'].'<br><br><a href="" onClick="history.go(-1)">'.$text["backtext"].'</a></SMALL></TD></TR>';
}
else {
$realm_db = new DBLayer($hostr, $userr, $passwordr, $dbr, $text);
$realm_db->query("SET NAMES ".$database_encoding);
$ip_cr=0;
if ($lock_reg != 0){
$query = $realm_db->query("SELECT `last_ip` FROM `account` WHERE `last_ip`='".$ip."'");
while($result = $realm_db->fetch_assoc($query)) $ip_cr++;
}
if (($ip_cr >= $lock_reg) && ($lock_reg!=0))
{
write_log("3", $username, "Exceed limit from IP ".$ip);
$cont='<TR><TD rowSpan=6><IMG width=1 src="'.$img_base.'pixel.gif" alt=""></TD><TD align=Center><SMALL class=error>
'.$text["ip_limit"][0].$ip.'<br>'.$lock_reg.$text["ip_limit"][1].'
<br><br><a href="" onClick="history.go(-1)">'.$text["backtext"].'</a></SMALL></TD></TR>';
} else
{
if (empty($email)) $email = "";
if($realm_db->query("INSERT INTO `account` (`username`,`sha_pass_hash`,`email`,`last_ip`,`locked`,`tbc`) VALUES (UPPER('".$username."'),SHA1(CONCAT(UPPER('".$username."'),':',UPPER('".$passw."'))),'".$email."','".$ip."','".$lock_acc."','".$tbc."')"))
{
write_log("3", $username, "");
$cont='<TR><TD rowSpan=6><IMG width=1 src="'.$img_base.'pixel.gif" alt=""></TD><TD align=Center><SMALL>
'.$text["acc"].'<br><strong>'.$username.'</strong><br>'.$text["create"].'<br>
<br><a href="" onClick="history.go(-1)">'.$text["backtext"].'</a>
</SMALL></TD></TR>';
}
else
{
$sqlerr = $realm_db->error();
write_log("4", $username, $sqlerr['error_msg']);
$cont='<TR><TD rowSpan=6><IMG width=1 src="'.$img_base.'pixel.gif" alt=""></TD><TD align=Center><SMALL class=error>
'.$text["acc"].'<br><strong>'.$username.'</strong><br>'.$text["failed"].'
<br><br><a href="" onClick="history.go(-1)">'.$text["backtext"].'</a></SMALL></TD></TR>';
}
}
$realm_db->close();
unset($realm_db);
}
}
$pl_array = make_players_array(0);
$onlineplayers = count($pl_array);
// works nice too
//if (!($sort = &$_GET['s'])) $sort=0;
//if (!($flag = &$_GET['f'])) $flag=0;
$sort=0;
$flag=0;
if (!empty($_GET['s'])) $sort = $_GET['s'];
if (!empty($_GET['f'])) $flag = $_GET['f'];
if ($flag == 0) { $flag = 1 ; $sort_type = '<'; }
else { $flag = 0; $sort_type = '>'; }
$link="index.php?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][5];
$gender=$pl_array[$i][6];
$type=$pl_array[$i][7];
$rank=$pl_array[$i][4];
if(strcasecmp($rank,"01") != 0 and strcasecmp($rank,"00") != 0){
$res_rank = $def['character_rank'][$type][$rank];
}
else{
$res_rank = $text['NoRank'];
}
$list.= "
<tr class=txt>
<td style=\"text-align:left\"><span class=\"txt\" style=\"text-transform:capitalize;\">".strtolower($name)."</span></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'>"."unknown"."</td>
<td style=\"text-align:center\"><img alt=\"".$res_rank."\" src='".$img_base."rank".$rank.".gif' height='18' width='18'></td>
<td style=\"text-align:left\">".$loc."</td>
</tr>";
$i++;
}
$title = get_realm_name();
$copyright = $status = $title;
if ($realm_up = test_realm()) {
$title.= (' ('.$onlineplayers.' '.$text["playerson"].')');
$status = "<img alt=\"Online\" src='".$img_base."online.gif' height='18' width='18'>";
} else {
$title.= (' '.$text["off"] );
$status = "<img alt=\"Offline\" src='".$img_base."offline.gif' height='18' width='18'>";
}
// Main part !!!
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Account Creation</title>
<meta http-equiv="Cache-Control" content="no-cache,must-revalidate">
<meta http-equiv=Content-Type content="text/html; charset=<?php print $charset ?>">
<link href="<?php print $img_base ?>style.css" type="text/css" rel=stylesheet>
<link rel="Shortcut Icon" href="img/wowlogoanim.gif" type="image/gif">
</head>
<body onLoad="onloadTimers();">
<form method=post <?php echo "action=\"index.php?f=".(!$flag)."&s=".$sort."\""; ?> enctype="multipart/form-data">
<table cellSpacing=0 cellPadding=0 width="100%" border=0>
<tbody>
<tr>
<td align=center>
<table align=center cellSpacing=0 cellPadding=0 border=0 style="background-image:url('<?php print $img_base ?>back_create.png');background-repeat:no-repeat;">
<tbody>
<tr>
<td> </td>
<td vAlign=top align=center>
<div style="height:105px;width:250px;border:0px solid;padding-top:50px;">
<img src="<?php print $img_base ?>wowlogo011.png" alt="WoW">
</div>
</td>
<td> </td>
</tr>
<tr>
<td><img src="<?php print $img_base ?>pixel.gif" width=180 alt=""></td>
<td align=center>
<table cellSpacing=2 cellPadding=0 border=0 style="height:210px">
<tbody>
<?php
if($accountoption==1)
{
echo"$cont";
}
else
{
echo "
<TR>
<TD><div>
<div><IMG src=\"".$img_base."exclamation.gif\" alt=\"\"><div>
</div>
<div style=\"margin:5px;\">
<span style=\"font: bold 12px Verdana,Arial,Sans-serif;color:red\">".$text['accountmessage']."</span>
</div>
</TD>
</TR>";
}
?>
</tbody>
</table>
</td>
<td><img height=1 src="<?php print $img_base ?>pixel.gif" width=217 alt="">
</td>
</tr>
<tr>
<td colSpan=3 align=left>
<table cellSpacing=0 cellPadding=0 border=0>
<tbody>
<tr>
<td colSpan=3><img height=17 src="<?php print $img_base ?>pixel.gif" width=1 alt="">
</td>
</tr>
<tr>
<td width=99><img height=1 src="<?php print $img_base ?>pixel.gif" width=99 alt="">
</td>
<td width=410 >
<div style="margin:20px 0;">
<center>
</center>
</div>
<div style="margin:20px 0;">
<div align="justify"><small> </small>
<script type="text/javascript">
new showLocalTime("timecontainer", "server-php", 0, "short")
</script>
</div>
</div>
<!-- ajax table!!! - must be same with ajax table in php --></td>
<td width=124><img height=1 src="<?php print $img_base ?>pixel.gif" width=124 alt="">
</td>
</tr>
<tr>
<td colSpan=3><img height=100 src="<?php print $img_base ?>pixel.gif" width=1 alt="">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
Kliknij i zaczekaj na załadowanie kodu ...
Jest to rejestracja (są do tego osobne pliki config.php i grafika)
jak takie coś umieścić na pod stronie?
Edytowane przez Pieka dnia 30.12.2008 21:42:01
|