2010-11-08, 06:27:39
(This post was last modified: 2010-11-08, 18:53:13 by superbacha.)
Thx to eveyone, solved.
this is the code:
and this is the error:
Warning: preg_replace() [function.preg-replace]: Unknown modifier '/' in E:\internet\EasyPHP-5.3.2i\www\GetSimple\theme\MyTheme\functions.php on line 22
for every file.
I've tried this code in a blank php page and it'works.
Where's the problem.
plugin exec-php is installed and html editor off.
Ciao
this is the code:
Code:
function directoryToArray($directory, $recursive) {
$array_items = array();
if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($directory. "/" . $file)) {
if($recursive) {
$array_items = array_merge($array_items, directoryToArray($directory. "/" . $file, $recursive));
}
$file = $directory . "/" . $file;
$array_items[] = preg_replace("////si", "/", $file);
} else {
$file = $directory . "/" . $file;
$array_items[] = preg_replace("////si", "/", $file);
}
}
}
closedir($handle);
}
return $array_items;
}
Code:
<?php
$directory=GSDATAUPLOADPATH;
$values=(directoryToArray($directory,true));
$datanext=$_GET['datanext'];
$data=$_GET['data'];
if($data!=NULL){
echo '<img src="'.$path.$data.'" width="600px" /><img src="'.$path.$datanext.'" width="600px" />';
}
else{echo'';}
while (list($key, $value) = each($values)) {
if($value!="." && $value!=".."&& $value!=".htaccess"){
echo '<img src="'.$values[$key].'"/><br />';
echo '<a href="http://localhost/GetSimple/index.php?id=php&data='.$values[$key].'&datanext='.$values[$key+1].'"><img src="http://localhost/GetSimple/data/uploads/'.$values[$key].'" width="100px" /></a>';
}
}
?>
and this is the error:
Warning: preg_replace() [function.preg-replace]: Unknown modifier '/' in E:\internet\EasyPHP-5.3.2i\www\GetSimple\theme\MyTheme\functions.php on line 22
for every file.
I've tried this code in a blank php page and it'works.
Where's the problem.
plugin exec-php is installed and html editor off.
Ciao