Submit web site URL free to the DevDream Webmaster Resources Directory
  
DevDream.com - Webmaster and Developer Articles  
 
           

Archive for the ‘PHP’ Category

How To Automatically Capitalize A String In PHP

Friday, October 24th, 2008

PHP, one of the Internet’s most popular development languages, has come a long way since its inception. We can now make use of nifty functions built into the language such as UCWords. This function in particular can save webmasters quite a bit of time in editing titles, descriptions, and editing user input.

PHP’s UCWords function is rather simple because we only have to supply the function with the string we want to be converted into uppercase. While it sounds like a fool-proof plan, don’t get too hasty because there are similar-looking functions that perform similar tasks. As such, the proper PHP programmer will memorize such functions to increase their work efficiency.

One of the neat things about UCWords is that it can be used to maintain a sense of professionalism among business partners and clients. By using PHP to send mail, we can dynamically make the personal or business name of the partner capitalized, regardless of whether or not the partner capitalized his or her name in a registration process.

Webmasters are quite familiar with the Meta tags used to tell search engines what their website is about, and how to display the listing in the search results. UCWords is used in this case to ensure the “Title” attribute of the website is always capitalized. This allows for better efficiency by allowing the designer to disregard capitalizing words, but also ensures there are no errors in letter casing.

By applying the UCWords function to a custom-made function, we can also alter strings to keep certain words lowercased. This is especially important for proper news resources, who know that proper title case is going to mean that some prepositions or words need to remain in lower case. By initializing an array of prepositions and selectively making them lowercased, web developers can ensure that there are no mistakes in how a title should appear.

It’s important to note that the UCWords function isn’t always going to render foreign characters correctly. While this should be fixed in the next version of PHP version thanks to the fact that multi-language support is being added, for now users of certain text encoding structures will have to create custom functions to get this to work properly. This is obviously a setback, but this will not affect the majority of web developers around the world.

Closing Comments

In the end, UCWords is quite a benefit to web developers. It’s quite a help for everyone from editors to the general webmaster, simply because attention doesn’t have to be paid to titles or database input. For more information on this function, you should consult the PHP manual or search for further examples of usage in trusted PHP resources around the Internet.

About the Author:

SQL Injection Prevention Guidelines For Developers

Wednesday, July 16th, 2008
by Chris Channing

SQL injection is becoming a problem for web developers- especially those new to the field who aren’t up to speed on how insecure PHP can really be. But as the experts like to say, PHP isn’t the problem- it’s the knowledge of the programmer that counts when it comes to preventing SQL injection attacks.

SQL injections are defined by the vulnerability in the SQL query that PHP developers make use of. When the developer in question puts forth an SQL query, he or she needs to make an effort to validate any input that could come from any web form or entry field. A simple input statement such as “a’ OR ‘a’='a’” could compromise the security of one’s database with ease.

PHP developers have used the magic quotes function to help safeguard against SQL injections. Magic quotes are no longer in use, however, since they were more of a hassle than anything. It is recommended that if a developer has used magic quotes, he or she should remove them since they are no longer supported as of PHP 6. Thus, we need to look elsewhere for a security solution.

There is but one simple solution when it comes to getting rid of the threat of an SQL injection. This simplle solution comes via the function mysql_real_escape_string(). This function was created specifically for safeguarding against SQL injections, so it’s well worth the time to use. Just pass any values being inserted through this function, and the result is a perfectly escaped string.

Oddly enough, we can create a greater sense of security through creating more user accounts via our SQL program. We can assign different types of access to different users, which would make it quite hard for attackers to get full access to our database should they find a hole somewhere. Having a user for creating, deleting, and inserting data is a good idea to help split up responsibility.

It should be noted that programs and web applications that stop SQL injections should not be obtained- since they commonly cost quite a bit of money. As long as webmasters take precautions with what they create, there should be no reason to spend hundreds of dollars on software that only makes use of escape characters and formatting data correctly. This type of application is created to con webmasters into buying something they don’t need- so dont fall victim to them!

Final Thoughts

SQL injections are never a pretty sight. They ruin databases, can be a security risk to users of the website, and they even can destroy entire websites. Thus, it’s good to either hire developers that know what they are doing or to brush up on some security topics by one’s self. Doing so can save a world of hurt for a webmaster, as well as quite a bit of money from not having to buy mock applications that claim to do the “hard work” for webmasters. In the end, it’s recommended developers pick up a good book or visit their favorite PHP security websites to stay informed.

