Nice!
off topic:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/artfulme/public_html/index.php:1) in /home/artfulme/public_html/index.php on line 1
This is a discussion on GM(s) Online Count Script! within the FlyFF Releases forums, part of the Flyff category; I don't know if this was released before or this was a common script that can be found on flyff ...
I don't know if this was released before or this was a common script that can be found on flyff website releases. I'm still confused if this would be useful for you too, because this was useful to me.
Save this as useron.php. (or anything you just have to change the "require('useron.php');" )
Then this script would be the main script to be use.PHP Code:<?php
$link = @mssql_connect("XXX\SQLEXPRESS", "SA", "SQLPASS") or die ("Server is down!");
$db = @mssql_select_db('ACCOUNT_DBF') or die ("Account table is missing!");
$b = '';
$mail = '';
$query = mssql_query("SELECT * FROM [ACCOUNT_TBL_DETAIL] WHERE isuse = 'J' AND m_chLoginAuthority='Z'");
?>
But, for this to work. You should execute this query to your SQL SERVER.PHP Code:<?php
require('useron.php');
echo 'GM(s) Online : <font size="2" color="green">' . mssql_num_rows($query);
?></font>
This is kinda simple. But this is important to me, I don't know if this would be important to you too. Well, Thank you if you could appreciate and Still thank you if not. Because you at least viewed this.Code:USE [ACCOUNT_DBF] GO update [ACCOUNT_TBL_DETAIL] set m_chLoginAuthority = 'Z' where account = 'STAFF USERNAME' GO
Nice!
off topic:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/artfulme/public_html/index.php:1) in /home/artfulme/public_html/index.php on line 1
Please learn TSQL/PHP/Anything...
That was hard? That took less than 60seconds to write up. Also note that selecting all values in a table really isn't a good idea for performance.PHP Code:$query = mssql_query("SELECT COUNT(*) as GMsOnline FROM [ACCOUNT_TBL_DETAIL] WHERE [isuse] = 'J' AND [m_chLoginAuthority] != 'F'");
$array = mssql_fetch_array($query);
echo $array['GMsOnline'];
Also, technically the m_chLoginAuthority value in ACCOUNT_TBL_DETAIL is for GM ACCOUNTS (meaning every char on the account, is considered a GM char).
This would be better for checking if the actual GM chars are online:Code:$query = mssql_query("SELECT COUNT(*) as GMsOnline FROM [CHARACTER_01_DBF].dbo.[CHARACTER_TBL] WHERE [m_chAuthority]!='F' AND [MultiServer]!=0"); $array = mssql_fetch_array($query); echo $array['GMsOnline'];
Thanks bro.
Not it's not.
Output buffering is a great way to hold output until script execution is completed.
It prevents stupid errors that aren't supposed to happen.
There are some cases where output buffering shouldn't be used as a solution, but it's a completely acceptable way to go about doing things.
Instead of using it to fix your headers are already send errors, you should go back and change your code, that way you won't need the ob_start();
http headers ends once something is printed out on the screen, so fixing this is wery simple. One fix would maybe include the headers in a global file ontop of the page. Other one could be getting rid of all the echo / print in functions and use "return" instead. This way you can use a controller to generate the page in the end. This would be the hardest way of doing it but its the best way. As it will give your website several different options along with it.
If you decide to use ob_start make sure you use flush the output to the user after with ob_end_flush();
Last edited by dudekill; 19-08-11 at 11:42 PM.
[SIGPIC][/SIGPIC]
PHP flushes it automatically on script end so ob_end_flush is not needed.
I can say that bad code leads to bad fixes, and using output buffering to suppress an error is not the right way to go but it's no way in hell a bad "coding style".
Go learn PHP please.