DevSnips.com Code Snippet Repository
search:    


Navigation
  Home
About
Library
Contact
 
Snippet Library
  ColdFusion   338  
  ASP   201  
  PHP   101  
  HTML   11  
  JavaScript   77  
  XML   2  
  CSS   5  
  SQL   13  
  JSP   2  
  C#   1  
  ASP.NET   0  
  Submit a Code Snippet
 
Blog Archive
  September 2007
August 2007
July 2007
June 2007
May 2007
November 2006
October 2006
Search Archives
 
Random Affiliates
  PHP Arch
ReviewMe!
BioMetric Base
Uno-Code

Want to become an affiliate?
Read more...


Privacy Policy
© 2010

Blog Archive

 
Program your own social bookmark plugin

Do you have a custom Content Management System (CMS) and wanted to include a handy way for your viewers to link to many of the popular social bookmarking sites like Ma.gnolia.com, Technorati or Digg? Many of the popular blogging applications (drupal, WordPress, etc) have plugins for this, but I wrote my own function, since I don't normally use those applications. I thought I'd pass it along to anyone that is interested.

First you will need to download a zip archive of png images. You can download that here.

Next, we'll need to create a database table to store our bookmark information. This will store linkage format, image and bookmark site. We will treat our URLs as templates, with placeholders for URL and your blog title.

Read the full article >>


Submitted on 11/20/06 at 9:55PM
Post Comment | Read | Comments: 18
Bookmark to:
Add 'Program your own social bookmark plugin' to Del.icio.us Add 'Program your own social bookmark plugin' to digg Add 'Program your own social bookmark plugin' to FURL Add 'Program your own social bookmark plugin' to blinklist Add 'Program your own social bookmark plugin' to reddit Add 'Program your own social bookmark plugin' to Feed Me Links Add 'Program your own social bookmark plugin' to Technorati Add 'Program your own social bookmark plugin' to Yahoo My Web Add 'Program your own social bookmark plugin' to Newsvine Add 'Program your own social bookmark plugin' to Socializer Add 'Program your own social bookmark plugin' to Ma.gnolia Add 'Program your own social bookmark plugin' to Stumble Upon Add 'Program your own social bookmark plugin' to Google Bookmarks Add 'Program your own social bookmark plugin' to RawSugar Add 'Program your own social bookmark plugin' to Squidoo Add 'Program your own social bookmark plugin' to Spurl Add 'Program your own social bookmark plugin' to BlinkBits Add 'Program your own social bookmark plugin' to Netvouz Add 'Program your own social bookmark plugin' to Rojo Add 'Program your own social bookmark plugin' to Blogmarks Add 'Program your own social bookmark plugin' to Shadows Add 'Program your own social bookmark plugin' to Simpy Add 'Program your own social bookmark plugin' to Co.mments Add 'Program your own social bookmark plugin' to Scuttle


Search Engine Optimization (SEO) : Tune up your META

Today I wanted to discuss the importance of META tags for Search Engine Optimization. To generate traffic to your site you must ensure that your site or blog is well indexed and the proper keywords have good weight in your site. I recently found the "Meta Tag Analyzer" tool located here.

The first step is to input your URL, select the visiting UserAgent (defaults to GoogleBot), but you can supply your own Agent if needed.

After the script analyzes your site, you'll be presented with a report. This report has some great information including warnings and errors that you should correct. One common error that occurs is creating values that are not robot friendly due to length. This tool will let you know if you have too many keywords or if your title is too long.

Read the full article >>


