php recursive copy

This function copy recursive files and folders in php

function recursive_copy($src,$dst) {
$dir = opendir($src);
@mkdir($dst);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != ‘.’ ) && ( $file != ‘..’ )) {
if ( is_dir($src . ‘/’ . $file) ) {
recurse_copy($src . ‘/’ . $file,$dst . ‘/’ . $file);
}
else {
copy($src . ‘/’ . $file,$dst . ‘/’ . $file);
}
}
}
closedir($dir);
}

Публикувано в linux, php

php recursive delete

This function do recursive delete on files and folders in php

function recursiveDelete($str){
if(is_file($str)){
return @unlink($str);
}
elseif(is_dir($str)){
$scan = glob(rtrim($str,’/’).’/*’);
foreach($scan as $index=>$path){
recursiveDelete($path);
}
return @rmdir($str);
}
}

С етикет: , , ,
Публикувано в linux, php

extra space after textarea differ in different browsers

There is different space after textarea in Chrome, Firefox, Opera and IE

To fix this problem you need to add following to the css style of the textarea element

vertical-align: top

С етикет: , , , , ,
Публикувано в css

debuging high IO wait under linux

To do that you can use block IO debugging capability of Linux kernel.

echo 1 > /proc/sys/vm/block_dump

After this run

dmesg | egrep "READ|WRITE|dirtied" |  awk '{print $1}'|  sort | uniq -c | sort -rn | head
   1583 kjournald(2764):
    545 kjournald(1023):
     48 beam.smp(21021):
     47 sendmail(20992):
     28 crond(20974):

Now disable the block IO debugging

echo 0 > /proc/sys/vm/block_dump
Публикувано в linux

internet explorer cookie in iframe

Internet explorer didn’t accept cookies in iframes.
To accept the cookie you need to make iframe file php and add this php code at the top

<?php
header('P3P: CP="NOI ADM DEV COM NAV OUR STP"');
?>

С етикет: , ,
Публикувано в windows