If you know exactly what modules you plan to use with a website, and you are sure you don’t need the flexibility of adding in those modules later, you can compile Apache with the modules built in. Here is the configuration statement for a minimal Apache compile with server side includes. This was for an […]
Compiling Built in Modules with Apache2
Redirecting a Web Page With Javascript
If you need to redirect a web site, just put the following html in place of the page you want to redirect: <head> <script type=”text/javascript”> <!– setTimeout(‘Redirect()’,2000); function Redirect() { location.href=’http://newdomain.com/’; } //–> </script> <html> <body> This site is no longer located here. <br /> You will be redirected in 2 seconds. Please update your […]
Using SSI and Javascript to Report Client IP Address
To set a variable to the remote IP address of the client, use this: var ip = ‘<!–#echo var=”REMOTE_ADDR”–>’; Apache needs the include module either loaded or compiled in. Also, these options need to be specified in httpd.conf: AddHandler server-parsed .shtml AddOutputFilter INCLUDES .shtml Options Includes Check out this page for more information about SSI.
Geronimo Initial Install
Geronimo is an open-source, certified J2EE server. The installation is really quite simple. The first thing we did was to make sure we had the latest Sun JDK from here and got rid of our included GCC Java: # rpm -e java-1.4.2-gcj-compat-1.4.2.0-27jpp # rpm -e gcc-java-3.4.3-22.1 [root@srv-1 java]# ls jdk-1_5_0_05-linux-i586-rpm.bin jre-1_5_0_04-linux-i586.rpm jre-1_5_0_04-linux-i586-rpm.bin [root@srv-1 java]# chmod […]
Using Magic Quotes in PHP to Convert Quotes From Files
To load up a variable with the contents of a file with PHP, you can use this command: $filecontents=file_get_contents(“path to file”); One problem is that we had for this in our application was quotes. The text in the file had both ‘ and “. Magic quotes automatically convert quotes to escaped quotes so that when […]
Using XAMPP for Cross Platform GNU/Linux Mac OS X PHP/MySQL
We wrote about the XAMPP project in this article. This project is perfect for maintaining a cross platform dev environment for an application we are currently working on. Most of the work is done on OS X, but we also do some work on GNU/Linux. Further, the target audience for this may very well use […]
Match on Field Contents with PHP/MySQL
If you wish to search for a match within a field, rather than matching the entire field with a MySQL query, you can use LIKE. Here is an HTML page that will display an input box on a form: <html> <head> <title>Search</title> </head> <body bgcolor=”white”> <form method=”POST” action=”search.php”> <table> <col span=”1″ align=”right”> <tr> <td><font color=”blue”>Search […]
Changing Images on Mouseover with JavaScript
I was digging around, trying to find out, what, exactly, was needed to change a graphic on mouseover. I knew that this was a JavaScript function, and figured I could find some easy docs on how to do this. Perhaps I’m slow, but most of the scripts out there were a bit too convoluted. True, […]
Capturing Selected Text with JavaScript
Here is a way to capture text that is selected within a textarea box. As with this article, I have only included what is necessary for the script to function on a recent browser like IE or Mozilla/Firefox. For an example of how to do this outside a textarea box with even more stringent browser […]
How to Redirect After HTML Output With PHP and JavaScript
You can’t use PHP to change the header information with the header function after HTML output has begun. If you do, you will get an error like: Warning: Cannot modify header information – headers already sent by … What you can do, midstream, though, is use a meta tag: echo “<meta http-equiv=’Refresh’ content=’0; URL=location.php?date=”.$date.”‘>”; This […]
Passing Variables Between PHP and JavaScript – Full App
Here is a single PHP/HTML script that will read a journal entry from a MySQL database, show the entry on the current web page, and add selected text from the displayed web page into the appropriate category choosen with buttons that have cool mouseover effects. The plum of this code is the use of the […]
Upgrading Apache With Compiled-in Modules
See this article for information on compiling Apache with compiled-in modules. We find that this works well in some cases. The big problem, though, is you have to be very careful that you don’t break your website at upgrade time. There are some options to httpd that help with this. The -l option will list […]
Configuring Awstats With Static Pages
For years we have run our own homebrew web stats application out of frustration with currently available tools. Well, web stats packages have certainly improved over the years, and we decided to implement AWStats on one of our servers. We are doing this on a Red Hat Enterprise 4 box with Apache 2, so some […]
Adding PHP Support to Apache
Assuming that you have PHP installed, and the module available for Apache, these lines need to be in httpd.conf for PHP support: DirectoryIndex index.php index.html <Files *.php> SetOutputFilter PHP SetInputFilter PHP LimitRequestBody 10000000 </Files> AddType application/x-httpd-php .php Now, these lines are often in other files that are included; however, if .php pages just spew the […]
Setting Background and Font Properties with CSS
If you wish to simply set a default background color and font style for your web pages, create a css file like this: body { background-color: #000000; font-size: 14pt; color: #00FF00; font-family: monospace ; } td { background-color: #000000; font-size: 14pt; color: #00FF00; font-family: monospace ; } pre { background-color: #000000; font-size: 10pt; color: #00FF00; […]
Implications of JavaScript Onkeypress Event and AJAX
Check out this article: Using JavaServer Faces Technology with AJAX This shows a web application that will autocomplete what you type by sending data from a partial field entry to the server. These partial field entries are a web request of some kind to some site. This shows the fine line between endpoints of a […]
Converting RSS Feeds to HTML with Perl
There is an old perl script called rss2html.pl available here that will convert XML feeds to HTML.. Let’s take the Security Focus feed (http://www.securityfocus.com/rss/vulnerabilities.xml) and create some HTML: perl rss2html.pl http://www.securityfocus.com/rss/vulnerabilities.xml Here is what the output looks like when rendered: SecurityFocus Vulnerabilities Vuln: TWiki Arbitrary File Upload Vulnerability Vuln: OpenOffice Arbitrary Macro Execution Vulnerability […]
Setting Joomla Directory Permissions
The main thing that needs to be changed during a Joomla install is the directory permissions. Here is a shot of the install application before fixing the permissions: administrator/backups Unwriteable administrator/components Unwriteable administrator/modules Unwriteable administrator/templates Unwriteable cache Unwriteable components Unwriteable images Unwriteable images/banners Unwriteable images/stories Unwriteable language Unwriteable mambots Unwriteable mambots/content Unwriteable mambots/editors Unwriteable mambots/editors-xtd […]
Changing Administration Port on SharePoint 2007
SharePoint 2007 chooses a random port for administration. This is particularly difficult when choosing the single server configuration. Use the stsadm command to change the administration port number on MOSS 2007 / WSS 3.0. Go to this directory: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN> Enter this command: stsadm -o setadminport -port 4444 It will take […]
Fixing Access Denied Error When Activating Office SharePoint Server Publishing Infrastructure
If you don’t activate Publishing Resources when you first install SharePoint (MOSS 2007), when you try and activate it later via site collection features, you might see an access denied error when activating. You can manually activivate Publishing Resources via stsadm: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN> stsadm -o activatefeature -name PublishingResources -url http://website Operation […]