 |
 |
|
|
| |
| |
| |
|
Statistics |
| Unique Visitors: 0 |
| Total Unique Visitors: 2236145 |
| Visitors Out: 10338 |
| Total Visitors Out: 57504 |
|
|
|
| |
|
|
| |
|
| Image Generation Using PHP |
| 2009-03-24 17:24:01 |
In one of the previous posts about CAPTCHA
Image Generation we made use of PHP’s image generation functions
but didn’t discuss about them. So, if you had any problems or just want
to know more, read on.
Creating and outputting images from PHP is very simple and easy. And
since PHP supports images in a number of different formats you can very
easily generate images in various formats such as JPEG, PNG, GIF etc.
Generating images involves the following steps:
Creating a canvas.
Drawing
Outputting the image.
Now, let’s look at each of the steps in detail.
Creating a Canvas
Creating a canvas is very easy, just use the following function:
resource ImageCreateTrueColor ( int $width , int $height )
The capitalization doesn’t matter as with any function in PHP.
If you want your canvas to have some background color (default is
black) you can use the following function:
bool ImageFill ( resource $image&nbs...
|
| |
|
| How CAPTCHA Works? And a Simple Script in PHP |
| 2009-03-18 06:21:10 |
[For
this post I'm
presuming that you
are familiar with CAPTCHA, if not please read this Introduction
to CAPTCHA]
Today
we are going to see
how CAPTCHA
(Completely Automated Public
Turing test to tell Computers
and Humans Apart) works and how
it minimizes automatic sign-up
of
forms.
We will also be creating a
simple CAPTCHA script in
PHP to illustrate this.
Basically CAPTCHA works in
the
following manner:
Create Random Value:
Some random string is generated, random values are often hard to guess
and predict.
Generate an Image:
Images are used as these are generally a lot harder to read for
computers while being nice and readable to humans. This is also the
most important step as simple text in images can be read (and CAPTCHA
cracked) quite easily. To make it difficult for them, developers employ
different techniques so that the text in the image becomes hard to read
for computers. Some create zig-zag lines for background while others
twist-and-turn individual characters i...
|
| |
|
| Generating XHTML MP (WAP 2.0) Pages From PHP |
| 2009-02-23 04:55:05 |
Maybe
you guys know that I've been working on a service called
MyWapBlog.com which lets peoples create/manage mobile blogs using their
mobile phones. In the course of the development I've learnt great deal
about mobile websites and their dynamic generation, and I'm sharing a
bit of it here in this post.
How do you generate dynamic (X)HTML Pages using PHP? Simple:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"><head><title>Sometitle</title></head><body><h1>Hello</h1><p><?php echo date('h:i A, j-M-y'); ?></p></body></html>
And if you look at XHTML MP pages, their source look like the
following:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "htt...
|
| |
|
| Custom Tags Parsing Using Regular Expressions |
| 2008-11-20 00:37:29 |
In the last post, we had created a simple
custom tag parsing script using PHP string functions. In this post,
we are going to continue our discussion on custom tag parsing but rather using
Regular Expressions. Here we will see how regular expressions can used to parse
strings, we will also see where to and where not to use Regular Expressions.
Before continuing, I expect that you have a working knowledge of Regular Expressions
if not please first check out this
websites.
Let us first create the previous custom tag parsing script using expressions:
<form name="form1" method="get" action="">
<p>
<!-- textarea should display previously wriiten text -->
<textarea name="content" cols="35" rows="12" id="content"><? if (isset($_GET['content'])) echo $_GET['content']; ?></textarea>
...
|
| |
|
| Basic "Custom Tags" Parsing Script |
| 2008-10-25 05:21:51 |
Today we are going to create a basic Custom Tags parsing script that will parse
special symbols (tags) in text for formatting purpose. Just like writing <b>BOLD</b>,
a web browser parses it as “BOLD” in bold letters, same way our
script will parse tags created by us. One very popular example of custom tag
parsing for formatting purpose is, BBCode which most of the bulletin boards
use to let users format their posts.
This will be a basic example of parsing custom tags so we will only be parsing
two tags. One will convert the enclosing text into bold and other will be used
for italics. After understanding the basic idea, you can easily add more tags
according to your needs and can also use it wherever necessary. One of its good
use will be in Shout Boxes that we had designed a few months back.
Though many would like the use of Regular
Expressions for parsing, we will not be using them here. For the sake
of simplicity, we will be u...
|
| |
|
| Simple File Uploading Script in PHP |
| 2008-09-18 01:30:12 |
PHP is undoubtedly the best programming language when it comes to web programming.
It gives us so many features and capabilities, a few of which we’ve discussed
already. So continuing with that, today we’ll see how we can use a few
lines of code to create a script that’d allow file uploading right from
the web browser. File upload feature is definitely useful kinds of website but
at the same time very much vulnerable to malicious attacks as well. So use it
with a LOT of precautions!
For this example, we’ll need a front-end web page that’ll accept
the file from the user and a backend script to process and store the file. Let’s
look at the codes of each:
upload.html:
<html>
<body>
<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id...
|
| |
|
| Finally a Blogging Platform for the Mobile Web (WAP) |
| 2008-09-16 05:37:31 |
Most of the time I browse internet for reading blogs, checking emails etc.
I do it on my cell phone. One day I thought why not create a mobile website
or better yet blog, and started searching around. What did I find? Well, nothing
much useful. In this big world and yet bigger web, to my disappointment, I couldn’t
find any website offering free blogs like we do on the normal (desktop) web.
Moreover, those that offered mobile websites, I just didn’t like their
service. You just have to spend so much time to just have a single page up!
What I had in my mind was a service that’d offer free blogs, let me register
it from the mobile phone, let me post from the mobile phone, in other words
a service that’d let me operate the whole thing right from the mobile
phone itself. Days passed and then, rather than me wanting these services I
thought of offering them to others instead, of course for FREE. Therefore I
took a nearly a month off an...
|
| |
|
| Designing a Simple HTML Code & Preview Tool (Online) |
| 2008-09-04 01:43:57 |
With online CMSs everywhere and craze of blogging like never before, we see
some sort of online HTML editors everywhere. Ever blogged or posted in some
forum? Most of them have it! These editors let you write, format, preview and
tinker with the HTML code before publishing anything. Most of them have a nice
UI to format everything much like the desktop applications like NVu, Dreamweaver
etc. these online editors also let you manually change or write HTML code
that can be previewed without leaving the page.
Well what we are going to design today is a scaled down version (say simple)
of these kinds of editors. It’d let you write (or paste) HTML code and
preview how it’d look. What it wouldn’t let you do is to format
or change anything while in the preview mode. We will be using HTML, JavaScript
and a little inline CSS.
Basic Theory
If you look at the HTML editors used by Blogger and Wordpress, they have two
modes, Code and Compose. In ...
|
| |
|
| Blogger: Method to Add 'Link to This Post' Widget on Your Posts |
| 2008-08-15 22:49:27 |
[Today I’m going to provide you with a code that
you can put on your Blogger Blogs. It’ll give your visitors a very easy
way to link to your posts if they like it. Scroll to the bottom to see it in
action! You might also want to read New
Working Method of Making Blogger Title Tags SEO Friendly]
When it comes to Search Engine rankings, link popularity is no doubt one of
the most important factors especially organic link popularity.
Nowadays Search Engines’ algorithms have become so intelligent and sophisticated
that they could differentiate between different types of links; paid, reciprocal,
organic etc. to name some, automatically and not let discouraged factors manipulate
rankings much (in some cases by even penalizing those site).
Coming to Organic Link Building, there is no better way to do (or at least
increase) Link Building than to ask or encourage your visitors. You see, I’ve
it at the bottom of this post. This way you ar...
|
| |
|
| Creating a Simple Countdown Timer Using JavaScript II...Using getElementById() Method |
| 2008-08-14 01:05:33 |
Speaking of yesterday’s post, it had the following problems:
1. It could not easily be embedded into an existing page.
2. It could not be placed wherever we wanted it to be
nor it could be aligned or styled easily.
3. Rather than updating the same number to countdown it
showed a series of numbers as countdown proceeded.
Well all these problems can easily be solved by one of JavaScript’s powerful
method getElementById(). This is documents’s
method which can be used to access HTML entities within JavaScript with the
help of their IDs (which is unique).
For example we can access the HTML entity and its values etc. with the ID one
as:
document.getElementById("one")
The HTML object may be defined like below:
<p id="one">some text</p>
You get!
OK, how can this be used to solve our problems, let’s see.
As we know, the HTML entities such as <p>,<div>, <span>
etc. can be placed anywhere very...
|
| |
|
| |
 |
|
| |
| |
|
 |