About the Author:

Differences Between Two Printing Commands In PHP

Sunday, July 13th, 2008
by Zachary Schuessler

Few other web development languages have done as much for web developers as PHP has. And in learning all the complexities of the language, web developers will be able to better become higher paid, more satisfied, and better prepared to make the next best web application. But taking baby steps in getting there is important: and the finer things such as knowing the difference between Echo and Print become clear.

Echo and Print are both commands used to display something to the browser. Both are used in similar structure, and both are identical in output. So what, then, is the use for having two commands that appear to do the exact same thing?

Print is actually something more of a function, as it can be enclosed in brackets. Echo lacks this ability, but then again, there is almost never a need to do so. In reality, having this ability is something that even those who have seen it all in PHP likely won’t need to make use of. This just adds more confusion to the topic than what was previously apparent.

While performance may be a big issue for PHP developers and their clients, the debate between Print and Echo is actually fairly meaningless. It is true that Print will take more system resources to use, but it is such a minimalistic amount that developers are recommended to choose the construct of their choice, regardless of speed issues.

When a PHP developer looks around at examples and scripts from others in the community, they will see that Echo is used much more often. This isn’t because of speed, as previously discussed, but because many think it easier to type and the keyword command is more appealing in design. The success of Echo has been compounded after many publishers make books and online resources that sport the term.

As a last note of worthiness, it should be made clear that if speed is an issue, more emphasis should be put on how the two commands are used. Repeatedly using either command where a programmer could simply concatenate a string or value together will waste system performance- and on a much more noticeable scale that the difference between returning a value or not. Thus, this subject should be addressed if anything in regards to speed.

Closing Comments

End the end, the battle between Echo and print is never ending. The trends do seem to show that Echo is much more popular, but with little reasons. The speed benefit is so small that it’s negligible- especially among faster systems that technology has produced where such effects go unnoticed. And because many books and online publications stick true to the Echo command, it’s likely we’ll only be seeing more of it as time goes on, and less of the fabled Print command that older generations have favored.

About the Author:

How PHP Developers Differentiate Between Print And Echo

Sunday, July 13th, 2008
by Zachary Schuessler

The Internet for webmasters just wouldn’t be the same without the language of PHP. PHP has given webmasters a long-lasting relationship with their websites, to manipulate it to best offer customers and Internet users what they need. But before becoming the master PHP expert, learning smaller details is important. And interestingly enough, many PHP developers don’t know the difference between Echo and Print.

Two commands are used to output text to the screen: Print and Echo. But since both do the same thing, why would there be two different commands? The answer, interestingly enough, eludes even some PHP experts.

As it turns out, Echo is actually a language construct that doesn’t return a value, in which Print does. This simple fact means that Print can be used in some instances where Echo can’t, although developers will probably never run into such a situation. In fact, many PHP developers stick with Echo their entire career and will never see a problem.

While performance may be a big issue for PHP developers and their clients, the debate between Print and Echo is actually fairly meaningless. It is true that Print will take more system resources to use, but it is such a minimalistic amount that developers are recommended to choose the construct of their choice, regardless of speed issues.

So far the industry standard has been to use Echo, but it should be stressed that either command may be used at will. Echo seems to be the favorite as it is easier to type, not to mention it’s a fun word to say! Those who favor the Print command are usually older programmers, who are accustomed to using the command Print from other programming languages that are now considered archaic.

As a last note of worthiness, it should be made clear that if speed is an issue, more emphasis should be put on how the two commands are used. Repeatedly using either command where a programmer could simply concatenate a string or value together will waste system performance- and on a much more noticeable scale that the difference between returning a value or not. Thus, this subject should be addressed if anything in regards to speed.

Closing Comments

End the end, the battle between Echo and print is never ending. The trends do seem to show that Echo is much more popular, but with little reasons. The speed benefit is so small that it’s negligible- especially among faster systems that technology has produced where such effects go unnoticed. And because many books and online publications stick true to the Echo command, it’s likely we’ll only be seeing more of it as time goes on, and less of the fabled Print command that older generations have favored.

About the Author:

 

Submit Your Real Estate Website URL ::  Submit Your Travel Website URL
Small Business Web Hosting Service ::  Buy Your Domain Name ::  SEO Consultants and Website Marketing Consultants