PHP Stuff -=-=-=-=- Basic form structure -------------------- Use $_REQUEST['formfield'] to pull data # Print the form File manipulation ----------------- Writing ------- $filename = "/path/to/file"; if (is_writable($file)) { $file = fopen($file,"w"); $string = "This is a test string"; if (!fwrite($file, $string)) { echo "Error writing file
"; } } fclose($file); Reading from a command ---------------------- $command = "/path/to/command"; $fp = popen ($command, "r"); while (!feof($fp)){ $read = fgets($fp, 2096); $read = rtrim($read) ; if ( strlen($read)>0 ) { #$result .= "$read\n" ; $results[] = $read; } } pclose($fp) ; Reading all files in a directory -------------------------------- if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { # blah } closedir($dh); } } Variable manipulation --------------------- Joining an array together into a string $str = implode(":", $array); Search and replace on a string $str = str_replace("search","replace",$origstr); Looping over all elements in an array while ($ent = current($array)) { echo key($array).'='.$ent.'
' if $debug; next($array); } foreach ( $results as $ent ) { # Do something with $ent } Matching -------- preg_match("/^(.*)@(.*)$/", $string, $match) First match is $match[1], second is $match[2], etc