Archive for September, 2010

Mobiles are oldschool

So as i changed my internet provider and got a new router, my N900 got a finishing touch. It is now my phone for my local number through SIP accounts.
One SIP account in the local net to the router, and one SIP account through the net. Real communication central now. Jabber, ICQ, Skype, SIP, Facebook Chat (Jabber) .. oh and you can use the old school phone function of course.

But who really uses phones nowadays ๐Ÿ˜‰

Leave a comment

PHP, SQL and sorting order

I searched for a good way to implement changing of sort order in php easily, but did not find a good way, so today i developed some handy code for sort order handling in PHP and want to share it. Maybe you find some downsides or maybe you like it.
You only have to configure the orderarray with your default sort order. The orderby parameter is filtered against that array, so there should be no danger of sql injection.

$orderarray=array(
  "Modul" => "name ASC",
  "Date"=>"date ASC",
  "Text" =>"description ASC");
if(!isset($_GET['orderby'])){
  $customorder=$orderarray;
}else{
  $customorder=array_intersect(explode(",",$_GET['orderby']),$orderarray);
}
$orderby=implode(", ", $customorder);
foreach($customorder as $key=>$value){
  $orderstring=implode(",", array_unique(array_merge(array($key=>$value), $customorder)));
  $orderlinks.='<a href="index.php?orderby='.$orderstring.'">'
             . array_search($value,$orderarray) .'</a>';
}
print $orderlinks;
$query="SELECT name, date, desciption FROM some_table ORDER BY $orderby";

Leave a comment

Life’s too short to keep everything in my mind

So here i start my blog. Maybe it fills, maybe i get lazy … noone knows.

Leave a comment

%d bloggers like this: