|
You last visited: Today at 22:10
Advertisement
Web Design
Discussion on Web Design within the CO2 Private Server forum part of the Conquer Online 2 category.
|
View Poll Results: Would this be a good project for the community?
|
|
Yes
|
  
|
12 |
66.67% |
|
No
|
  
|
6 |
33.33% |
01/24/2014, 03:12
|
#46
|
elite*gold: 130
Join Date: Oct 2007
Posts: 1,655
Received Thanks: 706
|
Quote:
Originally Posted by .Light
[....]
|
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
|
#47
|
elite*gold: 0
Join Date: Mar 2010
Posts: 183
Received Thanks: 74
|
Quote:
Originally Posted by turk55
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
|
#48
|
elite*gold: 0
Join Date: May 2009
Posts: 86
Received Thanks: 15
|
Quote:
Originally Posted by Y u k i
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
|
#49
|
elite*gold: 130
Join Date: Oct 2007
Posts: 1,655
Received Thanks: 706
|
Quote:
Originally Posted by Gerculy
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
|
#50
|
elite*gold: 0
Join Date: May 2009
Posts: 86
Received Thanks: 15
|
Quote:
Originally Posted by turk55
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
 .
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
|
#51
|
elite*gold: 130
Join Date: Oct 2007
Posts: 1,655
Received Thanks: 706
|
Quote:
Originally Posted by Gerculy
Mysql is deprecated since Version 5.5.0
 .
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
|
#52
|
elite*gold: 20
Join Date: Oct 2008
Posts: 328
Received Thanks: 43
|
I like the design
|
|
|
01/29/2014, 01:39
|
#53
|
elite*gold: 0
Join Date: Mar 2010
Posts: 183
Received Thanks: 74
|
Quote:
Originally Posted by Gerculy
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
|
#54
|
elite*gold: 0
Join Date: Jul 2006
Posts: 2,216
Received Thanks: 794
|
The design is nice.
|
|
|
01/30/2014, 02:03
|
#55
|
elite*gold: 0
Join Date: Mar 2010
Posts: 183
Received Thanks: 74
|
Quote:
Originally Posted by jackpotsvr
I like the design 
|
Quote:
Originally Posted by KraHen
The design is nice. 
|
Thanks (:
|
|
|
06/01/2015, 05:27
|
#56
|
elite*gold: 0
Join Date: Mar 2010
Posts: 183
Received Thanks: 74
|
I've decided to restart this project!
Progress so far:
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!
|
|
|
All times are GMT +2. The time now is 22:10.
|
|