Submitted on 11/18/06 at 1:48PM
Post Comment | Read | Comments: 5
Bookmark to:
Add 'Search Engine Optimization (SEO) : Tune up your META' to Del.icio.us Add 'Search Engine Optimization (SEO) : Tune up your META' to digg Add 'Search Engine Optimization (SEO) : Tune up your META' to FURL Add 'Search Engine Optimization (SEO) : Tune up your META' to blinklist Add 'Search Engine Optimization (SEO) : Tune up your META' to reddit Add 'Search Engine Optimization (SEO) : Tune up your META' to Feed Me Links Add 'Search Engine Optimization (SEO) : Tune up your META' to Technorati Add 'Search Engine Optimization (SEO) : Tune up your META' to Yahoo My Web Add 'Search Engine Optimization (SEO) : Tune up your META' to Newsvine Add 'Search Engine Optimization (SEO) : Tune up your META' to Socializer Add 'Search Engine Optimization (SEO) : Tune up your META' to Ma.gnolia Add 'Search Engine Optimization (SEO) : Tune up your META' to Stumble Upon Add 'Search Engine Optimization (SEO) : Tune up your META' to Google Bookmarks Add 'Search Engine Optimization (SEO) : Tune up your META' to RawSugar Add 'Search Engine Optimization (SEO) : Tune up your META' to Squidoo Add 'Search Engine Optimization (SEO) : Tune up your META' to Spurl Add 'Search Engine Optimization (SEO) : Tune up your META' to BlinkBits Add 'Search Engine Optimization (SEO) : Tune up your META' to Netvouz Add 'Search Engine Optimization (SEO) : Tune up your META' to Rojo Add 'Search Engine Optimization (SEO) : Tune up your META' to Blogmarks Add 'Search Engine Optimization (SEO) : Tune up your META' to Shadows Add 'Search Engine Optimization (SEO) : Tune up your META' to Simpy Add 'Search Engine Optimization (SEO) : Tune up your META' to Co.mments Add 'Search Engine Optimization (SEO) : Tune up your META' to Scuttle


Connecting to eBay's API to return real-time auction information for your web site.

eBay offers multiple ways of gathering and displaying auction information for your web site. For example they offer the following methods in their affiliate program:
Editor Kit - javascript based content that pulls auction data (very simple to use)
RSS Feed Generator - eBay offers RSS feeds, where you would be able to pull the feed and parse the XML for your page.
Flexible Destination Tool - Simple re-write of a link to attach your affiliate information. My example will use this as well.
API Developer Kit - Communicating with eBay's web service to return XML results.

The first step is to join eBay's affiliate program (You must have a valid eBay account first). http://affiliates.ebay.com/

By joining (eBay uses CommissionJunction), you'll be able to monetize your site by presenting auctions and with every click you could cash in on commissions.

The next step is to join the eBay developers program. You will need to do this to begin working with their API tools/services. http://developer.ebay.com/join/

After joining the developer program, create development keys. These keys are required for communicating with their web service and they are also used to generate the user authentication token.
http://developer.ebay.com/DevZone/account/keys.asp

Once keys are made it's time to create your authentication token.
http://developer.ebay.com/tokentool/

Once you've joined all the programs, have your keys and authentication token, it's time to write some code!

First, we'll assign some local variables with the keys and token we created earlier. eBay also provides a 'sandbox' server to test with. Please do your testing here first, and after all things are working, change it to the production server.

Read the full article >>


Submitted on 11/11/06 at 10:51AM
Post Comment | Read | Comments: 7
Bookmark to:
Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Del.icio.us Add 'Connecting to eBay's API to return real-time auction information for your web site.' to digg Add 'Connecting to eBay's API to return real-time auction information for your web site.' to FURL Add 'Connecting to eBay's API to return real-time auction information for your web site.' to blinklist Add 'Connecting to eBay's API to return real-time auction information for your web site.' to reddit Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Feed Me Links Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Technorati Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Yahoo My Web Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Newsvine Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Socializer Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Ma.gnolia Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Stumble Upon Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Google Bookmarks Add 'Connecting to eBay's API to return real-time auction information for your web site.' to RawSugar Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Squidoo Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Spurl Add 'Connecting to eBay's API to return real-time auction information for your web site.' to BlinkBits Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Netvouz Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Rojo Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Blogmarks Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Shadows Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Simpy Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Co.mments Add 'Connecting to eBay's API to return real-time auction information for your web site.' to Scuttle


How-to to dump line items from a text file into a MySQL database using PHP

Here is a quick how-to to dump line items from a text file into a database. You can also use INFILE for mysql if you're using CSV. This example is if you're needing to pull line items and then manipulate the data for whatever reason prior to inserting into a MySQL database.

This uses two important functions. fopen() and fgets(). fopen() will open the file. The 'r' flag is for 'reading'. Other possible parameters would include 'a' for 'appending' and 'w' for writing. After opening a file handle to the file, use fget() to grab the contents into a buffer. These will be individual lines in the file. My example explodes on the colon, but you could parse any data at this point and assign values to local variable.

Read the full article >>


