When writing PHP web apps, I tend to run in to a portability issue when dealing with SQL connectivity. Since I can’t count on having the PEAR DB module available, I rolled my own set of functions to interact with a MySQL database.
The problem lies in escaping characters in your SQL queries. Do [...]
Entries Tagged as 'Programming'
Quick Character Escaping in PHP
October 10th, 2007 · No Comments
Tags: Programming · SQL · php
Perl code to find an IP A in subnet B/C
June 5th, 2007 · No Comments
my $ip = ‘1.2.3.4′;
my $block1 = ‘1.2.3.0/27′;
if(checkip($ip, $block1)) {
print STDOUT “$ip is in $block1\n”;
}
else {
print STDOUT “$ip is not in $block1\n”;
}
sub checkip() {
my $ip = shift;
my $block = shift;
@ip1 = split(/\./, $ip);
[...]
Tags: How Tos · Programming · ip addressing · ipv4 · networking · perl
PHP Header injection
May 21st, 2007 · No Comments
I regularly shut down web sites that use the PHP mail() function. While the users of the sites mean well, they generally don’t do any checking before sending data to mail(). I’m not going to weigh in mail(). Enough has been said about it. Just remember to take your code and [...]
Tags: How Tos · Mail Post · Programming · php