if $IE

July 11, 2009 by  
Filed under Geek Fun & Humor, PHP

I was working on a web project and I usually start with Firefox to test things. Then Safari, Chrome, and then IE. By the time I got to IE, I noticed that my hard work was just not viewable. Argh. So I tweeted out:

tweet-browsercheck

function browserCh() 
{ 
     $a = $_SERVER['HTTP_USER_AGENT']; 
     $IE = ((eregi("MSIE",$a) || eregi("Microsoft",$a)))==1; 

     if($IE) 
        return 'Bad Browser!';
}

I got a laugh at some of the responses.. :)

@honging : daynah, i prefer: <style type="text/css">* html body { display: none; }</style> ;)

@j_holtslander: @daynah that was kinda hot. LOL.

@robflynn43: @daynah Haha, browserCh() made me happy. You win a high five, redeemable any time you see me. =)

@ialexs@daynah :D (re: bad browser)

Related Products:

Furiously Happy: A Funny Book About Horrible ThingsFuriously Happy: A Funny Book About Horrible Things

#1 New York Times Bestseller

In Furiously Happy, a humor memoir tinged with just enough tragedy and pathos to make it worthwhile, Jenny Laws... Read More >

PHP: Learn PHP In 2 HoursPHP: Learn PHP In 2 HoursWelcome Future Coder! Are You Ready To Learn And Start Programming With PHP In 2 Hours? PHP or PHP Hypertext Preprocessor is a programming language, ... Read More >
The Joy of PHP: A Beginner's Guide to Programming Interactive Web Applications with PHP and mySQLThe Joy of PHP: A Beginner's Guide to Programming Interactive Web Applications with PHP and mySQLThird Edition now with bonus chapters. Have you ever wanted to design your own website or browser application but thought it would be too difficult or... Read More >

To Ruby From PHP

February 21, 2007 by  
Filed under PHP, Ruby

If you’re interested in learning Ruby, here is a list of all the simlarities and differences between Ruby and PHP.

Related Products:

Aimes Deluxe Luxury LED Electronic Men Wristwatches Blue Binary Luminous Sports Watches with Date SilverAimes Deluxe Luxury LED Electronic Men Wristwatches Blue Binary Luminous Sports Watches with Date Silver
* LED watches, stylish appearance, creative binary time mode dispaly.
* Double Open Stainless Steel Buckle, wear more convenient and solid. Read More >
Fire HD 10 Tablet with Alexa Hands-Free, 10.1" 1080p Full HD Display, 32 GB, Black - with Special OffersFire HD 10 Tablet with Alexa Hands-Free, 10.1" 1080p Full HD Display, 32 GB, Black - with Special Offers

The all-new Fire HD 10 features our largest display, now in 1080p Full HD, 32 GB storage, 2 GB RAM, and up to 10 hours of battery. Now with Alexa... Read More >

Practical Electronics for Inventors, Fourth EditionPractical Electronics for Inventors, Fourth Edition

A Fully-Updated, No-Nonsense Guide to Electronics

Advance your electronics knowledge and gain the skills necessary to develop and construct y... Read More >

PHP and Yahoo! Web Services APIs

February 20, 2007 by  
Filed under PHP, Software and Web Apps

Here’s a great source for information about using PHP with Yahoo! Web Services APIs.

  • HOWTO Articles to help you understand our technologies and how you can use them better with PHP.
  • Code Samples you can play with. Use them as a starting point for your own applications or study them for subtle nuances.
  • Browser-Based Authentication so you can let users authenticate using their Yahoo! id.
  • Other Resources out on the Web to help you use PHP and the Yahoo! APIs to their fullest.
  • Community Resources where you can join the mailing list and discuss the Yahoo! APIs with us and with other PHP developers.

Related Products:

Energizer AAA Batteries, Triple A Battery Max Alkaline (24 Count) E92BP-24Energizer AAA Batteries, Triple A Battery Max Alkaline (24 Count) E92BP-24

Long-lasting power and innovation is what the Energizer MAX family is all about. Meet our longest-lasting AA and AAA Energizer MAX batteries yet. T... Read More >

Fire HD 10 Tablet with Alexa Hands-Free, 10.1" 1080p Full HD Display, 32 GB, Black - with Special OffersFire HD 10 Tablet with Alexa Hands-Free, 10.1" 1080p Full HD Display, 32 GB, Black - with Special Offers