Submitted on 11/09/06 at 11:39PM
Post Comment | Comments: 0
Bookmark to:
Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Del.icio.us Add 'How-to to dump line items from a text file into a MySQL database using PHP' to digg Add 'How-to to dump line items from a text file into a MySQL database using PHP' to FURL Add 'How-to to dump line items from a text file into a MySQL database using PHP' to blinklist Add 'How-to to dump line items from a text file into a MySQL database using PHP' to reddit Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Feed Me Links Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Technorati Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Yahoo My Web Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Newsvine Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Socializer Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Ma.gnolia Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Stumble Upon Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Google Bookmarks Add 'How-to to dump line items from a text file into a MySQL database using PHP' to RawSugar Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Squidoo Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Spurl Add 'How-to to dump line items from a text file into a MySQL database using PHP' to BlinkBits Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Netvouz Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Rojo Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Blogmarks Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Shadows Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Simpy Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Co.mments Add 'How-to to dump line items from a text file into a MySQL database using PHP' to Scuttle


Client side validation on Multi-Select form control when working with PHP

Today I wanted to talk about how to do client side validation on a multiselect form control in PHP environment. PHP handles the multiselect form control a little differently in the $_POST array. For this to be sent to the server side script and contain multiple elements, the control name must include [].

<select name="foo[]" multiple="yes" size="5">
....
</select>

This will make $_POST["foo"] and array, where you can then loop through the array object and handle the selected options. I recently ran into a problem with validation. I normally like to do both server side and client side validation on my form objects. I do client side validation just for the sake of client convenience. This will save a server call to find out that something is required or invalid. This is 'fake' security, since you cannot trust the client for proper validation, since they can turn off JavaScript, etc. So I always back up my validation with server side handling to ensure that data is clean.

Read the full article >>


Submitted on 11/07/06 at 2:19PM
Post Comment | Comments: 0
Bookmark to:
Add 'Client side validation on Multi-Select form control when working with PHP' to Del.icio.us Add 'Client side validation on Multi-Select form control when working with PHP' to digg Add 'Client side validation on Multi-Select form control when working with PHP' to FURL Add 'Client side validation on Multi-Select form control when working with PHP' to blinklist Add 'Client side validation on Multi-Select form control when working with PHP' to reddit Add 'Client side validation on Multi-Select form control when working with PHP' to Feed Me Links Add 'Client side validation on Multi-Select form control when working with PHP' to Technorati Add 'Client side validation on Multi-Select form control when working with PHP' to Yahoo My Web Add 'Client side validation on Multi-Select form control when working with PHP' to Newsvine Add 'Client side validation on Multi-Select form control when working with PHP' to Socializer Add 'Client side validation on Multi-Select form control when working with PHP' to Ma.gnolia Add 'Client side validation on Multi-Select form control when working with PHP' to Stumble Upon Add 'Client side validation on Multi-Select form control when working with PHP' to Google Bookmarks Add 'Client side validation on Multi-Select form control when working with PHP' to RawSugar Add 'Client side validation on Multi-Select form control when working with PHP' to Squidoo Add 'Client side validation on Multi-Select form control when working with PHP' to Spurl Add 'Client side validation on Multi-Select form control when working with PHP' to BlinkBits Add 'Client side validation on Multi-Select form control when working with PHP' to Netvouz Add 'Client side validation on Multi-Select form control when working with PHP' to Rojo Add 'Client side validation on Multi-Select form control when working with PHP' to Blogmarks Add 'Client side validation on Multi-Select form control when working with PHP' to Shadows Add 'Client side validation on Multi-Select form control when working with PHP' to Simpy Add 'Client side validation on Multi-Select form control when working with PHP' to Co.mments Add 'Client side validation on Multi-Select form control when working with PHP' to Scuttle


php | architect (The magazine for PHP professionals)

I wanted to talk about PHP Architect. This is an absolutely great magazine and a must-have for any PHP programmers out there. This is a print magazine, but you can subscribe to a PDF version as well, or get the magazine in both formats.

The articles are in-depth and are geared toward serious PHP programming. No "Hello World" examples in here. Topics range from XML to Security to PHP frameworks. I find it incredibly useful for getting new ideas, or to find new directions to research to stay with the current development of PHP.

One thing that I've always appreciated is that fact that PHP Architect takes a default approach to security. Nothing grinds me more than examples without any security considerations. They expect you to add security later, but don't realize that they might be causing more harm than good. PHP Architect seems to always have security and good practice in all of their examples.

Read the full article >>


