Articles in ‘PHP’

PHP > Sort array by keys

Monday, July 21st, 2008
ignoring capitalisation:
uksort($tagList, 'strnatcasecmp');

Convert Umlaute to UTF-8

Tuesday, March 11th, 2008
foreach ($aline as $val) {
$bline[] = iconv("ISO-8859-1","UTF-8",$val);
}

A Checkbox Group in PHP

Friday, February 29th, 2008
Und ich dachte, das ginge gar nicht... geht aber doch. Wenn die Checkboxen alle denselben Namen haben, überschreibt die zweite die erste etc. Aber in PHP gibts dafür ja Arrays. Und man glaubt es kaum, man kann den Namen der Checkbox als Array definier
[...more...]

A small File Upload Checker

Friday, February 29th, 2008
<h2>Check file</h2>
<form name="checkfile" method="POST" action="<?=$PHP_SELF?>" enctype="multipart/form-data" >
<input type="hidden" name="max_file_size" value="8000000" />
<input type="file" name="file" id="c_f"
[...more...]

RegExp und PHP

Wednesday, February 27th, 2008
  • Finde einen Text, der mit font+4 und fett markiert ist und ersetze das ganze durch <h1>...</h1>
     $string2 =
     ereg_replace('<font size=.+4.>+ ?<b class=.bltxt.>(.*)</b> ?</font>'

[...more...]

Unix Basics

Monday, January 14th, 2008

Au weia, Jahre kein Unix gesehen und dann das...

Mache eine Sicherheitskopie von allen html files in einem Verzeichnis, natürlich mit Unterverzeichnissen, aber nimm nicht den ganzen anderen Müll mit... vielleicht geht es ja auch schneller, abe
[...more...]

PHP > CleanString

Tuesday, August 7th, 2007
This function strips all unwanted characters from a given filename. Only alphanumeric characters, . and - are allowed.
  function cleanString($filename) {
    return ereg_replace("[^-[:alnum:].+]","",$filename);
  }
oder, um auch z.B. chines
[...more...]

PHP > Directory Functions

Monday, May 14th, 2007
Read a directory and output files
 $list_ignore = array 
         ('.','..','images','Thumbs.db','index.php','.htaccess','.htpasswd'); 
 $handle=opendir ('.');
 while (false !== ($file = readdir ($handle))) {
   if (!in_array($file,$list_ignore))
[...more...]

PHP > string2array using a “template”

Monday, May 14th, 2007
divide a string with a template. the "template dividers" are the keys for the output array.
  <?PHP
  function string2array ($string, $template){
    #search defined dividers
    preg_match_all ("|%(.+)%|U", $template, $template_matches);
   
[...more...]

PHP > a menu library

Tuesday, March 27th, 2007
My favorite Menu that I adapted for the new ESO home page and some of its adaptations: A function that finally gives me the complete path to a
[...more...]

PHP > Quote smart…

Thursday, January 11th, 2007
found at php.net, prevents SQL Attacks through entry fields
 function quote_smart($value)
 {
   // Stripslashes
   if (get_magic_quotes_gpc()) {
   
[...more...]