geeky · php code

dodoupload 1.3

worked most of today on releasing dodoupload version 1.3. if you never had problem with previous versions, you probably don’t need to upgrade. there is not much change from version 1.2. I rewrote the script mostly because some people have problems with http auth and i couldn’t figure out why. so now it’s cookie based… Continue reading dodoupload 1.3

geeky · php code

quickly fill an array

i’ve been wondering what’s the quickest way to fill an array with a constant value? sometimes the code is necessary. for example, i have X number of items in an array and i wish to put them evenly into an table. to call another function, i need to pass in an array of values and… Continue reading quickly fill an array

geeky · php code

time left php function

just a simple function that returns how many days, hours, minutes and seconds are left given a timestamp i put together. kinda bored so sharing some code XP give either $time_left (time left in timestamp) or $endtime (an ending timestamp)

geeky · php code

write better search engine in php

my limited mysql knowledge always produced inaccurate search results when i write the board search engine. i want to do better this time for the new board so i’m reading this and trying out mysql regular expression and full text search. i’m pretty excited. oh also, leslie reminded me. this perl style coding will save… Continue reading write better search engine in php

geeky · php code

mysql date column type

i have to say that the decision to make the birthday column for members on the new board type DATE is a very good one. i never knew about all the magic mysql DATE type can do 🙂 but i still love the simplicity of time arithmetic unix timestamp provides.

geeky · php code

javascript unescape like php function

when you start dealing with languages (i.e. chinese) that require 8 bit encoding or more, you will learn about all the wonderful jazz of utf8, unicode, ISO etc. i was looking all over for a php function that does what javascript unescape does. normally rawurldecode would work, but…

php code

the mystery of querying

if i know (or remember) more from my database class, i may have an answer for this. i was just coding my new board and was curious about which of the following query is faster: or m.uid is a primary index while m2.uid is an index. what would be your guess?

php code

save arrays into database

i’ve known this for a while but forgot to share it. there is a very easy way you can store array into database as a string. then you can grab the string from the database and convert it back into an array. code example: you should get

php code

separate template from code

when you do serious coding, it’s always a good idea to separate your layout design (template) from your logic code. i’m at the beginning stage rebuilding dmb. one thing i want to do very badly is to get rid of all templates in the database. every time i load a template right now it causes… Continue reading separate template from code