Web Design

01/24/2014 03:12 turk55#46
Quote:
Originally Posted by .Light View Post
[....]
Not really quite the best way to do it, here is a small upgrade;

PHP Code:
<?php
require_once('connect.php');

$mysqli = new mysqli($hostdb$dbuser$dbpass$dbname); // this should be in connect.php

$serverport "5816";
$serveraddress $serverip;
$port 9959;
$ip $serverip;
//EDIT HERE!!!
$status '1';  //1: Checks the port. 2: *NOT CODED* Checks database table for 1/0.
//EDIT HERE!!!

function countRows($table$mysqli$filter "") {
    
$queryString "SELECT count(*) FROM ".$table;
    if(!empty(
$filter)) {
        
$queryString .= " WHERE ".$filter;
    }
    
$query $mysqli->query($queryString);
    
$rows $query->num_rows;
    return 
$rows;
}

if (
$status == '1')
{
    echo 
'<p class="offline"><font style="color: ">Accounts: <font style="color: green"><b>'.countRows("accounts"$mysqli).'</p></b></font>';
    echo 
'<p class="offline"><font style="color: ">Characters: <font style="color: green"><b>'.countRows("entities"$mysqli).'</p></b></font>';
    echo 
'<p class="offline"><font style="color: ">Online Players: <font style="color: green"><b>'.countRows("entities"$mysqli"Online=1").'</p></b></font>';

    require_once(
"inc/online.php");
}
else if (
$status == '2')
{
    echo 
"WORKED2";
}
else
{
    echo 
"EDIT INC/SERVERSTATUS.PHP";
}
?>
01/24/2014 05:56 .Light#47
Quote:
Originally Posted by turk55 View Post
Not really quite the best way to do it, here is a small upgrade;

PHP Code:
<?php
require_once('connect.php');

$mysqli = new mysqli($hostdb$dbuser$dbpass$dbname); // this should be in connect.php

$serverport "5816";
$serveraddress $serverip;
$port 9959;
$ip $serverip;
//EDIT HERE!!!
$status '1';  //1: Checks the port. 2: *NOT CODED* Checks database table for 1/0.
//EDIT HERE!!!

function countRows($table$mysqli$filter "") {
    
$queryString "SELECT count(*) FROM ".$table;
    if(!empty(
$filter)) {
        
$queryString .= " WHERE ".$filter;
    }
    
$query $mysqli->query($queryString);
    
$rows $query->num_rows;
    return 
$rows;
}

if (
$status == '1')
{
    echo 
'<p class="offline"><font style="color: ">Accounts: <font style="color: green"><b>'.countRows("accounts"$mysqli).'</p></b></font>';
    echo 
'<p class="offline"><font style="color: ">Characters: <font style="color: green"><b>'.countRows("entities"$mysqli).'</p></b></font>';
    echo 
'<p class="offline"><font style="color: ">Online Players: <font style="color: green"><b>'.countRows("entities"$mysqli"Online=1").'</p></b></font>';

    require_once(
"inc/online.php");
}
else if (
$status == '2')
{
    echo 
"WORKED2";
}
else
{
    echo 
"EDIT INC/SERVERSTATUS.PHP";
}
?>
Thanks for the upgrade (: I'll add it to the site instead of the other one and I'll add your name to the contributions when we release it.
01/24/2014 07:25 Gerculy#48
Quote:
Originally Posted by Y u k i View Post
Nice. That will keep the site from loading if its offline until the timeout.
Timeout is set to 1 sec therefore you wont even notice.

About the old / upgraded Server Status . why not using PDO ?
01/24/2014 15:50 turk55#49
Quote:
Originally Posted by Gerculy View Post
Timeout is set to 1 sec therefore you wont even notice.

About the old / upgraded Server Status . why not using PDO ?
He was using the old mysql library so I tryed to lure him into the newer mysql library, but yeah you are right. PDO should be used if it wants to be used for multiple sources
01/28/2014 14:26 Gerculy#50
Quote:
Originally Posted by turk55 View Post
He was using the old mysql library so I tryed to lure him into the newer mysql library, but yeah you are right. PDO should be used if it wants to be used for multiple sources
Mysql is deprecated since Version 5.5.0
[Only registered and activated users can see links. Click Here To Register...] .

And your wrong about :
Quote:
PDO should be used if it wants to be used for multiple sources
It's not about using mysql, mysqli or PDO the website can't be made for multiple servers because tables and rows are not the same only if they use the same source.
And PDO is suggested because it's the lastest and easiest.
01/28/2014 17:56 turk55#51
Quote:
Originally Posted by Gerculy View Post
Mysql is deprecated since Version 5.5.0
[Only registered and activated users can see links. Click Here To Register...] .

And your wrong about :
It's not about using mysql, mysqli or PDO the website can't be made for multiple servers because tables and rows are not the same only if they use the same source.
And PDO is suggested because it's the lastest and easiest.
What are you talking about ? The regular MySQL library is old and deprecated, the MySQLi library on the other hand is the newer version of it.

PDO is a wrapper which allows you to use multiple database types to connect to etc. Therefore it actually does support multiple sources, all it requires you to do is change the queries a little where needed.
01/28/2014 21:11 jackpotsvr#52
I like the design ;)
01/29/2014 01:39 .Light#53
Quote:
Originally Posted by Gerculy View Post
And your wrong about :
It's not about using mysql, mysqli or PDO the website can't be made for multiple servers because tables and rows are not the same only if they use the same source.
False. It can be made for multiple servers.

I think its funny people still think that can't actually means something in this field. You can do ANYTHING, literally anything, you just have to figure out how.
01/29/2014 11:09 KraHen#54
The design is nice. :)
01/30/2014 02:03 .Light#55
Quote:
Originally Posted by jackpotsvr View Post
I like the design ;)
Quote:
Originally Posted by KraHen View Post
The design is nice. :)

Thanks (:
06/01/2015 05:27 .Light#56
I've decided to restart this project!

Progress so far:

[Only registered and activated users can see links. Click Here To Register...]

The events page is also coded in. All of the settings are handled by the database.
All news are handled by the database.
Any questions, let me know!