Posted on October 18th, 2007 by Jans
This is an alternative to the image and audio captcha and it is much simpler than the other two methods.
1. Add an input field to your form, with some interesting name, for example ‘URL’.
<input name=”url” type=”text” value=””/>
2. Hide the input box using css so that users(genuine) cannot see it directly.
<style>
.style1 {
display: none;
}
</style>
<p class=”style1″><input name=”url” type=”text” [...]
Filed under: Css, HTML, PHP, Security, Web | 1 Comment »
Posted on July 9th, 2007 by Jans
Here is a simple javascript function which is equivalent to PHP’s preg_match function.
function preg_replace (array_pattern, array_pattern_replace, my_string) {
var new_string = String (my_string);
for (i=0; i<array_pattern.length; i++) {
var reg_exp= RegExp(array_pattern[i], “gi”);
var val_to_replace = array_pattern_replace[i];
new_string = new_string.replace (reg_exp, val_to_replace);
}
return new_string;
}
You can also use the javascript string.replace method to do the same functionality.
Filed under: JavaScript, PHP | No Comments »
Posted on June 8th, 2007 by Jans
This is a continuation to my post PHP Magic Constants.
Here I would like to demonstrate a real time example of magic constants.
I am going to write a user function for generating a user-level error/warning/notice message.
function myErrorFunction($error_message,$line,$file)
{
if($error_message!=”)
{
$error_string = “User Error : {$error_message} in
{$file} on line number {$line}”;
echo $error_string;
die();
}
}
myErrorFunction(‘test error message’,__LINE__,__FILE__);
Now, you can call this function [...]
Filed under: PHP | No Comments »
Posted on June 5th, 2007 by Jans
Damien Seguy published the PHP usage statistics for May 2007 over at nexen.net. Some points of interest in the stats:
* PHP is found on 33,24 % of web sites, stable from last month. PHP market share is stable.
* All versions of PHP 5.2x are gaining new users
* PHP 5.2 is now 3rd most popular version
* [...]
Filed under: PHP | 1 Comment »
Posted on May 30th, 2007 by Jans
PHP provides a large number of predefined constants to any script which it runs. Many of these constants, however, are created by various extensions, and will only be present when those extensions are available, either via dynamic loading or because they have been compiled in.
There are five magical constants that change depending on where they [...]
Filed under: PHP | No Comments »