RSSAuthor Archive for Brian

PHP Image Verification in Forms

One of the most common ways to stop bots and spammers from generating spam in people’s websites is using some form of image verification. This can be done very easily with just PHP and Sessions. Using image verification acts as a human detector, to make sure the viewer of that page is not a bot [...]

Javascript innerHTML

Using Javascript, you can change the content of a certain tag just through basic javascript browser functions. This can be useful for navigation systems, content on a page to display, etc. Here is an example: <script type="text/javascript"> function setContent(id,content_id){ var content_box = document.getElementById(id); var new_content = document.getElementById(content_id); content_box.innerHTML = new_content.innerHTML; } </script> This is a [...]

PHP Upload file from URL

Let’s say you have a form on a page with the input for URL to a file so you can upload it to your server. You can do this using PHP functions. Here is an example of a form to upload: <form action="upload.php" method="post"> Enter URL: <input type="text" name="url" size="35" /> <input type="submit" value="Submit" name="submit" [...]

Javascript onfocus in Forms

A nice feature to use with javascript in your forms, is a way to show the currently selected field. When a viewer is in a particular input field it will select that field however you would like – i.e. A border or background color change. Here is a basic html/js for changing the border: <style [...]

PHP Mail (Send Email)

If you have a contact us page or something that sends an email with the use of php, it will use the “mail()” function of PHP. Here is the function: mail(‘Send To’,'Email Title’,'Email Message’,'Headers’,'Parameters’); Send To = Who the email is being sent to. Email Title = Title of the email, appears in inbox. Email [...]

Uploading Files with PHP

With many forms you may want to include some sort of upload of a file. There are many functions for files in PHP that you can use to do this. Some things you may want to consider when uploading a file to your server: File extension – what type of file is being uploaded. File [...]

Using HTML Meta tags

Meta HTML tags can be very helpful for gaining some search engine rank and promoting your website better. However, these simple tags are not going to drive your website immediately to the top of the lists. Meta tags are basically information located in the head of your webpage(s). This content is not visible to the [...]

Using PHP with Email Activation

Let’s say you have a website with registration. However, you want to have all registered users verify their email address to their account before being able to use all the functions of your site. To do this we can use PHP and simply create an activation code for each user when they register. Let’s make [...]

PHP preg_replace

Preg_replace in PHP uses regular expressions to replace matches in the subject with the given replacement. The syntax of preg_replace is as follows: preg_replace(pattern,replacement,subject [,limit]); A good example of using preg_replace is with simple bbcode and smilies. However with more complex bbcode there are other ways that would proove to be much easier and more [...]

PHP Classes and Functions

A great way to organize your tons of functions you will most likely have on your website is by using classes. Classes can be used to hold many functions that you group together – usually by their purpose on the website. For example, you would probably have functions for executing sql queries in a class [...]

The tutorials and scripts found on bgallz.org are for training purposes only, use to your discretion.