Dynamic PHP Banner

Status
Not open for further replies.
Edward has a custom hc sofa
thats the only custom on phoenixemu that ive ever seen
but keep up the good releases Hejula
 
Finally one that works, thanks Olive + Like.
 
thanks

---------- Post added at 08:09 PM ---------- Previous post was at 06:30 PM ----------

yo dude
stop flaming
ever gave out a positive comment?
you been infraction banned just to go on your other acc and flame again
you will never change
/facepalm

thats not a facepalm thats a failpalm:laugh:
 
Hejula your free to release my php version for the php users xD just delete from <style> to </style> and tell them to save it as online.php, and tell them to change online.cfm to .php, remember this is only for php users..


Soz.. for typos, im on the cell phonieee
 
Oh, and this is better than Edward's because it doesn't place the stats over the image... anyone can do that? This actually re-generates the image when someone logs into your hotel

Oh and for your information my regenerates the images too and the text are not on top on the image its a part of the image. Similar or Exact to what your does.
 
Well, since there are ssome users using The php version, i thought i'd release my version, and how to set it up :P

Okay, just save this code as online.php anywhere on your site..
PHP:
<?php
//Code created by Reptilon of http://forum.ragezone.com
$con = mysql_connect("YourHOST","root","DBPASS"); //Change this to you database connection details.
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("YourDB", $con); //Change YourDB to your database where all the tables are, EX: phoenix3

$result = mysql_query("SELECT * FROM server_status"); //Server_status is the table where users_online is. If users_online is not in this, then change it

while($row = mysql_fetch_array($result))
  {
  echo $row['users_online']; //users_online is the row where it shows how many users that are online, if it isnt this in the database then change it
  }

mysql_close($con);
?>

Okay, save this as index.php in the folder /banner/
this code:
PHP:
<?php
//Code created by Hejula of http://forum.ragezone.com
header('Content-type: image/png'); 
$onlineurl = file_get_contents('http://yoururl/banner/online.php'); //change this to where your online.php is.

$font = 'arial.ttf'; 
$handle = imagecreatefrompng('template.png'); // Background Image
$bg_color = ImageColorAllocate ($handle, 135, 206, 250); 
$txt_color = ImageColorAllocate ($handle, 239, 244, 241); 
imagettftext($handle, 12, 0, 130, 16, $txt_color, $font, "$onlineurl Users Online!"); 
ImagePng ($handle); 

?>
 
Well, since there are ssome users using The php version, i thought i'd release my version, and how to set it up :P

Okay, just save this code as online.php anywhere on your site..
PHP:
<?php
//Code created by Reptilon of http://forum.ragezone.com
$con = mysql_connect("YourHOST","root","DBPASS"); //Change this to you database connection details.
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("YourDB", $con); //Change YourDB to your database where all the tables are, EX: phoenix3

$result = mysql_query("SELECT * FROM server_status"); //Server_status is the table where users_online is. If users_online is not in this, then change it

while($row = mysql_fetch_array($result))
  {
  echo $row['users_online']; //users_online is the row where it shows how many users that are online, if it isnt this in the database then change it
  }

mysql_close($con);
?>
Okay, save this as index.php in the folder /banner/
this code:
PHP:
<?php
//Code created by Hejula of http://forum.ragezone.com
header('Content-type: image/png'); 
$onlineurl = file_get_contents('http://yoururl/banner/online.php'); //change this to where your online.php is.

$font = 'arial.ttf'; 
$handle = imagecreatefrompng('template.png'); // Background Image
$bg_color = ImageColorAllocate ($handle, 135, 206, 250); 
$txt_color = ImageColorAllocate ($handle, 239, 244, 241); 
imagettftext($handle, 12, 0, 130, 16, $txt_color, $font, "$onlineurl Users Online!"); 
ImagePng ($handle); 

?>

Obviously from w3schools.

Why the hell are you using a while(); statement when its not needed and using fetch_array while only retrieving 1 column...
 
Last edited:
Status
Not open for further replies.
Back