The all-new Fire HD 10 features our largest display, now in 1080p Full HD, 32 GB storage, 2 GB RAM, and up to 10 hours of battery. Now with Alexa... Read More >

Roku Streaming Stick+ | 4K/HDR/HD streaming player with 4x the wireless range & voice remote with TV power and volumeRoku Streaming Stick+ | 4K/HDR/HD streaming player with 4x the wireless range & voice remote with TV power and volumeExceptional wireless. Stunning picture quality. Start watching your favorites quickly and enjoy a smooth streaming experience. Whether you’re stream... Read More >

WordPress 1.5.1.3

July 8, 2005 by  
Filed under PHP, Scripts and Coding

Download WordPress 1.5.1.3 “Strayhorn”! It was released a few days ago. I’ll have to test it out later. :)

Related Products:

Roku Streaming Stick+ | 4K/HDR/HD streaming player with 4x the wireless range & voice remote with TV power and volumeRoku Streaming Stick+ | 4K/HDR/HD streaming player with 4x the wireless range & voice remote with TV power and volumeExceptional wireless. Stunning picture quality. Start watching your favorites quickly and enjoy a smooth streaming experience. Whether you’re stream... Read More >
Intel Core i7-8700K Desktop Processor 6 Cores up to 4.7GHz Turbo Unlocked LGA1151 300 Series 95W BX80684i78700KIntel Core i7-8700K Desktop Processor 6 Cores up to 4.7GHz Turbo Unlocked LGA1151 300 Series 95W BX80684i78700KOutstanding gaming experiences extend beyond personal gameplay to your entire gaming community. Share those experiences by live-streaming or recording, editing, and posting your epic highlights.
Energizer AAA Batteries, Triple A Battery Max Alkaline (24 Count) E92BP-24Energizer AAA Batteries, Triple A Battery Max Alkaline (24 Count) E92BP-24

Long-lasting power and innovation is what the Energizer MAX family is all about. Meet our longest-lasting AA and AAA Energizer MAX batteries yet. T... Read More >

Happy 10th Anniversary PHP!

June 8, 2005 by  
Filed under PHP

It has been 10 years since Rasmus released the first version of PHP! Wow. Happy 10th anniversary PHP!!

Related Products:

Tablet Stand Adjustable, Lamicall iPad Stand : Desktop Stand Holder Dock for new iPad 2017 Pro 9.7, 10.5, Air mini 2 3 4, Kindle, iPhone, Accessories, Tab, E-reader, other Tablets (4-13 inch) - SilverTablet Stand Adjustable, Lamicall iPad Stand : Desktop Stand Holder Dock for new iPad 2017 Pro 9.7, 10.5, Air mini 2 3 4, Kindle, iPhone, Accessories, Tab, E-reader, other Tablets (4-13 inch) - Silver

Lamicall iPad Pro Tablet Holder Stand
Large portable adjustable universal cradle for you lovely device when you are watching videos on YouTube... Read More >

Intel Core i7-8700K Desktop Processor 6 Cores up to 4.7GHz Turbo Unlocked LGA1151 300 Series 95W BX80684i78700KIntel Core i7-8700K Desktop Processor 6 Cores up to 4.7GHz Turbo Unlocked LGA1151 300 Series 95W BX80684i78700KOutstanding gaming experiences extend beyond personal gameplay to your entire gaming community. Share those experiences by live-streaming or recording, editing, and posting your epic highlights.
Fitbit Charge 2 Heart Rate + Fitness Wristband, Black, Large (US Version)Fitbit Charge 2 Heart Rate + Fitness Wristband, Black, Large (US Version)

Make every beat count with Fitbit Charge 2—the heart rate and fitness wristband built for all-day, workouts and beyond. PurePulse continuous h... Read More >

SPG: Simple PHP Gallery

March 30, 2005 by  
Filed under Daily Ramblings, PHP

I installed this Simple PHP Gallery script at work today and I just love it. I wanted a very lightweight script where I can just add photos and the links/gallery would create itself. And this was the perfect script. The layout is very easy to edit as well. There’s also a plugin for WordPress too. :)

Thanks for the script, Paul!

Related Products:

