Results 1 to 2 of 2
-
24th Aug 2010, 01:51 AM #1
SMF > IPB Converters - Issue with paths in windows
PHP Code:foreach (glob($path.'/*/') as $folder)
{
$explode = explode('/', $folder);
array_pop($explode);
$name = array_pop($explode);
$options[$name] = $name;
}
I've tried to change this code to
PHP Code:foreach (glob($path.'/*/') as $folder)
{
$folder = str_replace('\\','/',$folder);
$explode = explode('/', $folder);
array_pop($explode);
$name = array_pop($explode);
$options[$name] = $name;
}
Help is appreciated.NewEraCracker Reviewed by NewEraCracker on . SMF > IPB Converters - Issue with paths in windows foreach (glob($path.'/*/') as $folder) { $explode = explode('/', $folder); array_pop($explode); $name = array_pop($explode); $options = $name; } I think this code gets folder names inside a certain folder. Unfortunately this code doesn't seem to work properly in windows because linux uses "/" as directory separator and windows "\" Rating: 5Trusted: Dom, l0calh0st, 0ccul7, robert420
Find all threads started by NewEraCracker
-
24th Aug 2010, 04:04 AM #2
I managed to fix code
PHP Code:// SERVER: Windows or other OS?
if (strpos(strtolower(php_uname()), 'windows') === FALSE)
{
// Linux/Solaris/Mac...
foreach (glob($path.'/*/') as $folder)
{
$explode = explode('/', $folder);
array_pop($explode);
$name = array_pop($explode);
$options[$name] = $name;
}
}
else
{
// Windows
foreach (glob($path.'/*') as $folder)
{
if (is_dir($folder))
{
$folder .= '/';
}
$folder = str_replace('\\','/',$folder);
$folder = str_replace('//','/',$folder);
$explode = explode('/', $folder);
array_pop($explode);
$name = array_pop($explode);
$options[$name] = $name;
}
array_pop($options);
}
// Done :)
Trusted: Dom, l0calh0st, 0ccul7, robert420
Find all threads started by NewEraCracker
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Windows 8 and Windows Server 2012 Release Preview Download Available
By ShareShiz in forum News & Current EventsReplies: 5Last Post: 3rd Jun 2012, 02:09 AM -
Help on Best link converters
By cyberavijit in forum Webmaster DiscussionReplies: 0Last Post: 4th Apr 2012, 07:34 PM -
Amazing Paths
By XxX in forum General DiscussionReplies: 4Last Post: 9th Jan 2012, 09:19 PM -
issue with windows 7
By DLow in forum Technical Help Desk SupportReplies: 7Last Post: 30th Nov 2011, 01:16 AM -
How can i check paths at server
By lubna in forum Server ManagementReplies: 4Last Post: 23rd Oct 2009, 04:50 AM
themaCreator - create posts from...
Version 3.48 released. Open older version (or...