Metin2 Bilinmesi Gereken Php Kodlar?
Anlat?m: A?a??da Belirttigim Kodlar? �nce Bir Metin Belgesi A�?yoruz Ve Yap??t?r?yoruz Sonra Metin Belgesini index.php olarak kaydediyoruz ve ?smini de?i?iyoruz ve Siteye at?yoruz
Karakter Say?s?
Kullan?c? Id Ve Hesap Say?s?
?tem Say?s?
Lonca Say?s?
[quoteinclude("config.php");
mysql_connect($dbhost$dbuser$dbpass);
mysql_select_db("player");
$guilds ="SELECT * FROM guild";
$guildsquery = mysql_query($guilds);
$guildanzahl = mysql_num_rows ($guildsquery);
echo "Gilden : $guildanzahl";
Karakter Say?s?
include("config.php");
mysql_connect($dbhost$dbuser$dbpass);
mysql_select_db("player");
$chars = "SELECT * from player";
$charsquery = mysql_query($chars);
$charszahl = mysql_num_rows($charsquery);
echo "Charaktere : $charanzahl";
mysql_connect($dbhost$dbuser$dbpass);
mysql_select_db("player");
$chars = "SELECT * from player";
$charsquery = mysql_query($chars);
$charszahl = mysql_num_rows($charsquery);
echo "Charaktere : $charanzahl";
Kullan?c? Id Ve Hesap Say?s?
include("config.php");
mysql_connect($dbhost$dbuser$dbpass);
mysql_select_db("account");
$accs = "SELECT * from account";
$accsquery = mysql_query($accs);
$accszahl = mysql_num_rows($accsquery);
echo "Account : $accszahl";
mysql_connect($dbhost$dbuser$dbpass);
mysql_select_db("account");
$accs = "SELECT * from account";
$accsquery = mysql_query($accs);
$accszahl = mysql_num_rows($accsquery);
echo "Account : $accszahl";
?tem Say?s?
include("config.php");
mysql_connect($dbhost$dbuser$dbpass);
mysql_select_db("player");
$items = "SELECT * FROM item ";
$itemsquery = mysql_query($items);
$itemanzahl = mysql_num_rows($itemsquery);
echo "Items : $itemanzahl";
mysql_connect($dbhost$dbuser$dbpass);
mysql_select_db("player");
$items = "SELECT * FROM item ";
$itemsquery = mysql_query($items);
$itemanzahl = mysql_num_rows($itemsquery);
echo "Items : $itemanzahl";
Lonca Say?s?
[quoteinclude("config.php");
mysql_connect($dbhost$dbuser$dbpass);
mysql_select_db("player");
$guilds ="SELECT * FROM guild";
$guildsquery = mysql_query($guilds);
$guildanzahl = mysql_num_rows ($guildsquery);
echo "Gilden : $guildanzahl";
Online Karakter Ve Oyuncular
<?php
echo "<center>";
include('inc/config.php'); // Connect to DB
mysql_select_db('player'); // Select DB 'player'
$test = "SELECT * from player";
$testquery = mysql_query($test);
$num2 = mysql_num_rows($testquery);
if($_GET['max']) {
$get = $_GET['max'];
} else {
$get = '0';
$max = $get + 20;
$max2 = $get - 20;
if($get > $num2) {
}
elseif($get >= 20 && $get < $num2) { }
elseif ($num2 <= 20) { echo ""; }
else { }
echo "</center><br>";
?>
<center><table border="0">
<tr>
<th width="150">Sira</th>
<th width="150">Nick</th>
<th width="150">Level</th>
<th width="150">Exp</th>
<th width="150">Bayrak</th>
</tr>
</table></center>
<?php
include('inc/config.php'); // Connect to DB
mysql_select_db('player'); // Select DB 'player'
// Select player etc from db //
$rank = "SELECT * from player WHERE name NOT LIKE '[GA]%' and name NOT LIKE '[GM]%' order by level desc limit 10";
$query = mysql_query($rank);
echo "<center><table border=\"0\">"; // Open table
$i = 0;
while($array = mysql_fetch_array($query)) {
$i = $i + 1;
echo "
<tr>
<th width=\"150\"><font color=\"black\">" . $i . "</font></th>
<th width=\"150\"><font color=\"black\">" . $array["name"] . "</font></th>
<th width=\"150\"><font color=\"black\">" . $array["level"] . "</font></th>
<th width=\"150\"><font color=\"black\">" . $array["exp"] . "</font></th>";
$reich = "SELECT empire from player_index where id = " . $array[account_id] . "";
$query2 = mysql_query($reich);
$array2 = mysql_fetch_array($query2);
if($array2["empire"] == 1) {
echo "<th width=\"150\"><img src=\"http://www.elitepvpers.de/forum/images/red.jpg\"></th></tr>";
} elseif($array2["empire"] == 2) {
echo "<th width=\"150\"><img src=\"http://www.elitepvpers.de/forum/images/yellow.jpg\"></th></tr>";
} else {
echo "<th width=\"150\"><img src=\"http://www.elitepvpers.de/forum/images/blue.jpg\"></th></tr>";
}
}
echo "</table></center><br>"; // close table
}
?>
echo "<center>";
include('inc/config.php'); // Connect to DB
mysql_select_db('player'); // Select DB 'player'
$test = "SELECT * from player";
$testquery = mysql_query($test);
$num2 = mysql_num_rows($testquery);
if($_GET['max']) {
$get = $_GET['max'];
} else {
$get = '0';
$max = $get + 20;
$max2 = $get - 20;
if($get > $num2) {
}
elseif($get >= 20 && $get < $num2) { }
elseif ($num2 <= 20) { echo ""; }
else { }
echo "</center><br>";
?>
<center><table border="0">
<tr>
<th width="150">Sira</th>
<th width="150">Nick</th>
<th width="150">Level</th>
<th width="150">Exp</th>
<th width="150">Bayrak</th>
</tr>
</table></center>
<?php
include('inc/config.php'); // Connect to DB
mysql_select_db('player'); // Select DB 'player'
// Select player etc from db //
$rank = "SELECT * from player WHERE name NOT LIKE '[GA]%' and name NOT LIKE '[GM]%' order by level desc limit 10";
$query = mysql_query($rank);
echo "<center><table border=\"0\">"; // Open table
$i = 0;
while($array = mysql_fetch_array($query)) {
$i = $i + 1;
echo "
<tr>
<th width=\"150\"><font color=\"black\">" . $i . "</font></th>
<th width=\"150\"><font color=\"black\">" . $array["name"] . "</font></th>
<th width=\"150\"><font color=\"black\">" . $array["level"] . "</font></th>
<th width=\"150\"><font color=\"black\">" . $array["exp"] . "</font></th>";
$reich = "SELECT empire from player_index where id = " . $array[account_id] . "";
$query2 = mysql_query($reich);
$array2 = mysql_fetch_array($query2);
if($array2["empire"] == 1) {
echo "<th width=\"150\"><img src=\"http://www.elitepvpers.de/forum/images/red.jpg\"></th></tr>";
} elseif($array2["empire"] == 2) {
echo "<th width=\"150\"><img src=\"http://www.elitepvpers.de/forum/images/yellow.jpg\"></th></tr>";
} else {
echo "<th width=\"150\"><img src=\"http://www.elitepvpers.de/forum/images/blue.jpg\"></th></tr>";
}
}
echo "</table></center><br>"; // close table
}
?>
Kay?t Ol
<body>
<div id="Felder">
<form action="regi.php" method="post" >
Kullanici Adi<br />
<input type="text" name="username" size="30" /><br />
Sifre<br />
<input type="password" name="passwd" size="30" /><br />
Sifre Tekrar<br />
<input type="password" name="passwd2" size="30" /><br />
Gercek Adiniz<br />
<input type="text" name="rl_name" size="30" /><br />
Email<br />
<input type="text" name="email" size="30" /><br />
Löschcode<br />
<input type="text" maxlength="7" name="social_id" size="30" /><br />
<br />
<input type="submit" name="submit" value="Kayit ol" />
</form>
</div>
</body>
</html>
<?php
include('config.php');
if(isset($_POST['submit']) && $_POST['submit'] == 'Register') {
$username = mysql_real_escape_string($_POST['username']);
$passwd = mysql_real_escape_string($_POST['passwd']);
$passwd2 = mysql_real_escape_string($_POST['passwd2']);
$rl_name = mysql_real_escape_string($_POST['rl_name']);
$email = mysql_real_escape_string($_POST['email']);
$social_id = mysql_real_escape_string($_POST['social_id']);
if($passwd == $passwd2) {
$sql = "INSERT INTO account SET login = '".$username."' password = PASSWORD('".$passwd."') real_name = '".$rl_name."' email = '".$email."' social_id = '".$social_id."'";
$result = mysql_query($sql);
if($result) { echo "<font color=\"green\"><b>Hesap Basariyla Olusturuldu!</b></font>"; } else { echo "<font color=\"red\"><b>Kayit Basarisiz!!lutfen tekrar deneyin!</b></font>"; }
}
}
?>
<div id="Felder">
<form action="regi.php" method="post" >
Kullanici Adi<br />
<input type="text" name="username" size="30" /><br />
Sifre<br />
<input type="password" name="passwd" size="30" /><br />
Sifre Tekrar<br />
<input type="password" name="passwd2" size="30" /><br />
Gercek Adiniz<br />
<input type="text" name="rl_name" size="30" /><br />
Email<br />
<input type="text" name="email" size="30" /><br />
Löschcode<br />
<input type="text" maxlength="7" name="social_id" size="30" /><br />
<br />
<input type="submit" name="submit" value="Kayit ol" />
</form>
</div>
</body>
</html>
<?php
include('config.php');
if(isset($_POST['submit']) && $_POST['submit'] == 'Register') {
$username = mysql_real_escape_string($_POST['username']);
$passwd = mysql_real_escape_string($_POST['passwd']);
$passwd2 = mysql_real_escape_string($_POST['passwd2']);
$rl_name = mysql_real_escape_string($_POST['rl_name']);
$email = mysql_real_escape_string($_POST['email']);
$social_id = mysql_real_escape_string($_POST['social_id']);
if($passwd == $passwd2) {
$sql = "INSERT INTO account SET login = '".$username."' password = PASSWORD('".$passwd."') real_name = '".$rl_name."' email = '".$email."' social_id = '".$social_id."'";
$result = mysql_query($sql);
if($result) { echo "<font color=\"green\"><b>Hesap Basariyla Olusturuldu!</b></font>"; } else { echo "<font color=\"red\"><b>Kayit Basarisiz!!lutfen tekrar deneyin!</b></font>"; }
}
}
?>
Online Stat�s
not: bunun �ali?masi i�in panelin bulundugu dosyaya
img adinda klas�r olusturun.
ve i�ine 2 adet kirmizi ok ve ye?il ol ekleyin.
kirmizi okun adi : img/offline.gif
ye?il okun adi : img/online.gif
olsun. sonra �ali?ir.
$serverip = "eure_server_ip";
$ip = gethostbyname($serverip);
$portlist=array(330611003 13000 ); // serverinizin portlarini girin
$status=array("Login Server" "Char Server" "World Server"); // port adlarini girin
$i=0;
foreach ($portlist as $port){
echo "".$status[$i]."";
$online = @fsockopen($ip $port $errno $errstr 1);
if (!$online)
{
echo "<td><img src=img/offline.gif width=16 height=12 /></td>"; #
}
else
{
echo "<td><img src=img/online.gif width=16 height=12 /></td>";
}
@fclose($online);
$i++;
}
$ip = gethostbyname($serverip);
$portlist=array(330611003 13000 ); // serverinizin portlarini girin
$status=array("Login Server" "Char Server" "World Server"); // port adlarini girin
$i=0;
foreach ($portlist as $port){
echo "".$status[$i]."";
$online = @fsockopen($ip $port $errno $errstr 1);
if (!$online)
{
echo "<td><img src=img/offline.gif width=16 height=12 /></td>"; #
}
else
{
echo "<td><img src=img/online.gif width=16 height=12 /></td>";
}
@fclose($online);
$i++;
}
Panelden Oyuna Reboot Atma (admin cp'ye eklenmelidir
<?php
$IP = "EUERE IP HIER EINTRAGEN";
//Port = $_GET['port'];
//$Port = "";
$Port = "EUEREN PORT HIER EINTRAGEN";
if($IP && $Port)
{
$socket = socket_create (AF_INET SOCK_STREAM SOL_TCP);
$result = socket_connect ($socket $IP $Port);
$query = "\x40SHOWMETHEMONEY\x0A";
$query .= "\x40RELOAD a\x0A";
//$query .= $_GET['query'];
$query_size = strlen($query);
$write_res = socket_write($socket $query $query_size);
$recv_res = socket_recv($socket $output 5056 0);
echo $output;
socket_close($socket);
}
?>
$IP = "EUERE IP HIER EINTRAGEN";
//Port = $_GET['port'];
//$Port = "";
$Port = "EUEREN PORT HIER EINTRAGEN";
if($IP && $Port)
{
$socket = socket_create (AF_INET SOCK_STREAM SOL_TCP);
$result = socket_connect ($socket $IP $Port);
$query = "\x40SHOWMETHEMONEY\x0A";
$query .= "\x40RELOAD a\x0A";
//$query .= $_GET['query'];
$query_size = strlen($query);
$write_res = socket_write($socket $query $query_size);
$recv_res = socket_recv($socket $output 5056 0);
echo $output;
socket_close($socket);
}
?>
evet arkada?lar ?imdi bunlari hazirladik bize lazim olan bunlari �ali?tirmak i�in
config.php olusturmak olucak
buyrun onlarida hazirliyalim
<?php
$dbhost = "serverip"; //Serverinizin ipi
$dbuser = "root"; //root �le kalsin
$dbpass = "navicat ?ifre"; //navicat ?ifreniz
$mysql_db = "account";
?>
$dbhost = "serverip"; //Serverinizin ipi
$dbuser = "root"; //root �le kalsin
$dbpass = "navicat ?ifre"; //navicat ?ifreniz
$mysql_db = "account";
?>
Not :
siralama i�in yukarda g�rd�?�n�z yerin en altina birde bu kodu ekleyin.
mysql_select_db("player");
?ifre De?i?tirme Paneli Kodu Arkada?lar Bazen �al??m?o Kusara Bakmay?n
<body bgcolor="black"><br>
<div id="info">
<?php
function DeCode($string,$operation,$key='')
{
$key=md5($key);
$key_length=strlen($key);
$string=$operation=='D'?base64_decode($string):substr(md5($string.$key),0,8).$string;
$string_length=strlen($string);
$rndkey=$box=array();
$result='';
for($i=0;$i<=255;$i++)
{
$rndkey[$i]=ord($key[$i%$key_length]);
$box[$i]=$i;
}
for($j=$i=0;$i<256;$i++)
{
$j=($j+$box[$i]+$rndkey[$i])%256;
$tmp=$box[$i];
$box[$i]=$box[$j];
$box[$j]=$tmp;
}
for($a=$j=$i=0;$i<$string_length;$i++)
{
$a=($a+1)%256;
$j=($j+$box[$a])%256;
$tmp=$box[$a];
$box[$a]=$box[$j];
$box[$j]=$tmp;
$result.=chr(ord($string[$i])^($box[($box[$a]+$box[$j])%256]));
}
if($operation=='D')
{
if(substr($result,0,8)==substr(md5(substr($result,8).$key),0,8))
{
return substr($result,8);
}
else
{
return'';
}
}
else
{
return str_replace('=','',base64_encode($result));
}
}
?>
<?php
$action=$_POST["action"];
switch ($action){
case "send":
send();
break;
default:
change();
break;
}
function change(){
?>
<table width="621" height="200" border="0">
<tr>
<tbody>
<tr>
<td width="466" height="200" align=middle valign=top>
<form method=post name=chgform action="sifredegis2.php">
<input type="hidden" name="action" value="send" />
<table border=0 cellpadding=0 cellspacing=0 width=466>
<tbody>
<tr>
<td width="700"><br>
<b><font size="3"></font><span class="style1"></span></td>
</tr>
<tr>
<td height=1><img height=1 src="" width=300></td>
</tr>
<tr>
<td align=right>
<div align="left"></div>
<table align=center border=0 cellpadding=5 cellspacing=1 width="425">
<tbody>
<tr>
<td align=right class=txt_gray colspan=2>
<div align=left></div> </td>
</tr>
<tr align="left" valign="middle">
<td class=txt_gray width="184" height="32">
<div align=left><font color="#FFFFFF">Kullanici Adi:</div></font> </td>
<td class=txt_gray width="218" height="32">
<input maxlength=16 name=UserID size=17>
<div align=center></div> </td>
</tr>
<tr align="left" valign="middle">
<td class=txt_gray width="184"><font color="#FFFFFF">Karakter Silme Kodu:</font></td>
<td class=txt_gray width="218">
<input maxlength=7 name=srcno size=7> </td>
</tr>
<tr align="left" valign="middle">
<td class=txt_gray width="184"><font color="#FFFFFF">Gizli Soru:</font></td>
<td class=txt_gray width="218">
<select name="Ques" class="inputbox2">
<option value="Soru Sec">Soru Se�</option>
<option value="Wie ist der Name deines Haustieres?">Ad?n</option>
</select> </td>
</tr>
<tr align="left" valign="middle">
<td class=txt_gray width="184"><span style="width:120px; float:left;"><font color="#FFFFFF">Gizli Yanit:</font></span></td>
<td class=txt_gray width="218">
<input name=Answ type=text id="Answ" size=30 maxlength=30> </td>
</tr>
</tbody>
</table>
<div align="left"></div> </td>
</tr>
<tr>
<td height=2><img height=1 src=""
width=466></td>
</tr>
</tbody>
</table>
<div align="center"><br>
<a
href="javascript:document.chgform.submit()"><img border=0 src="http://www.turkmmo.com/images/bt_confirm.gif" width="79" height="32"></a>
<br>
</div>
</form> </td>
</tr>
</tbody>
</table>
<div align="left"></div> </td>
</tr>
</table>
</body>
</html>
<?php
}
function send(){
$UserID=$_POST["UserID"];
$srcno=$_POST["srcno"];
$Ques=DeCode($_POST["Ques"],'E','daichao');
$Answ=DeCode($_POST["Answ"],'E','daichao');
if (strlen($UserID) < 1 || strlen($srcno) < 1 || strlen($Ques) < 1 || strlen($Answ) < 1 ) {
echo "Check Deine Eingaben<a href=\"javascript:history.back();\"> Zurueck</a>";
}else{
require_once("conn.php");
mysql_select_db("account");
$exec="select social_id,Question1,Answer1 from account where Login='$UserID' and social_id='$srcno' and Question1='$Ques' and Answer1='$Answ'";
mysql_query("set names big5 ");
mysql_query("set CHARACTER big5 ");
$result=mysql_query($exec);
$rs=mysql_fetch_object($result);
echo mysql_error();
if($rs){
$exec="update account set Password=password('888888') where Login='$UserID'";
mysql_query($exec);
$exec="update player.safebox set password='888' where account_id=(select id from account.account where login='$UserID')";
mysql_query($exec);
//echo $exec;
//echo mysql_error();
echo "Dein Neues Passwort ist: 888888<a href=\"index.html\"";exit;
}else{
echo "Checke Deine Eingaben<a href=\"javascript:history.back();\"";exit;
}
}
}
?>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<div id="info">
<?php
function DeCode($string,$operation,$key='')
{
$key=md5($key);
$key_length=strlen($key);
$string=$operation=='D'?base64_decode($string):substr(md5($string.$key),0,8).$string;
$string_length=strlen($string);
$rndkey=$box=array();
$result='';
for($i=0;$i<=255;$i++)
{
$rndkey[$i]=ord($key[$i%$key_length]);
$box[$i]=$i;
}
for($j=$i=0;$i<256;$i++)
{
$j=($j+$box[$i]+$rndkey[$i])%256;
$tmp=$box[$i];
$box[$i]=$box[$j];
$box[$j]=$tmp;
}
for($a=$j=$i=0;$i<$string_length;$i++)
{
$a=($a+1)%256;
$j=($j+$box[$a])%256;
$tmp=$box[$a];
$box[$a]=$box[$j];
$box[$j]=$tmp;
$result.=chr(ord($string[$i])^($box[($box[$a]+$box[$j])%256]));
}
if($operation=='D')
{
if(substr($result,0,8)==substr(md5(substr($result,8).$key),0,8))
{
return substr($result,8);
}
else
{
return'';
}
}
else
{
return str_replace('=','',base64_encode($result));
}
}
?>
<?php
$action=$_POST["action"];
switch ($action){
case "send":
send();
break;
default:
change();
break;
}
function change(){
?>
<table width="621" height="200" border="0">
<tr>
<tbody>
<tr>
<td width="466" height="200" align=middle valign=top>
<form method=post name=chgform action="sifredegis2.php">
<input type="hidden" name="action" value="send" />
<table border=0 cellpadding=0 cellspacing=0 width=466>
<tbody>
<tr>
<td width="700"><br>
<b><font size="3"></font><span class="style1"></span></td>
</tr>
<tr>
<td height=1><img height=1 src="" width=300></td>
</tr>
<tr>
<td align=right>
<div align="left"></div>
<table align=center border=0 cellpadding=5 cellspacing=1 width="425">
<tbody>
<tr>
<td align=right class=txt_gray colspan=2>
<div align=left></div> </td>
</tr>
<tr align="left" valign="middle">
<td class=txt_gray width="184" height="32">
<div align=left><font color="#FFFFFF">Kullanici Adi:</div></font> </td>
<td class=txt_gray width="218" height="32">
<input maxlength=16 name=UserID size=17>
<div align=center></div> </td>
</tr>
<tr align="left" valign="middle">
<td class=txt_gray width="184"><font color="#FFFFFF">Karakter Silme Kodu:</font></td>
<td class=txt_gray width="218">
<input maxlength=7 name=srcno size=7> </td>
</tr>
<tr align="left" valign="middle">
<td class=txt_gray width="184"><font color="#FFFFFF">Gizli Soru:</font></td>
<td class=txt_gray width="218">
<select name="Ques" class="inputbox2">
<option value="Soru Sec">Soru Se�</option>
<option value="Wie ist der Name deines Haustieres?">Ad?n</option>
</select> </td>
</tr>
<tr align="left" valign="middle">
<td class=txt_gray width="184"><span style="width:120px; float:left;"><font color="#FFFFFF">Gizli Yanit:</font></span></td>
<td class=txt_gray width="218">
<input name=Answ type=text id="Answ" size=30 maxlength=30> </td>
</tr>
</tbody>
</table>
<div align="left"></div> </td>
</tr>
<tr>
<td height=2><img height=1 src=""
width=466></td>
</tr>
</tbody>
</table>
<div align="center"><br>
<a
href="javascript:document.chgform.submit()"><img border=0 src="http://www.turkmmo.com/images/bt_confirm.gif" width="79" height="32"></a>
<br>
</div>
</form> </td>
</tr>
</tbody>
</table>
<div align="left"></div> </td>
</tr>
</table>
</body>
</html>
<?php
}
function send(){
$UserID=$_POST["UserID"];
$srcno=$_POST["srcno"];
$Ques=DeCode($_POST["Ques"],'E','daichao');
$Answ=DeCode($_POST["Answ"],'E','daichao');
if (strlen($UserID) < 1 || strlen($srcno) < 1 || strlen($Ques) < 1 || strlen($Answ) < 1 ) {
echo "Check Deine Eingaben<a href=\"javascript:history.back();\"> Zurueck</a>";
}else{
require_once("conn.php");
mysql_select_db("account");
$exec="select social_id,Question1,Answer1 from account where Login='$UserID' and social_id='$srcno' and Question1='$Ques' and Answer1='$Answ'";
mysql_query("set names big5 ");
mysql_query("set CHARACTER big5 ");
$result=mysql_query($exec);
$rs=mysql_fetch_object($result);
echo mysql_error();
if($rs){
$exec="update account set Password=password('888888') where Login='$UserID'";
mysql_query($exec);
$exec="update player.safebox set password='888' where account_id=(select id from account.account where login='$UserID')";
mysql_query($exec);
//echo $exec;
//echo mysql_error();
echo "Dein Neues Passwort ist: 888888<a href=\"index.html\"";exit;
}else{
echo "Checke Deine Eingaben<a href=\"javascript:history.back();\"";exit;
}
}
}
?>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
Hiç yorum yok :
Yorum Gönder