Tablet Stand Adjustable, Lamicall iPad Stand : Desktop Stand Holder Dock for new iPad 2017 Pro 9.7, 10.5, Air mini 2 3 4, Kindle, iPhone, Accessories, Tab, E-reader, other Tablets (4-13 inch) - SilverTablet Stand Adjustable, Lamicall iPad Stand : Desktop Stand Holder Dock for new iPad 2017 Pro 9.7, 10.5, Air mini 2 3 4, Kindle, iPhone, Accessories, Tab, E-reader, other Tablets (4-13 inch) - Silver

Lamicall iPad Pro Tablet Holder Stand
Large portable adjustable universal cradle for you lovely device when you are watching videos on YouTube... Read More >

Aimes Deluxe Luxury LED Electronic Men Wristwatches Blue Binary Luminous Sports Watches with Date SilverAimes Deluxe Luxury LED Electronic Men Wristwatches Blue Binary Luminous Sports Watches with Date Silver
* LED watches, stylish appearance, creative binary time mode dispaly.
* Double Open Stainless Steel Buckle, wear more convenient and solid. Read More >
Roku Streaming Stick+ | 4K/HDR/HD streaming player with 4x the wireless range & voice remote with TV power and volumeRoku Streaming Stick+ | 4K/HDR/HD streaming player with 4x the wireless range & voice remote with TV power and volumeExceptional wireless. Stunning picture quality. Start watching your favorites quickly and enjoy a smooth streaming experience. Whether you’re stream... Read More >

How to Connect to a MySQL Database using PHP

March 29, 2005 by  
Filed under Code Snippets, PHP, Scripts and Coding

I was helping my coworker yesterday to create her first PHP-Database program. She already knew how phpMyAdmin worked, so I created a sample page for her to show how to connect to the database and then retrieve data from a query. Maybe this sample page could help you too. I commented as much of the code as I could. Let me know if you have any questions.

Read more

Related Products:

MySQL: MySQL Tutorials for Beginners Basic to Advanced MySQL LanguagesMySQL: MySQL Tutorials for Beginners Basic to Advanced MySQL LanguagesMySQL is the most popular Open Source Relational SQL Database Management System. MySQL is one of the best RDBMS being used for developing various web-... Read More >
MySQL (5th Edition) (Developer's Library)MySQL (5th Edition) (Developer's Library)MySQL, Fifth Edition by Paul DuBois
The definitive guide to using, programming and administering MySQL 5.5 and MySQL 5.6

MySQL provide... Read More >
PHP and MySQL Web Development (5th Edition) (Developer's Library)PHP and MySQL Web Development (5th Edition) (Developer's Library)

PHP and MySQL Web Development, Fifth Edition

The definitive guide to building database-driven We... Read More >

WordPress Plugin: Theme Switcher

March 29, 2005 by  
Filed under PHP, Wordpress

I meant to post this a while ago, but I forgot. I installed the WordPress Theme Switcher plugin (written by Ryan) to test out all the themes (especially the ones I was submitting for Stacee).

To install it, just download this file, upload it to your /wp-content/plugins/ directory. Then activate it in the Admin control panel.

Now in your templates, add this to your sidebar:

<?php if (function_exists(‘wp_theme_switcher’)) { ?>
<li><h2><?php _e(‘Themes’); ?></h2>
<ul><?php wp_theme_switcher(); ?></ul>
</li>
<? } ?>

The if statement just says, if this function is available (if the theme is activated), then print the list of themes. Of course, you may customize the output however you want. There’s a little bit of PHP coding, but nothing to be too scared about. :)

Related Products:

Tablet Stand Adjustable, Lamicall iPad Stand : Desktop Stand Holder Dock for new iPad 2017 Pro 9.7, 10.5, Air mini 2 3 4, Kindle, iPhone, Accessories, Tab, E-reader, other Tablets (4-13 inch) - SilverTablet Stand Adjustable, Lamicall iPad Stand : Desktop Stand Holder Dock for new iPad 2017 Pro 9.7, 10.5, Air mini 2 3 4, Kindle, iPhone, Accessories, Tab, E-reader, other Tablets (4-13 inch) - Silver

Lamicall iPad Pro Tablet Holder Stand
Large portable adjustable universal cradle for you lovely device when you are watching videos on YouTube... Read More >

