[Development]GM Log php

Joined
Jun 19, 2009
Messages
1,540
Reaction score
538
[Development]Full Penal php

I'm now planing to make an whole penal for administrators.
Quget - [Development]GM Log php - RaGEZONE Forums

Lol kinda how it look like, it may not look fancy yet.
yes you can click and it goes there :ott1: i need to do the work space first right xD or it will be a mess
If you didn't log in you won't be able to access the page
You will get this error code
Code:
Fout 310 (net::ERR_TOO_MANY_REDIRECTS): Too Many Redirections
I'm now adding that gm chat log to improve add allot of search functions in it and so on... now it loads the whole thing in that page easy fix.
It looks fair to me :ott1:

Anti sql injection I googled it lol i'm not going to make my own anti sql injection it should directly secured. >.< is this an good one ?
Code:
<?php
    Function anti_injection( $username, $pass ) {
            $banlist = ARRAY (
                    "insert", "select", "update", "delete", "distinct", "having", "truncate", "replace",
                    "handler", "like", " as ", "or ", "procedure", "limit", "order by", "group by", "asc", "desc"
            );
            IF ( EREGI ( "[a-zA-Z0-9]+", $username ) ) {
                    $username = TRIM ( STR_REPLACE ( $banlist, '', STRTOLOWER ( $user ) ) );
            } ELSE {
                    $username = NULL;
            }
            IF ( EREGI ( "[a-zA-Z0-9]+", $pass ) ) {
                    $pass = TRIM ( STR_REPLACE ( $banlist, '', STRTOLOWER ( $pass ) ) );
            } ELSE {
                    $pass = NULL;
            }

            $array = ARRAY ( 'username' => $username, 'pass' => $pass );

            IF ( IN_ARRAY ( NULL, $array ) ) {
                    DIE ( 'Invalid use of login and/or password. Please use a normal method.' );
            } ELSE {
                    RETURN $array;
            }
    }
?>
First the functions
Done
Mssql Connect
Anti sql injection(Should test it)
Login
No skipping login


To do
The Stuff
Too much to tell
Find a way to improve my cookie xD
 
Last edited:
You know bro, you could try doing that on a language that it's not web-based, make it into a program, with C# C++ or even Java. Not complaining about it being PHP, it's good if you wish to use this on a web-based control panel, but you know, it'd be a learning experience as well, since I know you're interested in developing.
 
You know bro, you could try doing that on a language that it's not web-based, make it into a program, with C# C++ or even Java. Not complaining about it being PHP, it's good if you wish to use this on a web-based control panel, but you know, it'd be a learning experience as well, since I know you're interested in developing.

I will do it in c++ as well :ott1:
I will start that soon or tomorrow depends if I'm staying home or not :P
Thanks for the idea :):

Erm i have a problem i never worked with mssql or sql connections in c++ google didn't help.
Any one can help me with this one >.<
 
Last edited:
I will do it in c++ as well :ott1:
I will start that soon or tomorrow depends if I'm staying home or not :P
Thanks for the idea :):

Erm i have a problem i never worked with mssql or sql connections in c++ google didn't help.
Any one can help me with this one >.<

Sounds good if i get time soon i can help you if you would like? I know mssql, php, java , c# very well. I suppose i should start learning c++ just never got round to it.
 
I'm working on an system in php were your able to see what the GM's are doing.
You can see the messages the game masters typed already :P

PHP:
<html>
<head>
<title>Simple Game Master Logs by Quget</title>
</head>
<body bgcolor="#FF8C00">

<?php
echo"<p align=\"center\"><font face=\"verdana\" size=\"21\" color=\"#DDDDDD\">GameMaster Logs</font></p>";
?>
<?php
$mssqlserver = ".\SQLEXPRESS";
$mssqluser = "sa";
$mssqlpass = "<pass>";
$mssqldatabase = "Player_logs"; 


