|
You last visited: Today at 00:57
Advertisement
[Coding] Community message bot (iBeta) for pSRO
Discussion on [Coding] Community message bot (iBeta) for pSRO within the SRO Coding Corner forum part of the Silkroad Online category.
02/07/2014, 07:59
|
#1
|
elite*gold: 0
Join Date: Apr 2009
Posts: 1,272
Received Thanks: 991
|
[Coding] Community message bot (iBeta) for pSRO
What is iBeta?
* A PHP script that runs every minute and checks messages from normal users to a etc (Support) char.
* A player sends a message to lets say char named (Support), he asks something like (about, faq, onlineplayers) and the Support sends back an message.
* Auto simulated script to make your job easier.
Features
* Reset password (Still working on it)
Still thinking about more ideas.
Known bugs
* Gives message "You've got message", but doesn't show until re log.
* Does not deliver the message without re logging
And I'm not using INSERT, I'm using the producer to send the message.
Preview
Source code
Code:
<?php
// TIMEZONE
date_default_timezone_set('Europe/Stockholm');
// Database
$sqlac = odbc_connect("Driver={SQL Server};Server={SERVER\SQLEXPRESS}; Database={SRO_VT_ACCOUNT}", "USER", "PASSWORD");
$sqlsh = odbc_connect("Driver={SQL Server};Server={SERVER\SQLEXPRESS}; Database={SRO_VT_SHARDLOG}", "USER", "PASSWORD");
$sqlvt = odbc_connect("Driver={SQL Server};Server={SERVER\SQLEXPRESS}; Database={SRO_VT_SHARD}", "USER", "PASSWORD");
// Config
$status = 0; // Online =1 Offline =0
$msg = "Welcome to iBeta community bot coded by Michi on 2014-02-07\n-------------------------------------------------------------------\nThe BOT is currently disabled during updates\n-------------------------------------------------------------------\n\n\n Copyright (C) 2014 - Thera.se"; // Offline message.
$char = "[GM]Michi"; // Which char should be hosting? :)
// Targets
$Sender = odbc_exec($sqlvt, "SELECT TOP 1 * FROM _Memo where CharID = (SELECT CharID from _Char where CharName16 = '$char') order by date asc");
$pSender = odbc_fetch_array($Sender);
$ID64 = $pSender['ID64'];
$pm = $pSender['Message'];
// The magic is strong in this one.
$Target = $pSender['FromCharName']; // Reverse engineering, thats simple
// Check if no msg was recieved.
if($pSender) {
// Count the msgs!
$Count = odbc_exec($sqlvt, "SELECT COUNT(FromCharName) as test FROM _Memo where CharID = (SELECT CharID from _Char where CharName16 = '$Target') "); // Select count of user msg.
$pCount = odbc_fetch_array($Count);
$mLimit = $pCount['test'] + 1;
// Check msg box limit (Normal :20)
if($mLimit < '20') {
// Check $status!
if($status == "1") {
// Reset password search form.
if(strpos($pm, "#1")) {
if(strpos($pm, "User:")) {
if(strpos($pm, "Key:")) {
if(strpos($pm, "New:")) {
// Username
$start = 'User:';
$end = ':';
$string = $pm;
$username = strstr( substr( $string, strpos( $string, $start) + strlen( $start)), $end, true);
// Secret key
$start = 'Key:';
$end = ':';
$key = strstr( substr( $string, strpos( $string, $start) + strlen( $start)), $end, true);
// New password
$start = 'New:';
$end = ':';
$new = strstr( substr( $string, strpos( $string, $start) + strlen( $start)), $end, true);
} // End New:
// ** Begin if New: wrong ** \\
else {
$msg = "Welcome to iBeta community bot coded by Michi on 2014-02-07\n-------------------------------------------------------------------\nThere was a problem detecting your new password form, please retry.\n-------------------------------------------------------------------\n\n\n Copyright (C) 2014 - Thera.se";
odbc_exec($sqlvt, "exec _Memo_add '$Target', '$char', '$msg', '$mLimit'");
odbc_exec($sqlvt, "DELETE FROM _Memo where ID64 = '$ID64'");
}
} // END Key:
// ** Begin if Key: wrong ** \\
else {
$msg = "Welcome to iBeta community bot coded by Michi on 2014-02-07\n-------------------------------------------------------------------\nThere was a problem detecting your secret key form, please retry.\n-------------------------------------------------------------------\n\n\n Copyright (C) 2014 - Thera.se";
odbc_exec($sqlvt, "exec _Memo_add '$Target', '$char', '$msg', '$mLimit'");
odbc_exec($sqlvt, "DELETE FROM _Memo where ID64 = '$ID64'");
}
} // END User:
// ** Begin if User: wrong ** \\
else {
$msg = "Welcome to iBeta community bot coded by Michi on 2014-02-07\n-------------------------------------------------------------------\nThere was a problem detecting your username form, please retry.\n-------------------------------------------------------------------\n\n\n Copyright (C) 2014 - Thera.se";
odbc_exec($sqlvt, "exec _Memo_add '$Target', '$char', '$msg', '$mLimit'");
odbc_exec($sqlvt, "DELETE FROM _Memo where ID64 = '$ID64'");
}
}
}// End Status
// ** Begin if status off ** \\
else {
odbc_exec($sqlvt, "exec _Memo_add '$Target', '$char', '$msg', '$mLimit'");
odbc_exec($sqlvt, "DELETE FROM _Memo where ID64 = '$ID64'");
}
}
}// End if no msg.
else {
echo 'Error: No msg found, P.S.Refresh should be here!';
}
// ** Empty hole sitting here ** \\
?>
The source code is not finished yet, still much to-do.
Be aware that this script has no SQL inject detection yet and its far from done.
|
|
|
02/07/2014, 08:05
|
#2
|
elite*gold: 0
Join Date: Jun 2013
Posts: 551
Received Thanks: 108
|
Good Job mate
|
|
|
Similar Threads
|
What's up with the PSRO community
03/23/2013 - SRO Private Server - 16 Replies
Hey guys,
I've quit SRO a relatively long time ago, but I guess some part of me misses it, so here I am.
My most important question would be, what servers count as popular nowadays? I mean is there any server with ~500+ active players?
I tried to do some research, but I could not really find any server that meets that one easy criteria.
I'd be interested in the current state of PSRO in general too. So if you have anything on this I'd appreciate if you could give me your 2 cents.
|
All times are GMT +1. The time now is 00:57.
|
|