29-10-2013, 05:25 PM
|
#1
|
|
• الانـتـسـاب » Mar 2013
|
• رقـم العـضـويـة » 110495
|
• المشـــاركـات » 2,214
|
• الـدولـة » in Dedicated Server
|
• الـهـوايـة » Develop DB&PHP Edit&Fixing Buged Files
|
• اسـم الـسـيـرفـر » Private Server
|
• الـجـنـس » Male
|
• نقـاط التقييم » 61
|
|
|
حصرياااا الـPHP SCRIPTS


اولا : php الـGuild Ranking
[SPOILER]
اقتباس:
function rank_guild() {
$conn=odbc_connect('SRO_VT_SHARD','sa','123465');
if (!$conn)
{exit("Connection Failed: " . $conn);}
$i = '1';
$sql = odbc_exec($conn,"SELECT TOP 10 Name,Lvl,GatheredSP FROM _Guild ORDER BY GatheredSP DESC");
echo '<table>
<tr>
<th>#</th>
<th>Guild Name</th>
<th>Level</th>
<th>XP</th>
</tr>';
while($r = odbc_fetch_array($sql)) {
echo '<tr><td>'.$i++.'</td><td>'.$r[Name].'</td><td>'.$r[Lvl].'</td><td>'.$r[GatheredSP].'</td></tr>';
}
echo '</table>';
}
rank_guild(); //will render ranking !
|
[/SPOILER]
ثانيا : php الـplayer Ranking
[SPOILER]
اقتباس:
function rank_players() {
$conn=odbc_connect('SRO_VT_SHARD','sa','123465');
if (!$conn)
{exit("Connection Failed: " . $conn);}
$i = '1';
$sql = odbc_exec($conn,"SELECT TOP 10 CharName16,MaxLevel,RemainGold FROM _Char WHERE Deleted ='0' ORDER BY MaxLevel DESC");
echo '<table>
<tr>
<th>#</th>
<th>Character Name</th>
<th>Level</th>
<th>Gold</th>
</tr>';
while($r = odbc_fetch_array($sql)) {
echo '<tr><td>'.$i++.'</td><td>'.$r[CharName16].'</td><td>'.$r[MaxLevel].'</td><td>'.$r[RemainGold].'</td></tr>';
}
echo '</table>';
}
rank_players() ; //will render player ranking.
|
[/SPOILER]
تالثا : php الـChange PASS
[SPOILER]
كود PHP:
<?php StrUserID='$username' AND password='$password'");if (isset($_GET['act']) AND $_GET['act'] == "changepass") { function anti_injection($sql) { $sql = preg_replace(sql_regcase("/(from|select|insert|delete|where|'|\"|drop table|show tables|#|\*|--|\\\\)/"),"",$sql); $sql = trim($sql); $sql = strip_tags($sql); $sql = addslashes($sql); return $sql; } $regdate = date("Y-m-d H:i:s"); $newpass=md5($_POST['newpass']); $newpass2=anti_injection($_POST['newpass']); $password=anti_injection($_POST['password2']); $username=anti_injection($_POST['username2']); if (!$_POST['username2'] ) { echo "<script>alert('player name is empty');location.href='pass.php';</script>"; die(); } else if (!$_POST['password2'] ) { echo "<script>alert('E-Mail is empty');location.href='pass.php';</script>"; die(); } else if (!$_POST['newpass'] ) { echo "<script>alert('New Password is empty');location.href='pass.php';</script>"; die(); } $query = odbc_exec($connect, "SELECT StrUserID FROM TB_User WHERE StrUserID='$username' AND StrUserID='$password'"); $checkusername = odbc_num_rows($query); if(($checkusername != 0) and $checkpassword != 0) { odbc_exec($connect,"UPDATE TB_User SET password='$newpass' WHERE StrUserID='$username''")or die("Can't connect the MSSQL server."); echo "<script>alert('Login Pass has been changed! \\nNew Password: $newpass2');location.href='pass.php';</script>"; } else echo "<script>alert('Wrong Player Name/Email entered!');location.href='pass.php';</script>"; die(); } ?>
[/SPOILER]
رابعا : PHP الـReset status points
[SPOILER]
كود PHP:
<?php //check that the user is logged if(!isset($_SESSION)){ session_start(); } if (isset($_SESSION['name'])) { $userID = $_SESSION['name']; } else { echo "<script>location.href='index.php'</script>"; die; } //makesure that the the variable char is present if(!isset($_GET["char"])){ echo "<script>location.href='controlpanel.php'</script>"; die; } /************************************* *convert a date in the format AAAA-MM-DD *into numbers of days passed from 2000-01-01 *************************************/ function date2int($end) { $start="2000-01-01"; $start_ts = strtotime($start); $end_ts = strtotime($end); $diff = $end_ts - $start_ts; return round($diff / 86400); } $titulo="Reset your status points"; require_once("./modules/include/Config.php"); require_once("./modules/include/sqlConn.php"); require_once("./modules/include/Security.php"); $check = new security(); $message = null; if($check->is_secure($_GET['char']) == false) $message[] = ""; if(count($message) > 0) { // char isnt safe echo "<script>location.href='index.php'</script>"; die; } mssql_select_db($dbName1, $dbConn) or die ("Couln't select database $dbName1"); //select the JID from this account $getUserJID = mssql_query("select * from TB_User where StrUserID = '".$_SESSION["name"]."'"); while ($row = mssql_fetch_array($getUserJID)) { $userJID = $row['JID']; //$userGM = $row['sec_content']; } mssql_select_db($dbName2, $dbConn) or die ("Couln't select database $dbName2"); //check that the char belong to te logged account $getCharID = mssql_query("select * from _User where UserJID = '$userJID'"); $charnumeros=0; while ($row = mssql_fetch_array($getCharID)) { $charID2 = $row['CharID']; if($charID2==$_GET['char']){ $charnumeros++; } } if($charnumeros==0){ echo "<script>location.href='index.php'</script>"; die; } //select char informations needed to reset $getCharInfos = mssql_query("select * from _Char where CharID = ".$_GET['char']); while ($row2 = mssql_fetch_array($getCharInfos)) { $charName = $row2['CharName16']; $charLevel = $row2['CurLevel']; } $erro=""; $reset = ($charLevel-1)+20; $remainStats = ($charLevel-1)*3; if($_GET["r"]=="true"){ //hoje it's the date from the present day $hoje=date2int(date("Y-m-d")); //does this char already made a reset sometime? $jaDeu=mssql_num_rows(mssql_query("select * from _Char_Reset where char_id='".$_GET['char']."'")); if($jaDeu>0){ //this is not the first time so let's know when it was $quandoDeu=mssql_query("select * from _Char_Reset where char_id='".$_GET['char']."'"); while ($row = mssql_fetch_array($quandoDeu)) { $charLastReset = $row['last_reset']; } //how much days ago? (today - last reset) $passaram=$hoje-$charLastReset; //if already 7 days passed update else you must wait if($passaram>6){ mssql_query("update _Char_Reset set last_reset='$hoje' where char_id='".$_GET['char']."'"); }else{ $erro="You must wait ".(7-$passaram)." days to reset $charName again"; } }else{ //insert that today this char made a reset mssql_query("insert into _Char_Reset (char_id,last_reset) values ('".$_GET['char']."','$hoje')"); } if($erro==""){ //here we make the reset itself if no errors occur $conteudo="<br><br><br><p align='center'><font color='#2ed900'>$charName's Status Points were reseted.</font></p>"; mssql_query("update _Char set Strength=$reset, Intellect=$reset, RemainStatPoint=$remainStats where CharID = ".$_GET['char']); }else{ $conteudo="<br><br><br><br><br><p align='center'><font color='red'>$erro</font></p>"; } }else{ //here we have a confirmation if the player is sure he want to make the reset $conteudo="<br><br><br><p align='center'>Are you sure you want to reset $charName's Status Points?</p><p align='center'>Remember that you can only reset it again after 7 days</font>"; $conteudo=$conteudo."<br><br><p align='center'><a href=\"reset.php?char=".$_GET["char"]."&r=true\"><img src=\"styles/img/cp/reset.png\" alt=\"\" border=\"0\"></a></p>"; } include("theme.php");
[/SPOILER]


|
|
التعديل الأخير تم بواسطة ™Dev Microsoft™ ; 31-10-2013 الساعة 05:31 AM
|