Jump to content

Recommended Posts

Hi all. I'm having a bit of trouble with my script. I can't get "getDirectoryListings()" to return what folders are inside of #SharedObjects

 

Here's my 2 files, 1 is sollib.php, the other is solindex.php.

 

solindex.php: 

<?php

        require('sollib.php');

			$shell= new COM('WScript.Shell');
			$data=$shell->regRead('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\ProgramFilesDir');

			$regval = trim($data, "Program Files");

				if(getenv('AppData')!=''){

					  $filename = getenv('AppData')."\\Macromedia\\FlashPlayer\\#SharedObjects\\".getDirectoryListings();
					  
					  die($filename);


				}

?>

sollib.php: 

<?php

die(getDirectoryListings());

        function getDirectoryListings() {

                         $final = "";

					 $filename = getenv('AppData')."\\Macromedia\\FlashPlayer\\#SharedObjects\\";

								if ($handle = opendir($filename)) {


										while (false !== ($file = readdir($handle))) {


											if(($file != '.') && ($file != '..')) {

													if(!strpos($file,'.')) {

															if ($handle2 = opendir($filename.$file)) {




																	while (false !== ($file2 = readdir($handle2))) {

																				die($file2);


																		if(($file2 != '.') && ($file2 != '..')) {



																			 $final = $filename."$file\\$file2\\".get_files($file2);

																			 die($final);	

																				if($file2 == 'www.xatech.com'){



																					 die('files: '.get_files($file2));



																				}



																		}


																	}

															}

													}else{

														 $final = $file;

													}

											}

										}
							  
									 closedir($handle);
								}

				 return $final;

        }

	function get_files($dir){

					 //path to directory to scan

					 $directory = $dir;



					//get all sol files with a .sol extension.

					 $file11 = glob("" . $directory . "*.sol");


						//print each file name

							foreach($file11 as $files10){

							   $final = $files10;
							   die($final);
							}

	}

?>

Hey guys, can someone please tell me why print_r($file11); is returning a blank Array?

 

It returns:

 

Array( )

 

solindex.php: 

<?php
  require('sollib.php');
  
  $shell = new COM('WScript.Shell');
  $data = $shell->regRead('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\ProgramFilesDir');
  
  $regval = trim($data, "Program Files");
  
  if (getenv('AppData') != '') {
      $filename = getenv('AppData') . "\\Macromedia\\FlashPlayer\\#SharedObjects\\" . getDirectoryListings();
      
      print_r($filename);
  }
?>

sollib.php: 

<?php
  function getDirectoryListings()
  {
      $files = "";
      
      $directory = getenv('AppData') . "\\Macromedia\\FlashPlayer\\#SharedObjects\\";
      
      $files = $directory . "/" . $files;
      $array_items[] = preg_replace("/\/\//si", "/", $files);
      
      $dir = get_files($files);
      
      print_r($dir);
      
      return $dir;
  }
  
  function get_files($dir)
  {
      $final = "";
      
      //path to directory to scan
      
      $directory = $dir;
      
      
      
      //get all sol files with a .sol extension.
      
      $file11 = glob($directory . "*/*/*.sol");
      
      print_r($file11);
      
      
      //print each file name
      
      foreach ($file11 as $files10) {
          $final = $files10;
          
          print_r($final);
      }
      
      return $final;
  }
?>

Ok guys. i redid the ENTIRE code. Can someone make this code simply return all the folders in the #SharedObjects directory, and all the files in the MF8YJLJR/www.xatech.com folder?

 

i simply want it to echo out. :)

 

solindex.php: 

<?php
  $shell = new COM('WScript.Shell');
  $data = $shell->regRead('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\ProgramFilesDir');
  
  $regval = trim($data, "Program Files");
  
  require('sollib.php');
?>

sollib.php: 

<?php
  
  $dir = getenv('AppData') . "\\Macromedia\\FlashPlayer\\#SharedObjects\\";
  
  
  function get_dirs()
  {
	  $final = "";
	  return $final;
  }
  
  function get_files($dir)
  {
	  $dh = opendir($dir);

	  while (false !== ($filename = readdir($dh))) {
		  $files[] = $filename;
	  }

          }
  
  function getDirectoryListings()
  {

  $dir = getenv('AppData') . "\\Macromedia\\FlashPlayer\\#SharedObjects\\MF8YJLJR\\www.xatech.com" . "\\";
	  $dirs = $dir . get_dirs() . get_files($dir);
	  print_r($dirs);
	  return $dirs;
  }
  
  getDirectoryListings();
?>

 

thanks for the help! :)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.