nets
18-11-2005, 03:36 PM
What I have wrote in this thread may not be correct, and the script might not be very secure. If you use it, your using it at your own risk - and I can't take any responsibility for it.
Ok I've decided to make a thread explaining how you can create a PHP page which controls the image in your signature.
For an example I'm going to make a PHP page which changes the image from "I am on Habbo" to "I am not on Habbo", when you type offline or online into a small page- You could use this to tell people that you are on / not on Habbo without having to use your User CP.
Create a .php page containing this code:
<?php
//Says that PHP page is a GIF image
header("Content-type: image/gif");
//Gives $status the value of status.txt
$file = "status.txt";
$open = fopen($file, 'r');
$status = fread($open, filesize($file));
fclose($open);
//If $status is set to online, the image online.gif is shown
if
($status == "online")
include 'online.gif';
//If it says somthing other than online, offline.gif is shown
else
include 'offline.gif';
?>
The page which you state if you are online or offline in, save it as .php
(You might want to password protect it).
<!-- A form to say if you're offline or online in -->
<form method='post'>Are you offline or online?<br />
<input type='text' maxlength='30' name='about' ><br />
<input type='submit' value='Go!'>
</form>
<?php
//If offline is entered, it changes status.txt to offline
if
($about == "offline")
{$open = fopen("status.txt", "w");
fwrite($open, $about);
fclose($open);
}
//If online is entered, it changes status.txt to online
if
($about == "online")
{$open = fopen("status.txt", "w");
fwrite($open, $about);
fclose($open);
}
?>
You'll now need to create a text file called "status.txt" and chmod it to 777.
Example:
http://joshh.co.uk/status.php
Control page:
http://joshh.co.uk/statusadmin.php
If any one has spotted any mistakes, pm me :p
Ok I've decided to make a thread explaining how you can create a PHP page which controls the image in your signature.
For an example I'm going to make a PHP page which changes the image from "I am on Habbo" to "I am not on Habbo", when you type offline or online into a small page- You could use this to tell people that you are on / not on Habbo without having to use your User CP.
Create a .php page containing this code:
<?php
//Says that PHP page is a GIF image
header("Content-type: image/gif");
//Gives $status the value of status.txt
$file = "status.txt";
$open = fopen($file, 'r');
$status = fread($open, filesize($file));
fclose($open);
//If $status is set to online, the image online.gif is shown
if
($status == "online")
include 'online.gif';
//If it says somthing other than online, offline.gif is shown
else
include 'offline.gif';
?>
The page which you state if you are online or offline in, save it as .php
(You might want to password protect it).
<!-- A form to say if you're offline or online in -->
<form method='post'>Are you offline or online?<br />
<input type='text' maxlength='30' name='about' ><br />
<input type='submit' value='Go!'>
</form>
<?php
//If offline is entered, it changes status.txt to offline
if
($about == "offline")
{$open = fopen("status.txt", "w");
fwrite($open, $about);
fclose($open);
}
//If online is entered, it changes status.txt to online
if
($about == "online")
{$open = fopen("status.txt", "w");
fwrite($open, $about);
fclose($open);
}
?>
You'll now need to create a text file called "status.txt" and chmod it to 777.
Example:
http://joshh.co.uk/status.php
Control page:
http://joshh.co.uk/statusadmin.php
If any one has spotted any mistakes, pm me :p