$mssqlconnect = mssql_connect($mssqlserver, $mssqluser, $mssqlpass)
  or die("geen connectie met sql server"); 

$selected = mssql_select_db($mssqldatabase, $mssqlconnect)
  or die("lol geen database"); 

$query = "SELECT serverindex, m_idPlayer, m_szWords, s_date, m_idGuild, SEQ ";
$query .= "FROM LOG_GAMEMASTER_TBL ";
$query .= "WHERE serverindex >'00'";

$result = mssql_query($query);

  echo '<table border="2"bordercolor="#FFFFFF"cellpadding="2"cellspacing= "2" align="center" bgcolor="#999999">';
  echo '<th>Serverindex</th>';
  echo '<th>GM Player_id</th>';
  echo '<th>Ingame Chat</th>';
  echo '<th>Date YYYY-MM-DD-HH-MM-SS</th>';
  echo '<th>Guild_id</th>';
  echo '<th>SEQ</th>';

 while ($row = mssql_fetch_array($result)) 
    {
      echo '<tr>';
      echo '<td>'. $row[0] . '</td>';
      echo '<td>' . $row[1] . '</td>';
      echo '<td>' . $row[2] . '</td>';
      echo '<td>' . $row[3] . '</td>';
      echo '<td>' . $row[4] . '</td>';
      echo '<td>' . $row[5] . '</td>';
      echo '</tr>';
    }
 
   echo '</table>'

?>

<p align= "center "><font face= "verdana " size= "2" color="#FFFFFF">Made by Quget~</font></p>
Thats how far I'm i will add more things later.

So lets spy gm's!


---edit---
i need to think how to get the other information there :P

ADOdb Pls. Also, think about putting the results into pages(Ie. 50 results per page). 10k GM logs isn't fun to load in firefox.

This is a bit useless since it fetches ALL gm logs. If you want to make something useful do something like this:

PHP:
<? $query = mssql_query("SELECT * FROM LOGGING_01_DBF.dbo.LOG_GAMEMASTER_TBL WHERE szWords LIKE '%{$cleanArr['SearchString']}%'"); ?>

Then just make a form to let them submit the data and make $cleanArr contain the POST data sanitized...
Like this:
PHP:
<? 
foreach($_POST as $key=>$value){
$cleanArr[$key] = mssql_esc($value);
}

Not too hard, eh? GJ on your first PHP script.

Edit: Also, GJ on ripping your mssql connect function from Germans.
 
Last edited:
ADOdb Pls. Also, think about putting the results into pages(Ie. 50 results per page). 10k GM logs isn't fun to load in firefox.

This is a bit useless since it fetches ALL gm logs. If you want to make something useful do something like this:

PHP:
<? $query = mssql_query("SELECT * FROM LOGGING_01_DBF.dbo.LOG_GAMEMASTER_TBL WHERE szWords LIKE '%{$cleanArr['SearchString']}%'"); ?>

Then just make a form to let them submit the data and make $cleanArr contain the POST data sanitized...
Like this:
PHP:
<? 
foreach($_POST as $key=>$value){
$cleanArr[$key] = mssql_esc($value);
}

Not too hard, eh? GJ on your first PHP script.

Edit: Also, GJ on ripping your mssql connect function from Germans.
erm dude i learned connecting to mysql from a tutorial :/

You don't want to see my hello world testing page lol

So i tried mssql instead of mysql and it worked.
I typed it out of my head.
Ohh geen connectie met sql server
thats dutch not german.

And thank you for helping.

Your right on that one an whole list of logs isn't useful.
 
Last edited:
erm dude i learned connecting to mysql from a tutorial :/

You don't want to see my hello world testing page lol

So i tried mssql instead of mysql and it worked.
I typed it out of my head.
Ohh geen connectie met sql server
thats dutch not german.

And thank you for helping.

Your right on that one an whole list of logs isn't useful.

