Sethykins
(?)Community Member
- Posted: Wed, 07 Jul 2004 19:28:57 +0000
Note/Update: I do not have a website anymore so the code isn't there anymore and I don't deal with the shoutbox anymore because I just don't have time to put somewhere else, update the code, ect. so please don't pm asking about how to do the shoutbox or with any help with it. Thank you.
-Seth
I'm sure you a lot of you saw those shoutboxes created by Cremonte and now you are all sad and heart broken because you cannot get your own now that he has closed down. Well never fear because now you can host your own simple shoutbox use the code I give to you, yay =^-^=.
Requirements:
PHP Version greater than 4.3
A MySQL database
GD library version 1.8 or greater, preferable GD2 because of its increased PNG support
Instructions:
Download the shoutbox package:
http://sethswebs.com/shoutbox.zip
First open up shoutbox.php and edit the following things:
[code:1]$mypass = "MySQL pass goes here";
$myuser = "MySQL user goes here";
$mydb = "MySQL Database goes here";
$myhost = "localhost";
$imurl = "ImageUrl goes here";
$x = "X position goes here";
$y = "Y position goes here";
$maxx = "The max width goes here";
$maxy = "The max height goes here";[/code:1]
$imurl is going to be the background image where the shouts will appear on. X and Y are the text position, meaning the cordinates for that is where the text is going to start being written. Maxx is the maximum width that the text can go while Maxy is the maximum height the text can go. If the host you are using already offers a MySQL database along with PHP then leave $myhost alone, otherwise change it to the host of your MySQl database.
Next in the same file find where it says
[code:1]header("image/" wink ; [/code:1]
After the the image/ add the extension of the file you will be using(jpeg,gif,ect.). Note that jpg must be jpeg because that is the actual extension name.
Now find where it says
[code:1]$im = @imagecreatefrom($imurl);[/code:1]
After the from in imagecreatefrom add the extension of the image you are going to use.
Now scroll down to where it says
[code:1]$tc = imagecolorallocate($im,0,0,0);[/code:1]
If you want a color other than black then edit the three 0's to the colors you want for them. The 0's correspond to the RGB colors. If you want black then leave it alone. On the opposite side of the spectrum white would be 255,255,255.
Find where it says
[code:1]return image($im);[/code:1]
After the image part add the extension of your image, so if you are using a png it should be:
[code:1]return imagepng($im);[/code:1]
If you going to use a jpeg then the correct code would be:
[code:1]return imagejpeg($im,'',100);[/code:1]
Where the last number is the quality of the image, 0 being the worst and 100 being the best.
Now then open up shoutboxshout.php and shoutboxinstall.php and edit the code that says:
[code:1]$mypass = "MySQL pass goes here";
$myuser = "MySQL user goes here";
$mydb = "MySQL Database goes here";
$myhost = "localhost";[/code:1]
If the host you are using already offers a MySQL database along with PHP then leave $myhost alone, otherwise change it to the host of your MySQl database. Next upload all the files then run shoutboxinstall.php in order to create your table for you shouts. When that is done you can delete it.
And if all goes well you have just created a shoutbox for your sig, yay =^-^=. Have fun with it.
Note: This code was inspired by Cremonte. If it wasn't for him making his shoutboxes I would of never made this code. All credit for the shoutboxes should rightfully go to him
But if you're feeling generous you can send a donation to me because I worked so hard to make this code ^_^;;;
If you don't have a MySQL database or you don't want to use a different host for one then you can use Rayquazza's flatfile version, yay for Ray =^-^=:
Sig.php:
[code:1]<?php
$im = ImageCreateFrompng('try.png'); // your image
$im2 = imagecreatetruecolor(425, 250); // size of your image
$white = imagecolorallocate($im, 85, 85, 85);
imagefill($im2, 0, 0, $white); // fille the background image
ImageCopyMerge($im2, $im, 0, 0, 0, 0, ImagesX($im), ImagesY($im), 100);
$file = file_get_contents('messagelog.txt');
$file = explode("n", $file);
$ln = count($file);
$e = 1;
// Write text on image starting from bottom up. (newest on bottom)
for ($i = 7; $i > 0; $i--) {
$j = $i - 1;
$vertdist = $e * 15;
$vertdist = $vertdist + 10;
$lnc = $ln - $i;
$string = $file[$lnc];
switch ($col) {
case 0;
imagestring($im2, 2, 110, $vertdist, $string, $white);
break;
case 1;
imagestring($im2, 2, 10, $vertdist, $string2, $white);
break;
case 2;
imagestring($im2, 2, 110, $vertdist, $string3, $white);
break;
case 3;
imagestring($im2, 2, 110, $vertdist, $today, $white);
break;
default:
imagestring($im2, 2, 110, $vertdist, $whatis, $white);
}
$e++;
}
header("Content-type: image/png" wink ; // tell browser it's an image
imagepng($im2); // send image
imagedestroy($im2); // free resources
?> [/code:1]
Submit.php:
[code:1]<html><body><center><br><br><br><br><br><br><br><br><br><form action="submit.php" method="POST">
Name: <input type="text" name="username" maxlength='19'><font color="red">*</font><br>
Message / Action: <input type="text" name="message" maxlength='27'><font color="red">*</font><br>
<input type="submit" value="Submit"><br>
</form></center>
<body></html>
<?php
$message = stripslashes($_POST['message']);
$username = stripslashes($_POST['username']);
$password = stripslashes($_POST['password']);
//define vars
if (!empty($username) && !empty($message)){
//checks if all inputs are set
$fh = fopen("messagelog.txt", "a+"); // sends stuff to logfile
fwrite($fh, " " . $username . " says: " . $message . "n" wink ;
fclose($fh);
echo "<center>Successful. Check <a href='sig.php'>the shoutbox</a>.";
}
else {
echo "<center>All fields marked with an <font color="red">*</font> are necesary.<br>";
}
?> [/code:1]
http://www.oinko.net/freephp/ is a site that shows a list of hosts that offer php and MySQL, thanks dstar ^_^.
-Seth
I'm sure you a lot of you saw those shoutboxes created by Cremonte and now you are all sad and heart broken because you cannot get your own now that he has closed down. Well never fear because now you can host your own simple shoutbox use the code I give to you, yay =^-^=.
Requirements:
PHP Version greater than 4.3
A MySQL database
GD library version 1.8 or greater, preferable GD2 because of its increased PNG support
Instructions:
Download the shoutbox package:
http://sethswebs.com/shoutbox.zip
First open up shoutbox.php and edit the following things:
[code:1]$mypass = "MySQL pass goes here";
$myuser = "MySQL user goes here";
$mydb = "MySQL Database goes here";
$myhost = "localhost";
$imurl = "ImageUrl goes here";
$x = "X position goes here";
$y = "Y position goes here";
$maxx = "The max width goes here";
$maxy = "The max height goes here";[/code:1]
$imurl is going to be the background image where the shouts will appear on. X and Y are the text position, meaning the cordinates for that is where the text is going to start being written. Maxx is the maximum width that the text can go while Maxy is the maximum height the text can go. If the host you are using already offers a MySQL database along with PHP then leave $myhost alone, otherwise change it to the host of your MySQl database.
Next in the same file find where it says
[code:1]header("image/" wink ; [/code:1]
After the the image/ add the extension of the file you will be using(jpeg,gif,ect.). Note that jpg must be jpeg because that is the actual extension name.
Now find where it says
[code:1]$im = @imagecreatefrom($imurl);[/code:1]
After the from in imagecreatefrom add the extension of the image you are going to use.
Now scroll down to where it says
[code:1]$tc = imagecolorallocate($im,0,0,0);[/code:1]
If you want a color other than black then edit the three 0's to the colors you want for them. The 0's correspond to the RGB colors. If you want black then leave it alone. On the opposite side of the spectrum white would be 255,255,255.
Find where it says
[code:1]return image($im);[/code:1]
After the image part add the extension of your image, so if you are using a png it should be:
[code:1]return imagepng($im);[/code:1]
If you going to use a jpeg then the correct code would be:
[code:1]return imagejpeg($im,'',100);[/code:1]
Where the last number is the quality of the image, 0 being the worst and 100 being the best.
Now then open up shoutboxshout.php and shoutboxinstall.php and edit the code that says:
[code:1]$mypass = "MySQL pass goes here";
$myuser = "MySQL user goes here";
$mydb = "MySQL Database goes here";
$myhost = "localhost";[/code:1]
If the host you are using already offers a MySQL database along with PHP then leave $myhost alone, otherwise change it to the host of your MySQl database. Next upload all the files then run shoutboxinstall.php in order to create your table for you shouts. When that is done you can delete it.
And if all goes well you have just created a shoutbox for your sig, yay =^-^=. Have fun with it.
Note: This code was inspired by Cremonte. If it wasn't for him making his shoutboxes I would of never made this code. All credit for the shoutboxes should rightfully go to him
But if you're feeling generous you can send a donation to me because I worked so hard to make this code ^_^;;;
If you don't have a MySQL database or you don't want to use a different host for one then you can use Rayquazza's flatfile version, yay for Ray =^-^=:
Sig.php:
[code:1]<?php
$im = ImageCreateFrompng('try.png'); // your image
$im2 = imagecreatetruecolor(425, 250); // size of your image
$white = imagecolorallocate($im, 85, 85, 85);
imagefill($im2, 0, 0, $white); // fille the background image
ImageCopyMerge($im2, $im, 0, 0, 0, 0, ImagesX($im), ImagesY($im), 100);
$file = file_get_contents('messagelog.txt');
$file = explode("n", $file);
$ln = count($file);
$e = 1;
// Write text on image starting from bottom up. (newest on bottom)
for ($i = 7; $i > 0; $i--) {
$j = $i - 1;
$vertdist = $e * 15;
$vertdist = $vertdist + 10;
$lnc = $ln - $i;
$string = $file[$lnc];
switch ($col) {
case 0;
imagestring($im2, 2, 110, $vertdist, $string, $white);
break;
case 1;
imagestring($im2, 2, 10, $vertdist, $string2, $white);
break;
case 2;
imagestring($im2, 2, 110, $vertdist, $string3, $white);
break;
case 3;
imagestring($im2, 2, 110, $vertdist, $today, $white);
break;
default:
imagestring($im2, 2, 110, $vertdist, $whatis, $white);
}
$e++;
}
header("Content-type: image/png" wink ; // tell browser it's an image
imagepng($im2); // send image
imagedestroy($im2); // free resources
?> [/code:1]
Submit.php:
[code:1]<html><body><center><br><br><br><br><br><br><br><br><br><form action="submit.php" method="POST">
Name: <input type="text" name="username" maxlength='19'><font color="red">*</font><br>
Message / Action: <input type="text" name="message" maxlength='27'><font color="red">*</font><br>
<input type="submit" value="Submit"><br>
</form></center>
<body></html>
<?php
$message = stripslashes($_POST['message']);
$username = stripslashes($_POST['username']);
$password = stripslashes($_POST['password']);
//define vars
if (!empty($username) && !empty($message)){
//checks if all inputs are set
$fh = fopen("messagelog.txt", "a+"); // sends stuff to logfile
fwrite($fh, " " . $username . " says: " . $message . "n" wink ;
fclose($fh);
echo "<center>Successful. Check <a href='sig.php'>the shoutbox</a>.";
}
else {
echo "<center>All fields marked with an <font color="red">*</font> are necesary.<br>";
}
?> [/code:1]
http://www.oinko.net/freephp/ is a site that shows a list of hosts that offer php and MySQL, thanks dstar ^_^.