Welcome, Guest

Please login or register

TUTORIALS SUBMENU

PHOTOSHOP    FLASH    ILLUSTRATOR    BLENDER    CINEMA 4D    WEB-CODING    [SUBMIT]

Related Links

The Complete Shoutbox Tutorial

pages (3): 1 2 [3]


A simple switch function has 4 or 5 cases, each of which are similar to using an IF statement.  To put it simply, our switch checks which option the user has chosen (i.e. add smilie, delete smilie, clear shoutbox, logout, nothing or posting) and then processes the correct code. The add smilie and delete smilie options are the only two that need further processing - the clear shoutbox and logout cases just handle themselves in a line or two.

The add smilie case provides the user with a basic form to input the original symbol i.e. =) or =O, and then a box to upload a replacement smilie image. There are no dimension protections in our script, but we should limit ourselves to images 15x15 pixels in size, or they will look silly when displayed in the shoutbox text. Transparent GIF’s are a good option, as they allow a whole multitude of different background colours.

The delete smilie case provides the user with a list all of the current smilies and, when the user clicks one, the posting case authenticates the click and deletes the appropriate smilie.

The posting case is based on the add smilie case. It first authenticates that the user wants to upload a smilie, then defines the directory to upload to, and uploads the file. It then puts the filename into the ALT and URL fields in the database with the Symbol equal to the symbol field on the form.

Emptying the shoutbox uses the SQL query: TRUNCATE TABLE [tablename] to completely empty the table, removing all shouts in the database in milliseconds.

if ( $_SESSION['admin_logged_in'] === 'true' )
{

Well… this just makes sure the user is logged in with administrator permissions before continuing. Now we can finally get out of functions and into the actual HTML of the page:

<html>
<head>
<title>Shoutbox Administration</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<p>Smilie administration: <a href="admin.php?mode=add">add smilie</a> | <a href="admin.php?mode=delete">delete smilie</a></p>
<p>Shoutbox administration: <a href="admin.php?mode=clear">clear shoutbox</a> | <a href="admin.php?mode=logout">logout</a></p>
<table width="600" border="1" cellpadding="5" bordercolor="#ccc">
<tr>
<td><?php selectAction($_GET['mode']); ?></td>
</tr>
</table>
</body>
</html>

This is just basic HTML with a title, some links and a content area that calls the selectAction function, providing it with the URL variable ‘mode’. This page probably won't validate through a HTML standards checker, but it is only meant as an example anyway.

<?php

// showing login form
} else {

echo '
<form action="admin.php" method="post" name="login">
<input name="username" type="text" value="username" size="25" maxlength="32"><br>
<input name="password" type="password" value="password" size="25" maxlength="32"><br>
<input name="login" type="submit" value="login">
</form>
';

}

mysql_close($l);
?>

This final snippet of code ensures that if the user isn’t logged in, he/she will be given a nice login form to inwardly digest instead...

Conclusion
Well, that’s pretty much everything! I hope you enjoyed reading this walkthrough as much as I enjoyed writing it (it took me HOURS as there are about 150 lines of code in each file, then I had to write all this too, and the first beta had a very stupid error in it that took me days to figure out... =P). That said, I hope this walkthrough has helped you in your quest for shoutbox-dom.

If you want to download these files in a completed format, just click here (.zip format). These files are 51% the property of Averill.co.nz Web Development and Robbie Averill and 49% the property of BioRUST. If you use them on your website, please show your appreciation by linking to us in return.  If you don't, we might have to remind you of the finer points of the GPL license under which these files are offered... ;)

If you have any problems please don’t hesitate to contact me by clicking my name below to visit my profile on the Forums, where you can Private Message or E-mail me. My contact information is also on this page if you don't want to register.

- Tutorial written by Scrowler

Pages (3): <Prev 1 2 [3]
Automatic Translations: Translate Into French Translate Into German Translate Into Italian Translate Into Spanish Translate Into Portuguese

Last 5 User Comments

User:  slepage95 (#63101)
Date: Mon Jun 07, 2010. 00:06:57

Post #4 of 4

Good tutorial^^ Just have one question, is there a way we can add sound when a message is received? Thanks

Reply to this post


User:  s3xyglass3s (#48812)
Date: Mon Mar 17, 2008. 14:07:43

Post #3 of 4

great work :D

I just have one question; how can you separate the action, that you have in the .fla file, and have a separate .as file?

I always get stuck there, and I have to make a shoutbox for school, with a separate .as file..

is it hard? can you show me?

Thnx

Steffy

Reply to this post


User:  Tamlin (#34751)
Date: Wed Nov 22, 2006. 00:25:26

Post #2 of 4

Quote from flores741;34750:
Nice work, but thought I might point out smilies is actually SMILES :D


If you mean these things: :) :) :lol: :ciao:
I think you'll find that in 99.99999% of the web they are called Smilies, not Smiles. :nyanya:

Short for "Smiley Face", I assume.

Reply to this post


User:  flores741 (#34750)
Date: Wed Nov 22, 2006. 00:04:43

Post #1 of 4

Nice work, but thought I might point out smilies is actually SMILES :D

Reply to this post


--- View Entire Thread ---
Amazing Font Pack!

Featured Tutorialsmore

Planetary Masses
Planetary Masses
- Adobe Photoshop -
Retro Style Text
Retro Style Text
- Adobe Photoshop -
Xpresso Tutorial -...
Xpresso Tutorial -...
- Maxon Cinema 4D -
Rock Textures
Rock Textures
- Adobe Photoshop -
Membership

Username:
Password:  
Remember Me

Lost Password? || Register

Related Links



Special Options
Download Source File
Printer Friendly Version
Forum Threads

 Deactivate Account
Author: jerinian
Posted: Oct 02nd, 11:16am
Activity: 1 replies, 887 views
 changes....
Author: supertackyman
Posted: Sep 12th, 2:56am
Activity: 2 replies, 1051 views
Back again and with free webhosting :)
Author: ngz
Posted: Aug 14th, 3:50pm
Activity: 0 replies, 1054 views
Cartoon Crab 6 Legs Walk Run created in Blender
Author: patricia3d
Posted: Jun 19th, 12:58pm
Activity: 0 replies, 1935 views
HTML Form Post Array to PHP
Author: Space Cowboy
Posted: May 25th, 2:18pm
Activity: 0 replies, 1832 views
My blog where i create Digi Scrapbook
Author: claudya07
Posted: May 11th, 2:33pm
Activity: 0 replies, 14441 views
Blood Dripping from Letters
Author: patricia3d
Posted: Apr 05th, 3:37am
Activity: 0 replies, 2751 views
A New Designer has joined the ranks
Author: skates1
Posted: Mar 28th, 2:19pm
Activity: 2 replies, 2772 views
The hole in Photoshop
Author: Mars
Posted: Feb 13th, 9:28pm
Activity: 2 replies, 3439 views
Colour Swatch
Author: ebz7350
Posted: Jan 15th, 11:18am
Activity: 0 replies, 2355 views
 BioRUST Forums - Reply to Topic
Author: inonShozy
Posted: Jan 11th, 11:32am
Activity: 8 replies, 2498 views
 Version 2 of my portfolio site.
Author: andrewnleon
Posted: Jan 08th, 6:18am
Activity: 6 replies, 2798 views
Forum Threads

--- Site Resources ---
Total Tutorials:212
Total Downloads:    441
Total Fonts:    4673