about 6 months ago - No comments
In a previous article I covered an example of how to log a user in using an HTML form and PHP. In another article I talked some about the global SESSION variable. Now I will show you an example of how to validate the login against a MySQL database. In the following code it is
about 6 months ago - No comments
// Create an array $a = new array("apple", "orange"); // Prepend an element to the array array_unshift($a, "raspberry"); // Prepend a couple more elements to the array array_unshift($a, "pineapple", "watermelon");
about 6 months ago - 1 comment
// Create an array $a = new array("orange", "apple", "pineapple"); // Remove the apple from the middle of the array unset($a[1]); // Create an associative array $a = new array("dogs" => 4, "cats" => 9, "birds" =>2); // Remove the birds from the array unset($a[’birds’]);
about 6 months ago - No comments
In a previous article we demonstrated a simple method for discovering whether or not a URL exists. The following code accomplishes the same thing, but offers a little more control. /* Brendan Warkentin */ /* urlexists($url, $port = 80, $codes = array(200), $ssl = false) * * @Description: * Determine whether a url really
about 7 months ago - 2 comments
A form is an area of a web page where your website’s visitors can enter information and submit it. They might fill out a contact form, or use a small form to login to your system. They come in handy and in many cases are a necessity. In this tutorial we will kill two birds
about 7 months ago - No comments
Sending an email is easy using PHP. Create a new file, copy and paste this code, and give it a spin! <?php // Prepare the data $to = ‘nobody@example.com’; $subject = ‘the subject’; $message = ‘hello’; $headers = ‘From: webmaster@example.com’."\r\n". ‘Reply-To: webmaster@example.com’."\r\n". ‘X-Mailer: PHP/’.phpversion(); // Send the email mail($to, $subject, $message, $headers);
about 7 months ago - No comments
There is no built in function to check if a particular URL exists, but you can easily write one. The following is a simple method, or you can try this one which takes more code, but allows more control. Copy and paste the following code into a new file and try it out! <?php
about 7 months ago - 1 comment
Let’s say you are creating a website where users need to login. How do you track a user’s id from page to page, or even verify that a user is logged in when they should be? You can use the global $_SESSION variable! The $_SESSION is an array where you can store your variable and
about 7 months ago - No comments
AJAX in a word… SWEET! I love it. AJAX stands for Asynchronous JavaScript and XML. Basically it allows your web page to load content AFTER the web page has already loaded. This comes in handy when you want to perform actions on a web page or change content but don’t want to reload the entire
about 7 months ago - No comments
I’ve tinkered with Facebook apps enough to find out what works and what doesn’t. The most frustrating things I’ve had to deal with is when I’ve developed a Facebook app in an iframe. Using the canvas page rather than an iframe is great. You’ll encounter little to no weirdness. But if you’re like me, you