Browse > Home / Archive by category 'PHP'

| Subcribe via RSS

oid vs bytea in Postgresql

august 9th, 2008 | 1 Comment | Posted in Open Source, PHP, Work
1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 4,67 out of 5)
Loading ... Loading ...

Okay, here is the deal, I am working on a project which requires me to store files in my database. But I have recently just switched to postgresql from mysql, so I had to do some research on what methods postgresql offers for file storage. In mysql GLOB would have been my choice, but postgresql offers two methods, BYTEA which is postgresql’s answer to GLOB, or store the files in Large Objects (oid).

I asked around to find out what method would be the fastes, but I could not find the answer I was looking for, so I ended up spending the night testing it for myself, this blog will show the results.

More »

Tags: , , , , , ,

Test af webspell

august 5th, 2008 | 1 Comment | Posted in General, Open Source, PHP, Work
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5,00 out of 5)
Loading ... Loading ...

Okay, jeg har hørt en masse omkring webspell, et CMS til klaner, så jeg tænkte lige jeg ville teste systemet ud, og se om det nu også var så godt som alle siger det er.

More »

Tags: , ,

Safe Email function

juli 13th, 2007 | 2 Comments | Posted in PHP
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

This should be a spambot safe way to return emails out on a webpage, it prints the email out with javascript with random substrings.

function InsertMail($mail) {
if ($mail=='') return '';
$mail = str_replace(array('@',':','.'), array('@',':','.'), $mail);
$len = strlen($mail);
$i=0;
while($i< $len) {
$c = mt_rand(1,4);
$par[] = (substr($mail, $i, $c));
$i += $c;
}
$join = implode('"+ "', $par);
return '<script language="javascript">
<!--
document.write("'.$join.'")
//-->
';
}

Source: http://dk2.php.net/manual/da/function.htmlentities.php#76049

Check for valid email.

juli 9th, 2007 | No Comments | Posted in PHP
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

I needed to check if an e-mail was valid using PHP for my projects, I modified a script I got else where (Can’t remember) so it would also check if the domain has a MX record.

This will NOT work on Windows platforms!

valid_email.txt

PHP Security by Example

juni 27th, 2007 | No Comments | Posted in PHP
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Nice flash presentation that will provide you with a good foundation on how to make your PHP apps more secure.

read more | digg story

Optimize PHP and Accelerate Apache

juni 27th, 2007 | No Comments | Posted in Linux, Open Source, PHP, Programming, Windows
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

As the load on an application increases, the bottlenecks in the underlying infrastructure become more apparent in the form of slow response to user requests. This article discusses many of the server configuration items that can make or break an application’s performance and focuses on steps you can take to optimize Apache and PHP.

read more | digg story