Activity Stream
48,167 MEMBERS
61496 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 2 of 2
  1.     
    #1
    Moderator
    NewEraCracker's Avatar

    Default 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 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 "\"

    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;

    Yet I still don't have success in fixing it.

    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: 5
    Trusted: Dom, l0calh0st, 0ccul7, robert420
    Find all threads started by NewEraCracker

  2.   Sponsored Links

  3.     
    #2
    Moderator
    NewEraCracker's Avatar
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Windows 8 and Windows Server 2012 Release Preview Download Available
    By ShareShiz in forum News & Current Events
    Replies: 5
    Last Post: 3rd Jun 2012, 02:09 AM
  2. Help on Best link converters
    By cyberavijit in forum Webmaster Discussion
    Replies: 0
    Last Post: 4th Apr 2012, 07:34 PM
  3. Amazing Paths
    By XxX in forum General Discussion
    Replies: 4
    Last Post: 9th Jan 2012, 09:19 PM
  4. issue with windows 7
    By DLow in forum Technical Help Desk Support
    Replies: 7
    Last Post: 30th Nov 2011, 01:16 AM
  5. How can i check paths at server
    By lubna in forum Server Management
    Replies: 4
    Last Post: 23rd Oct 2009, 04:50 AM

Tags for this Thread

BE SOCIAL