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 ** \\
?>