Home arrow PHP arrow Page 5 - Chatter

Secure it - PHP

This tutorial shows you how to make a ChatterBlock. ChatterBlocks are small windows where users can type in messages. They're also called Shout Boxes or TagBoards and are kind of like miniature chat rooms.

TABLE OF CONTENTS:
  1. Chatter
  2. Configuration
  3. View Chatter
  4. Manage the Chatter
  5. Secure it
By: Roger Stringer
Rating: starstarstarstarstar / 29
November 08, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

You may have noticed that cbadmin.php calls a file called accesscontrol.php on the first line. This file is used to place a password on your chatterblock admin area.

<?php
$adlogin = "test";
$adpassword = "test";
if (!isset($PHP_AUTH_USER)) {
header('WWW-Authenticate: Basic realm="ChatterBlock Admin"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
} else if (isset($PHP_AUTH_USER)) {
if (($PHP_AUTH_USER != $adlogin) || ($PHP_AUTH_PW != $adpassword)) {
header('WWW-Authenticate: Basic realm="ChatterBlock Admin"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
}else{
session_register("aid");
session_register("apass");
}
}
?>

Save this file as accesscontrol.php, and you will now have password protection on your ChatterBlock Admin script.

Conclusion

That's it. A quick and fast tutorial. This chatterblock is very basic, can post and can view. It doesn't really have other nifty functions such as smilies or profanities checking. Once you get the basic chatterblock, you can always add features and functions later on.



 
 
>>> More PHP Articles          >>> More By Roger Stringer
 

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 4 - Follow our Sitemap

Dev Shed Tutorial Topics: