Programming Programming
Google Teaches MySQL
PHP Jukebox Tutorial
Clear Screen in PHP
Rebuilding Apache Logs
Zipping Files with PHP
Del.icio.us Query String Hack
PHP Blogging Tricks
PHP link validator
Google Video for Programming
Newby Webmaster Tips
Cool Pictures All Categories
Internet Videos [ 576 x RSS ]
Front Page [ 118 x RSS ]
Cool Pictures [ 57 x RSS ]
Cool Sites [ 55 x RSS ]
Video Tutorial [ 19 x RSS ]
My Websites
Best of The Internet
Free Video Tutorials
Best of Youtube
Use Google to Download mp3s
Free Quiz Creator
Online Education
Poetry
Famous Poetry
Printable Sheet Music
JimmyR on Youtube
Free Movies Online

Saturday, 26th of January 2008 (26-01-2008)

PHP Blogging Tricks

Auto Ping Me!

Use the fopen function along with a pingomatic or pingoat URL.

$handle = fopen("http://www.thepingotmaticurl.csdf?sfasdf", "r");

Just add it to the end of your code after the part the RSS is built automatically.

Auto Link

Say you have other blog categories and sites you want to automatically link for certain keywords. Just use an ereg expression.

$url=ereg_replace('bored',
'<a href="http://www.jimmyr.com/bored.php">bored</a>',$url);

No BOT Spam Comments

Most people don't need one of those fancy scripts that generates random images with crazy backgrounds. Just ask your users a simple question. Spell 1? ____ If someone happens to make a bot that accomodates to your blog, which is horridly unlikely, unless you have some smart enemies, just chance the question.

Adding this is really easy, and comes in two parts. Add this to your comment form.

Spell one:
<input type="text" name="human" value="" SIZE=3 maxlength="3">

Now just add this to your action="whatever.php" code from the same form.

if (!($strtoupper($_POST['human'])=="ONE"))
{ exit; }

This simply sets their post to uppercase so it doesn't matter what case they write it in, and checks if it is the string "ONE". If they get the answer wrong, it exits the script.

Ignore really short comments

Who cares about comments that say "great" with no detail? I rather have comments that contribute something to the blog. To ignore short comments:

if (strlen($comment)<30){ exit; }

Not that you should change $comment to whatever your variable the program uses to hold the comment.

Too long comments

You can limit posts length in the php.ini and you can just add this code.

if (strlen($comment)>2000){ exit; }

Blocking Links

if (ereg("HTTP://",strtoupper($comment))){
echo "No links please...";
 exit;
}

You can also use this code and change http:// to something like ASDF or IDIOT to block out jibberish and curse words.

NoFollow

In your linking script, or if you link them directly withhtml, instead of a href= write a rel="nofollow" so that search engines don't follow the links in your blog and crawl more of your site. This is kind of controvercial, because it makes the browser not count them for pagerank, but it's best done with external comments by users.

Download mp3s Faster than limewire free!

Checkout my Mp3 and files search that uses google to find music/albums, anime, games and movies with direct downloads. It's very safe and easy to use, just search for a song, then right click save as to download it.

My new Blog

See my new funny pictures blog. I accidently deleted some of the old blogging software which I made, so I just rewrote everything from scratch. This blog won't be updated anymore =/.

Free Video Tutorials

I make video tutorials on a variety of topics on youtube. Please help me out by adding me as a friend if you have a youtube account. It really helps.

Free TV from Youtube!

Random: Cute Pets | Video Tutorial | TV | Funny | Anime

Clicking the links above will give you a random but extremely high rated video. There are over 15,000 awesome videos indexed so click as many times as you'd like.



Save To Del.icio.us, Submit to Digg, Stumble it!


Share This Page


Table of Contents

  1. PHP Blogging Tricks
  2. Auto Ping Me!
  3. Auto Link
  4. No BOT Spam Comments
  5. Ignore really short comments
  6. Too long comments
  7. Blocking Links
  8. NoFollow

Featured on JimmyR.com

Funny Test Answers
[comic] Bunny Suicides
Baby Can't Stop Laughing
Free Movies Online
Video Game Time Attacks
Cool Magic Videos
Picture Everyday Videos
Funny Cat Videos
Complete List of Videos

Add me On Youtube

Add me

My Video Tutorials

Youtube Video Tutorials

Google