Welcome to Gaia! ::

My Design :: Web and Graphic Design [HTML CSS PHP]

Back to Guilds

XHTML, CSS, jQuery, Javascript, PHP, mySQL, MORE! 

Tags: design, graphics, html, jquery, javascript 

Reply Server Side Programming
Fine, want a shoutbox?

Quick Reply

Enter both words below, separated by a space:

Can't read the text? Click here

Submit

Rydian Morrison

PostPosted: Fri Aug 11, 2006 3:35 pm


Here, the coding for my shoutbox. It requires index.php and image.php in the same folder as a blank content.txt and a background image that's 500 pixels wide and 200 pixels tall, jpg format.


index.php



$time = date('h:i A')
if (isset($_POST['submit']))
{
$file = 'content.txt';
$name = trim($_POST['name'])
$message = str_replace("r","",stripslashes(trim($_POST['content'])))
$content = "($time) $name: $messagenn";
$content = explode("n",$content)
krsort($content)
$content = implode("n",$content)
$content .= file_get_contents($file)
$handle = fopen($file, 'w')
fwrite($handle, $content)
fclose($handle)
}
?>






Name:
Password:
Message:


image.php
header ('Content-Type: image/gif')
$file = 'content.txt';
$lines = str_replace("n", '', file($file))
$image = imagecreatefromjpeg('background.jpg')
$background_color = imagecolorallocate($image, 255, 255, 255)
$text_color = imagecolorallocate($image, 0, 0, 0)
$y = 209;
for ($i = 0; $i < count($lines) $i++)
{
$text = wordwrap($lines[$i], floor((imagesx($image)-6)/imagefontwidth(2)), "n", 1)
$text = explode("n", $text)
for ($j = (count($text) - 1) $j >= 0; $j--)
{
imagestring($image, 2, 4, $y, $text[$j], $text_color)
$y -= imagefontheight(2)
}
}
imageline($image,1,0,499,1,$background_color)
imagerectangle($image,0,0,499,199,$text_color)
imagegif($image)
?>
PostPosted: Sat Aug 12, 2006 9:57 am


What if you want a smaller shoutbox with a different background image? What do you change?
Man, I need to learn PHP.

Just a quick question how do you show RSS feeds? I need to show a myEbay Store RSS feed on one of my sites.

z!p


Rydian Morrison

PostPosted: Tue Aug 15, 2006 11:56 am


Well, you edit the background image, then you change the coordinates of the imageline and imagerectangle at the bottom, and then the starting point oif the text, $y, and... basically tweak all those until you get it looking right.

And for my site, poarsing my LJ feed, I used magpieRSS, I think.
PostPosted: Sun Sep 24, 2006 3:21 am


Gaia ate your slashes, must be hungry. "\n"

Hoggs
Vice Captain


cragwag

PostPosted: Tue Nov 28, 2006 11:22 pm


How did you do that slash? Gaia hates my slahes '' It likes the others though '///////'

Edit:It ate 3...
Edit2:It ate another 3...
Edit3:It ate the last one crying
PostPosted: Sat Dec 02, 2006 4:46 pm


Use a double slash.

\\ -> \

Dave the lost


Wight Spider

PostPosted: Tue Dec 19, 2006 8:56 pm


User Image User ImageUser Image

User Image
Omg. I've been workin for the last 24 hours to come up with a shoutbox code! Thanks!



User Image User ImageUser Image
Reply
Server Side Programming

 
Manage Your Items
Other Stuff
Get GCash
Offers
Get Items
More Items
Where Everyone Hangs Out
Other Community Areas
Virtual Spaces
Fun Stuff
Gaia's Games
Mini-Games
Play with GCash
Play with Platinum