Uncle Milton Death Star Electronics Lab KitUncle Milton Death Star Electronics Lab KitConstruct real electronic circuits inside the Death Star as you activate authentic light and sound effects from Star Wars movies! Complete over 20 exp... Read More >
Intel Core i7-8700K Desktop Processor 6 Cores up to 4.7GHz Turbo Unlocked LGA1151 300 Series 95W BX80684i78700KIntel Core i7-8700K Desktop Processor 6 Cores up to 4.7GHz Turbo Unlocked LGA1151 300 Series 95W BX80684i78700KOutstanding gaming experiences extend beyond personal gameplay to your entire gaming community. Share those experiences by live-streaming or recording, editing, and posting your epic highlights.

How To Integrate WordPress with your Existing Website

March 27, 2005 by  
Filed under PHP, Wordpress

Jonathon writes a great tutorial on how to integrate WordPress with your existing website.

In the tutorial, you’ll find out how to create a blog that:

  • looks like its a part of our site
  • integrates seamlessly with our site
  • is cleaned up without all the extra features we (or our client) won’t need

Related Products:

Tablet Stand Adjustable, Lamicall iPad Stand : Desktop Stand Holder Dock for new iPad 2017 Pro 9.7, 10.5, Air mini 2 3 4, Kindle, iPhone, Accessories, Tab, E-reader, other Tablets (4-13 inch) - SilverTablet Stand Adjustable, Lamicall iPad Stand : Desktop Stand Holder Dock for new iPad 2017 Pro 9.7, 10.5, Air mini 2 3 4, Kindle, iPhone, Accessories, Tab, E-reader, other Tablets (4-13 inch) - Silver

Lamicall iPad Pro Tablet Holder Stand
Large portable adjustable universal cradle for you lovely device when you are watching videos on YouTube... Read More >

Fire HD 10 Tablet with Alexa Hands-Free, 10.1" 1080p Full HD Display, 32 GB, Black - with Special OffersFire HD 10 Tablet with Alexa Hands-Free, 10.1" 1080p Full HD Display, 32 GB, Black - with Special Offers

The all-new Fire HD 10 features our largest display, now in 1080p Full HD, 32 GB storage, 2 GB RAM, and up to 10 hours of battery. Now with Alexa... Read More >

Practical Electronics for Inventors, Fourth EditionPractical Electronics for Inventors, Fourth Edition

A Fully-Updated, No-Nonsense Guide to Electronics

Advance your electronics knowledge and gain the skills necessary to develop and construct y... Read More >

WordPress: How to Install Post View Count/Top 10 Plugin

March 24, 2005 by  
Filed under PHP, Scripts and Coding, Wordpress

I just installed this Top 10 Posts/Views Plugin by Laughing Lizard. It did take a little poking around to figure out what goes where. With the new addition of themes in WordPress 1.5, adding plugins now requires you to edit each theme. So far, I’ve only edited the default one. I’ll edit the other themes later, but I’m feeling lazy right now. ;)

If you do decide to install this plugin, here’s a tip. Read all the comments on this post, especially what Kilikina posted. Well, you can do that, or read this post which takes you step by step on how to install the plugin. I figured out what needed to go where thanks to Kilikina!

Here are the instructions on how to install the plugin for the default Kubrick theme:

  1. First add the new table using phpmyadmin
    create table mostAccessed
    (
    postnumber int not null,
    cntaccess int not null,
    primary key(postnumber),
    unique id(postnumber)
    );
  2. Open up the top10.php plugin file in notepad or some text editor. Change the two occurances of $p to $id. It should be only this line:
    <?php if ($p > 0) { add_count($p);}?>
    change to:
    <?php if ($id > 0) { add_count($id);}?>
  3. Upload top10.php into your plugin directory and activate it. (You should be familiar with this step if you installed other plugins. If not, please view this.
  4. In the “Post Template” file (single.php), add

    <?php if ($id > 0) { add_count($id);} ?>
    <ul><?php show_pop_posts(); ?></ul>

    Just before:

    <?php endwhile; else: ?>
    <?php _e('Sorry, no posts matched your criteria.'); ?></p>
  5. In the “Main Template” (index.php) of your theme, find:
    <?php comments_popup_link('Comments (0)', 'Comments (1)', 'Comments (%)'); ?>

    And add this line right below it:

    <?php show_post_count($post->ID, $before="(Visited ", $after=" times)"); ?>
  6. I hope this helps. I know I’ll be referring back to it later on. ;)