Submitted on 11/06/06 at 12:35AM
Post Comment | Comments: 0
Bookmark to:
Add 'php | architect (The magazine for PHP professionals)' to Del.icio.us Add 'php | architect (The magazine for PHP professionals)' to digg Add 'php | architect (The magazine for PHP professionals)' to FURL Add 'php | architect (The magazine for PHP professionals)' to blinklist Add 'php | architect (The magazine for PHP professionals)' to reddit Add 'php | architect (The magazine for PHP professionals)' to Feed Me Links Add 'php | architect (The magazine for PHP professionals)' to Technorati Add 'php | architect (The magazine for PHP professionals)' to Yahoo My Web Add 'php | architect (The magazine for PHP professionals)' to Newsvine Add 'php | architect (The magazine for PHP professionals)' to Socializer Add 'php | architect (The magazine for PHP professionals)' to Ma.gnolia Add 'php | architect (The magazine for PHP professionals)' to Stumble Upon Add 'php | architect (The magazine for PHP professionals)' to Google Bookmarks Add 'php | architect (The magazine for PHP professionals)' to RawSugar Add 'php | architect (The magazine for PHP professionals)' to Squidoo Add 'php | architect (The magazine for PHP professionals)' to Spurl Add 'php | architect (The magazine for PHP professionals)' to BlinkBits Add 'php | architect (The magazine for PHP professionals)' to Netvouz Add 'php | architect (The magazine for PHP professionals)' to Rojo Add 'php | architect (The magazine for PHP professionals)' to Blogmarks Add 'php | architect (The magazine for PHP professionals)' to Shadows Add 'php | architect (The magazine for PHP professionals)' to Simpy Add 'php | architect (The magazine for PHP professionals)' to Co.mments Add 'php | architect (The magazine for PHP professionals)' to Scuttle


Creating a simple RSS XML feed using PHP

RSS is a great way to syndicate content of your site. RSS readers are becoming more and more popular. Also community web site such as technorati and ping-o-matic make it great to share and post your content/blogs. RSS is the future, so it's best to get on it.

This how-to will explain how to create a RSS/XML feed using PHP and cron to do a daily XML dump of content stored in a database.

The first step is to create a directory above the web root. Let's name it /cron. In this directory we'll create a PHP-CLI script or command-line script. This script will be executed by cron.daily, so every night at 3AM this script will run. This will not need any interaction with a web browser, but you'll need the ability to create an executable PHP script on the web server and have access to your crontab.

Next let's create the file rss.php in our newly created /cron directory. I'll break it down and explain it as we go through the script. After creating the file we need to assign the interpreter to process the script.

#!/usr/bin/php
<?

Read the full article >>


Submitted on 11/05/06 at 1:58PM
Post Comment | Read | Comments: 5
Bookmark to:
Add 'Creating a simple RSS XML feed using PHP' to Del.icio.us Add 'Creating a simple RSS XML feed using PHP' to digg Add 'Creating a simple RSS XML feed using PHP' to FURL Add 'Creating a simple RSS XML feed using PHP' to blinklist Add 'Creating a simple RSS XML feed using PHP' to reddit Add 'Creating a simple RSS XML feed using PHP' to Feed Me Links Add 'Creating a simple RSS XML feed using PHP' to Technorati Add 'Creating a simple RSS XML feed using PHP' to Yahoo My Web Add 'Creating a simple RSS XML feed using PHP' to Newsvine Add 'Creating a simple RSS XML feed using PHP' to Socializer Add 'Creating a simple RSS XML feed using PHP' to Ma.gnolia Add 'Creating a simple RSS XML feed using PHP' to Stumble Upon Add 'Creating a simple RSS XML feed using PHP' to Google Bookmarks Add 'Creating a simple RSS XML feed using PHP' to RawSugar Add 'Creating a simple RSS XML feed using PHP' to Squidoo Add 'Creating a simple RSS XML feed using PHP' to Spurl Add 'Creating a simple RSS XML feed using PHP' to BlinkBits Add 'Creating a simple RSS XML feed using PHP' to Netvouz Add 'Creating a simple RSS XML feed using PHP' to Rojo Add 'Creating a simple RSS XML feed using PHP' to Blogmarks Add 'Creating a simple RSS XML feed using PHP' to Shadows Add 'Creating a simple RSS XML feed using PHP' to Simpy Add 'Creating a simple RSS XML feed using PHP' to Co.mments Add 'Creating a simple RSS XML feed using PHP' to Scuttle





Advertisements

Mozy.com, and insurance policy for your Hard Drive