[Release] Useful PHP scripts for your server ( Sanitized Inputs - No SQL Injection )
Discussion on [Release] Useful PHP scripts for your server ( Sanitized Inputs - No SQL Injection ) within the SRO PServer Guides & Releases forum part of the SRO Private Server category.
[Release] Useful PHP scripts for your server ( Sanitized Inputs - No SQL Injection )
Hello,
As I promised to release more of the stuff that you may need to have a smooth experience with your server development, These are some scripts that may help you to get to such point.
Autoitem equipment script ( to 10 degree ):
PHP Code:
<?php
error_reporting(ALL);
// Connect
mssql_connect("WIN-2HIH5B6MR53\SQLEXPRESS", "sa", "123456") or die("Database problem #1");
// Database
mssql_select_db("SRO_VT_SHARD") or die("Database problem #2");
// Select from Online Users to save DB, xD
#mssql_select_db("SRO_VT_LOG") or die("Database problem #2");
#$OnlineChars = mssql_query("SELECT * FROM _OnlineOffline WHERE Status='Online'");
#while ($POnlineChars = mssql_fetch_array($OnlineChars)) {
// DATABASE
mssql_select_db("SRO_VT_SHARD") or die("Database problem #2");
// Select following chars!
#$Chars = mssql_query("SELECT * FROM _Char where CharName16 = '{$POnlineChars['Charname']}' and CurLevel in (1, 8, 16, 24, 32, 42, 52, 64, 76, 90)");
$Chars = mssql_query("SELECT * FROM _Char where CharName16 = 'Star' and CurLevel in (1, 8, 16, 24, 32, 42, 52, 64, 76, 90)");
while ($PChars = mssql_fetch_array($Chars)) {
// Select inventory
$Inventory = mssql_query("SELECT * FROM _Inventory where CharID = '{$PChars['CharID']}' and Slot in (0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12)");
while ($PInventory = mssql_fetch_array($Inventory)) {
// Check if item id is not 0
if ($PInventory['ItemID'] != '0') {
// Select from items
$Items = mssql_query("SELECT * FROM _Items where ID64 = '{$PInventory['ItemID']}'");
while ($PItems = mssql_fetch_array($Items)) {
// Select from RefObjCommon
$Names = mssql_query("SELECT * FROM _RefObjCommon where ID = '{$PItems['RefItemID']}'");
while ($PNames = mssql_fetch_array($Names)) {
// Select new set,weapon,acc
$New = mssql_query("SELECT * FROM _RefObjCommon where CodeName128 = '$nigga'");
while ($PNew = mssql_fetch_array($New)) {
echo $PNew['CodeName128'].'<br>';
// Lets test to update item.
mssql_query("UPDATE _Items SET RefItemID = '{$PNew['ID']}' WHERE ID64 = '{$PInventory['ItemID']}'");
// Lets give them +7 items :)
mssql_query("UPDATE _Items set OptLevel = '7' where ID64 = '{$PInventory['ItemID']}'");
}
}
}
}
}
}
#}
?>
------------------------------------------------
Rewarding the fortress war winner guild(s) at a specific time that you choose:
PHP Code:
<?php
// Config
$silk = "25"; // How much silk to be given.
$day = "Monday 00:00"; // What day should we launch the script?
// Server connection!
mssql_connect("GALAXY-PC\SQLEXPRESS", "sa", "123456") or die("Database problem #1");
// Dont touch this.
$date = date('l H:i');
// Dont touch the date, edit in the top.
if($date == $day) {
// Lets clean old guild winners
mssql_select_db("SRO_VT_ACCOUNT") or die("Database problem #2");
mssql_query("TRUNCATE TABLE guild_winners");
// Some problem with that mssql fixed here.
mssql_select_db("SRO_VT_SHARD") or die("Database problem #2");
$checkGuilds = mssql_query("select GuildID from _SiegeFortress where FortressID in (1, 3, 6)");
while($printGuild = mssql_fetch_array($checkGuilds)) {
// Some problem with that mssql fixed here.
mssql_select_db("SRO_VT_SHARD") or die("Database problem #2");
$checkMembers = mssql_query("select CharID from _GuildMember where GuildID = '{$printGuild['GuildID']}'");
while($printCharID = mssql_fetch_array($checkMembers)) {
// Some problem with that mssql fixed here.
mssql_select_db("SRO_VT_SHARD") or die("Database problem #2");
$checkJID = mssql_query("SELECT UserJID from _User where CharID = '{$printCharID['CharID']}'");
while($printJID = mssql_fetch_array($checkJID)) {
// Some problem with that mssql fixed here.
mssql_select_db("SRO_VT_ACCOUNT") or die("Database problem #2");
$checkUsername = mssql_query("SELECT StrUserID from TB_User where JID = '{$printJID['UserJID']}'");
while($printUser = mssql_fetch_array($checkUsername)) {
mssql_query("INSERT INTO guild_winners (username, silk, rewarded) VALUES('{$printUser['StrUserID']}', '$silk', 'false')");
// So some problems with duplicated !?
$mssql = mssql_query("select username from guild_winners group by username having count(*) > 1");
while ($mssrow = mssql_fetch_array($mssql)) {
// duplicated solved, like a bawz.
if($mssrow) {
mssql_query("DELETE FROM guild_winners where username = '{$mssrow['username']}'");
}
// Lets insert the ones that was duplicated, but only ones this time :)
mssql_query("INSERT INTO guild_winners (username, silk, rewarded) VALUES('{$mssrow['username']}', '$silk', 'false')");
// Lets select all members from guild_winners :)
$final = mssql_query("SELECT * FROM guild_winners");
while($finalPrint = mssql_fetch_array($final)){
// Lets give them silk
mssql_query("exec CGI.CGI_WebPurchaseSilk 0,'{$finalPrint['username']}',0,'$silk',0");
// Lets update guild_winners and put rewarded = true
mssql_query("UPDATE guild_winners set rewarded = 'true' where username = '{$finalPrint['username']}'");
}
}
}
} // If JID is not duplicated.
} // Row
}
} else {
echo "The date is not $day, it is $date";
?>
<meta http-equiv="refresh" content="30" />
<?php
}
?>
<meta http-equiv="refresh" content="120" />
--------------------------------
Giving Silk Reward to top 5 Unique hunters at a specific time that you choose
(Of course u will need chernobyl's patch [Evangelion] to record uniques kills in your database):
PHP Code:
<?php
// Config
$silk = "500"; // How much silk to be given.
$day = "Saturday 00:21"; // What day should we launch the script?
// Server connection!
mssql_connect("WIN-2HIH5B6MR53\SQLEXPRESS", "sa", "123456") or die("Database problem #1");
// Dont touch this.
$date = date('l H:i');
// Dont touch the date, edit in the top.
if($date == $day) {
// Delete old unique_winners
// Some problem with that mssql fixed here.
mssql_select_db("SRO_VT_ACCOUNT") or die("Database problem #2");
mssql_query("TRUNCATE TABLE unique_winners");
// Select TOP 5 from the Weekly uniques!
// Some problem with that mssql fixed here.
mssql_select_db("SRO_VT_ACCOUNT") or die("Database problem #2");
$win = mssql_query("SELECT top 5 CharName, count(CharName) as test from Evangelion_uniques where MobName in ('MOB_CH_TIGERWOMAN', 'MOB_EU_KERBEROS', 'MOB_AM_IVY', 'MOB_OA_URUCHI', 'MOB_KK_ISYUTARU', 'MOB_TK_BONELORD', 'MOB_RM_TAHOMET', 'MOB_TQ_WHITESNAKE' , 'MOB_JUPITER_JUPITER' , 'MOB_JUPITER_YUNO') AND time >= DATEADD(day,-7, GETDATE()) group by CharName order by test desc");
while($pwin = mssql_fetch_array($win)) {
// Some problem with that mssql fixed here.
mssql_select_db("SRO_VT_SHARD");
$char = mssql_query("SELECT CharID FROM _Char where CharName16 = '{$pwin['CharName']}'");
while($pchar = mssql_fetch_array($char)) {
// Some problem with that mssql fixed here.
mssql_select_db("SRO_VT_SHARD");
$JID = mssql_query("SELECT UserJID FROM _User where CharID = '{$pchar['CharID']}'");
while($pJID = mssql_fetch_array($JID)) {
// Some problem with that mssql fixed here.
mssql_select_db("SRO_VT_ACCOUNT");
$user = mssql_query("SELECT StrUserID from TB_User where JID = '{$pJID['UserJID']}'");
while($puser = mssql_fetch_array($user)) {
// Insert them into the unique_winners
// Some problem with that mssql fixed here.
mssql_select_db("SRO_VT_ACCOUNT");
mssql_query("INSERT INTO unique_winners('charname', 'silk', 'rewarded') VALUES('{$pwin['CharName']}', '$silk', 'yes')");
// Lets give them silk
// Some problem with that mssql fixed here.
mssql_select_db("SRO_VT_ACCOUNT");
mssql_query("exec CGI.CGI_WebPurchaseSilk 0,'{$puser['StrUserID']}',0,'$silk',0");
} // End $puser
} // End $pJID
} // End $pchar
} // End $pwin
} else {
echo "The date is not $day, it is $date";
?>
<meta http-equiv="refresh" content="30" />
<?php
} // END SCRIPT
?>
<meta http-equiv="refresh" content="120" />
------------------------------
Silk per hour script ( the easiest way - You will need Caipi's database queries for silk/hour to be able to use this script which is easier and easy to be modified ):
PHP Code:
<?php
mssql_connect("WIN-2HIH5B6MR53\SQLEXPRESS", "sa", "123456") or die("Database problem #1");
mssql_select_db("SRO_VT_SHARDLOG") or die("Database problem #2");
mssql_query("DELETE FROM dbo._OnlineOffline where Status = 'Offline'");
mssql_query("DELETE FROM dbo._OnlineOffline where Status = 'OnHold'");
$result = mssql_query("SELECT * FROM dbo._OnlineOffline where Minutes = '60' AND Status = 'Online'") or die("Database problem #3");
while($row = mssql_fetch_array($result)) {
mssql_select_db("SRO_VT_SHARD");
$CharID = mssql_query("SELECT UserJID FROM dbo._User where CharID = '{$row['CharID']}'");
while($Chars = mssql_fetch_array($CharID)) {
mssql_select_db("SRO_VT_ACCOUNT");
$StrUserID = mssql_query("SELECT StrUserID FROM TB_User where JID = '{$Chars['UserJID']}'");
while($Accounts = mssql_fetch_array($StrUserID)) {
mssql_query("exec CGI.CGI_WebPurchaseSilk 0,'{$Accounts['StrUserID']}',0,'1',0");
mssql_select_db("SRO_VT_SHARDLOG");
mssql_query("UPDATE dbo._OnlineOffline set Minutes = '0' where Charname = '{$row['Charname']}'");
}
}
}
?>
<meta http-equiv="refresh" content="60" />
--------------------------------
All those PHP scripts can be edited as you desire with basic php knowledge
I thought u can do it by yourself .. anyway I will add the query for creating all the required tables later tonight or tomorrow when I get free time ..
or
you can just download ReviveSRO database from this thread and get the tables queries yourself from it ..
the required database tables will be located in ( SRO_VT_ACCOUNT / SRO_VT_SHARDLOG )
That mean you'll need to open a php script all the day ?!
Btw for auto refresh you can make that in one ajax page, which load the reste without problem. But sql profiler have thing for that, that will be better than php script !
Python scripts injection blocked 08/08/2013 - Metin2 Private Server - 0 Replies Hello people!
I've to hack in a server but this server have blocked Python scripts injection
How can i bypass this???
Nothing???!!?
[Release] Action 10 Private Server Scripts 10/28/2012 - Dekaron PServer Hacks, Bots, Cheats & Exploits - 0 Replies How to update blocks
Example:
Block1 0xE2F4D966
Now It can be for any of these hacks autopots,vac,non agrro, or even vac. Take the line given below like (Health Potion,0,0,1,0,1,37,1111-1111-1111-1111-1111-1111- 1111-1111) Search for it in winhex once you find highlight it. Look at bottom of winhex it will show something like (Offset: E2F4D966) Take this NEW offset and replace it in the block leave the (0x) alone. Press save drag the csv file into your pack.d00 or data.pack file that should...
[RELEASE] Usefull Server Scripts 03/02/2010 - EO PServer Guides & Releases - 9 Replies Hey everyone as there isnt many admin type releases i thought id put some up to help out the newer server developers out there.
here is a list of the scripts to follow:
Palladin Potion Soul bug fix,
Set players gear to full bonus,
Bot jail a player,
Open all totems,
Staff ep and pp award,
banned player and cheat log table' (php web page for it soon)