Related Products:

Kindle Paperwhite E-reader - Black, 6" High-Resolution Display (300 ppi) with Built-in Light, Wi-Fi - Includes Special OffersKindle Paperwhite E-reader - Black, 6" High-Resolution Display (300 ppi) with Built-in Light, Wi-Fi - Includes Special Offers

Featuring our highest resolution display, hand-crafted font Bookerly, and a new typesetting engine for even more beautiful rendering of pages. Our... Read More >

Fire HD 10 Tablet with Alexa Hands-Free, 10.1" 1080p Full HD Display, 32 GB, Black - with Special OffersFire HD 10 Tablet with Alexa Hands-Free, 10.1" 1080p Full HD Display, 32 GB, Black - with Special Offers

The all-new Fire HD 10 features our largest display, now in 1080p Full HD, 32 GB storage, 2 GB RAM, and up to 10 hours of battery. Now with Alexa... Read More >

Practical Electronics for Inventors, Fourth EditionPractical Electronics for Inventors, Fourth Edition

A Fully-Updated, No-Nonsense Guide to Electronics

Advance your electronics knowledge and gain the skills necessary to develop and construct y... Read More >

Random Splash Pages

April 26, 2002 by  
Filed under Code Snippets, PHP

I was looking through my email and found this email from Grace:

Hi Daynah! It’s me, Grace. I would like to ask a question if you don’t mind -_-; Sorry if I am bothering you. I would like to ask if how can I make random splash pages with php? Or do you know any scripts I could download for
that? Thank you so much. And hope you are having a great week =)

Here is a piece of code that Albert (my boyfriend) wrote. It creates an array of random images to use. It’s pretty simple to modify if you want to create random splash pages. If you have comments/questions, please leave them below.

<?php

// Function name: randomimage($showimage)
// Purpose: Create an array with random data for an image
// Use: Please link http://php-princess.net/
function randomimage($showimage)
{

    // ARRAY OF SPLASH IMAGES
    $bgimages = array('images/splash1.jpg','images/splash2.jpg',
                      'images/splash3.jpg','images/splash4.jpg',
                      'images/splash1.jpg','images/splash2.jpg',
                      'images/splash3.jpg','images/splash4.jpg');

    $bgtext = array ('Picture of Splash 1','Picture of Splash 2',
                     'Picture of Splash 3','Picture of Splash 4',
                     'Picture of Splash 1', 'Picture of Splash 2', 
                     'Picture of Splash 3', 'Picture of Splash 4');

    $bgmax = count($bgimages)-1;

    // Check if viewing additional image option is 
    // set / look for non-integer value passing
    if ((!isset($showimage)) || (!ereg ("^[0-9]{1,2}$", $showimage)))
    {
        srand((double)microtime()*1000000);    
        print_r($names);  

        srand ((double) microtime() * 10000000);

        $rand_keys = array_rand ($bgimages, 2);

        // obtain random image from array
        $bgimage = $bgimages[$rand_keys[0]];
        $bgalt   = $bgtext[$rand_keys[0]];
        $bgkey   = $rand_keys[0];
    }    

    return array($bgimage,$bgalt,$bgkey);
}

// Creates a list of the variables with random image 
list($bgimage,$bgalt,$bgkey) = randomimage($showimage);

// Put printout into variable $mainbody
$mainbody = ''.$bgalt.'';

// Print out $mainbody
print "$mainbody";

?>

Related Products:

Learning PHP, MySQL & JavaScript: With jQuery, CSS & HTML5 (Learning Php, Mysql, Javascript, Css & Html5)Learning PHP, MySQL & JavaScript: With jQuery, CSS & HTML5 (Learning Php, Mysql, Javascript, Css & Html5)The fully revised, updated and extended 4th edition of the hugely popular web development book - includes CSS, HTML5, jQuery and the mysqli extension.... Read More >
The Obesity Code: Unlocking the Secrets of Weight LossThe Obesity Code: Unlocking the Secrets of Weight LossFung zeroes in on why insulin resistance has become so prevalent and offers specific outside-the-box solutions that have emerged as the key to maximiz... Read More >