Embed Outlook Shapes within Screenshots

When sending screenshots via e-mail, it may be necessary to highlight something in the image. That's where the insert shapes feature in Microsoft Outlook proves useful. The shapes, however, tend to shift once the e-mail is sent and may not even be pointing to the correct thing anymore. The screenshot could be modified using software like Adobe Photoshop, but there's a quicker way. [Continue reading]

Deactivate Code Automatically on a Test Server

When fixing a bug or adding a new feature to a website, it may be beneficial to test the changes on a development server before going live. The problem is that some aspects of the code probably shouldn't be active on the development server. For example, we probably don't Google Analytics tracking any of those visits. The code could be manually disabled during the test phase, but are we going to remember? Instead let's look into automating the process. [Continue reading]

Future Proofing Our Code

Due to all the changes that PHP has going through over the last few years, I've spent a lot of time rethinking my coding practices. Functions such as ereg_replace() have been depreciated and eventually we won't be able to use functions like mysql_query(). With these types of changes, who knows what's safe. Let's look at what can be done to future proof our code. [Continue reading]

Reuse GET and POST Instead of Duplicating Variables

When reading data from the GET or POST array, why do we assign the information to another variable? Why can't we just use the GET or POST variables? It's not like we unset those variables after the new ones are created. Instead of duplicating variables, consider keeping the ones created for us by PHP. [Continue reading]

Why Does the fetch_array() Function Even Exist?

When looping through a MySQL result set, which function do you use? My preference has always been for the fetch_array() function since it allows access to the data using the database column names. However, is that the most efficient function to use? [Continue reading]

Log Online Form Requests Part 2: Add the Field Separator Dynamically with implode()

When saving data to text files, each field is usually separated by something like the pipe character (|). The character is useful for importing and dividing the fields into a spreadsheet solution like Microsoft Excel. Normally, I add the character between each field manually, but there's an alternate using PHP's implode() function. [Continue reading]

Log Online Form Requests in Case Something Happens with the E-mailed Results

When building data-collection forms online, clients occasionally want the information sent directly to them via e-mail. Although it's convenient, there are issues with that delivery method. Spam filters may catch the messages. Messages may be overlooked and accidentally deleted due to the sheer number of e-mails a person receives per day. Or something could just go wrong with the mail server and the message never gets sent. With all the potential ways for e-mails to get lost, it's important to backup the information collected. One backup option is to store the data into a text file. [Continue reading]

Google+ Changes Privacy Settings for New Posts…A While Ago

For those using Google+, have you noticed the new share settings? They appear to have been modified months ago. For some reason, I didn't notice until recently. Instead of posting publicly by default, they seem to have switched so that posts are available to my circles only. There's an option to make posts public, but it needs to be set before clicking the share button. [Continue reading]

Thoughts from the CyberScorpion.com Redesign

It's finally done. The CyberScorpion Bytes blog has been redesigned! When switching to WordPress a few years back, a pre-made theme was chosen for the design so I could hit the ground running with the blog. It was never the plan to stick with that template. I wanted to build my own. Now that it's done, I wanted to share some thoughts. [Continue reading]

End PHP Scripts Gracefully After a Failed Database Connection

Last week's post talked about externalizing the MySQL connection script for easier maintenance. The problem with the previous code is that it's not very user friendly. If the database connection fails, it just drops everything and displays an error. Well, there's probably other content on the web page that can be viewed without database access. The website navigation, for example, most likely doesn't require a database. The navigation will probably lead to other pages that don't need that database. To minimize the impact to the visitor, let's look at a more graceful solution for handling connection failures. [Continue reading]