Yeah...The other issue is on my smaller cluster I have 32000 entries(rows) in my GM Logging table. That would crash firefox on most computers and certainly IE wouldn't be able to handle it(I've had a lot of issues reading large xmls on IE). Aeonsoft used something that they call SEQ. Sequence I believe. It's basically an index of the entries to call on them faster as well as to sort them without excess select functions or tmp tables. This allows them make pages, IE. selecting between the two numbers...Like 1-10, 11-20, 21-30. This makes it a bit easier on the browser and a lot easier on the SQL Server(Selecting using a WHERE function can be a lot more efficient than TOP 10 and especially more than WHERE IS NOT IN(SELECT value FROM Tmp_TBL)). Hope this helps you learn a bit about SQL PHP Optimization.

---------- Post added at 10:16 PM ---------- Previous post was at 10:09 PM ----------

You know bro, you could try doing that on a language that it's not web-based, make it into a program, with C# C++ or even Java. Not complaining about it being PHP, it's good if you wish to use this on a web-based control panel, but you know, it'd be a learning experience as well, since I know you're interested in developing.

I honestly don't recommend this for a beginner, he should learn how to optimize his SQL Queries first(Which reduces server stress instead of speeding up the time by lifting PHP's limits). With a fully optimized query, C++ would be the ideal language to build an engine for a backend log reading system. There are faster languages(Ie C), but C++ is so heavily documented and has an incredible amount of framework/prebuilt code it is much faster to code and also is much more compatible with other software's framework. As I said, using a custom built engine will kill your SQL server unless you optimize the queries well. PHP may take 10 seconds to do a big query while C++ takes 0.1, but the CPU usage will be 100x the PHP's allocated usage for that 0.1 second. So, if you can reduce the PHP's query to 1 second, it will probably perform faster as well as take a lighter tole on the resources.
 
Yeah...The other issue is on my smaller cluster I have 32000 entries(rows) in my GM Logging table. That would crash firefox on most computers and certainly IE wouldn't be able to handle it(I've had a lot of issues reading large xmls on IE). Aeonsoft used something that they call SEQ. Sequence I believe. It's basically an index of the entries to call on them faster as well as to sort them without excess select functions or tmp tables. This allows them make pages, IE. selecting between the two numbers...Like 1-10, 11-20, 21-30. This makes it a bit easier on the browser and a lot easier on the SQL Server(Selecting using a WHERE function can be a lot more efficient than TOP 10 and especially more than WHERE IS NOT IN(SELECT value FROM Tmp_TBL)). Hope this helps you learn a bit about SQL PHP Optimization.

---------- Post added at 10:16 PM ---------- Previous post was at 10:09 PM ----------



I honestly don't recommend this for a beginner, he should learn how to optimize his SQL Queries first(Which reduces server stress instead of speeding up the time by lifting PHP's limits). With a fully optimized query, C++ would be the ideal language to build an engine for a backend log reading system. There are faster languages(Ie C), but C++ is so heavily documented and has an incredible amount of framework/prebuilt code it is much faster to code and also is much more compatible with other software's framework. As I said, using a custom built engine will kill your SQL server unless you optimize the queries well. PHP may take 10 seconds to do a big query while C++ takes 0.1, but the CPU usage will be 100x the PHP's allocated usage for that 0.1 second. So, if you can reduce the PHP's query to 1 second, it will probably perform faster as well as take a lighter tole on the resources.
I already got the search function working it need some work tough
Code:
SELECT  serverindex, m_idPlayer, m_szWords, s_date, m_idGuild,SEQ FROM LOG_GAMEMASTER_TBL  WHERE SEQ <='1087' AND SEQ >= '1085'

It will search between 1085 and 1087 :P
I know a little mysql xP
I will do that its a nice idea :laugh:
I will also look at TOP and where is not thing :P
 
Last edited:
Nice progress, MisterKid. I expect things good from you ^^.
 
Back