Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Ani would you mind making a PHP file for me?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Random spam
View previous topic :: View next topic  
Author Message
Aviar³
Grandmaster Cheater
Reputation: 50

Joined: 03 Jan 2008
Posts: 655
Location: Canada

PostPosted: Sun Dec 02, 2012 6:30 pm    Post subject: Ani would you mind making a PHP file for me? Reply with quote

All it would need to do is take a single parameter which represents a relative directory (you can do absolute if that's easier) upon which it generates an XML file containing a listing of said directories files and folder (files and folders need to have a seperate tag so that I can tell the difference). Would that be too hard?
_________________
This is the inception of deception, checking the depth of your perception.
Back to top
View user's profile Send private message
Fafaffy
Cheater
Reputation: 65

Joined: 12 Dec 2007
Posts: 28

PostPosted: Sun Dec 02, 2012 6:31 pm    Post subject: Reply with quote

Because god forbid ftp.site.com
_________________
Brillia wrote:
I FUCKING FUCK SEX
Back to top
View user's profile Send private message Send e-mail
Aviar³
Grandmaster Cheater
Reputation: 50

Joined: 03 Jan 2008
Posts: 655
Location: Canada

PostPosted: Sun Dec 02, 2012 6:31 pm    Post subject: Reply with quote

>speaking when not spoken to
_________________
This is the inception of deception, checking the depth of your perception.
Back to top
View user's profile Send private message
:^)
Grandmaster Cheater Supreme
Reputation: 37

Joined: 30 Jun 2008
Posts: 1062

PostPosted: Sun Dec 02, 2012 7:06 pm    Post subject: Reply with quote

hi aviar, how you been
Back to top
View user's profile Send private message
PUSHEAX_PUSHEAX
Grandmaster Cheater
Reputation: 72

Joined: 13 Apr 2009
Posts: 969

PostPosted: Sun Dec 02, 2012 8:19 pm    Post subject: Reply with quote

Let me know if this is right, I can append it easily (or you). Screenshot explains usage.
Code:
<?php
//don't use a trailing slash
$dir = htmlentities($_GET['dir']);
$xmlSaveLocation = $dir . '/structure.xml';

$domtree = new DOMDocument('1.0', 'UTF-8');

    /* create the root element of the xml tree */
    $xmlRoot = $domtree->createElement("directory");
    /* append it to the document created */
    $xmlRoot = $domtree->appendChild($xmlRoot);

    $currentTrack = $domtree->createElement("list");
    $currentTrack = $xmlRoot->appendChild($currentTrack);

    /* you should enclose the following two lines in a cicle */

foreach(glob($dir . '/*') as $file) 
{
   if (basename($file) !== basename($_SERVER['PHP_SELF']) && basename($file) !== basename($xmlSaveLocation))
   {
      if (filetype($file) == 'file')
      {
         $currentTrack->appendChild($domtree->createElement('file', basename($file)));
      }
      elseif (filetype($file) == 'dir')
      {
         $currentTrack->appendChild($domtree->createElement('dir', basename($file)));
      }
      else
      {
         $currentTrack->appendChild($domtree->createElement('undefined', basename($file)));
      }
   }
   
}
    $domtree->save($xmlSaveLocation);

?>



xml_poc.png
 Description:
 Filesize:  55.19 KB
 Viewed:  2405 Time(s)

xml_poc.png


Back to top
View user's profile Send private message
Aviar³
Grandmaster Cheater
Reputation: 50

Joined: 03 Jan 2008
Posts: 655
Location: Canada

PostPosted: Sun Dec 02, 2012 11:55 pm    Post subject: Reply with quote

Thanks potaters. I haven't tested it myself, but based on the image it looks like exactly what I need. The only thing I'll probably change is so that it just responds back with the XML instead of storing it locally.

Hey Rozen, doing pretty good, you?

_________________
This is the inception of deception, checking the depth of your perception.
Back to top
View user's profile Send private message
Hero
I'm a spammer
Reputation: 79

Joined: 16 Sep 2006
Posts: 7154

PostPosted: Mon Dec 03, 2012 12:09 am    Post subject: Reply with quote

fak you aviar y u no talk to me no moar?
Back to top
View user's profile Send private message
PUSHEAX_PUSHEAX
Grandmaster Cheater
Reputation: 72

Joined: 13 Apr 2009
Posts: 969

PostPosted: Mon Dec 03, 2012 12:23 am    Post subject: Reply with quote

Aviar³ wrote:
Thanks potaters. I haven't tested it myself, but based on the image it looks like exactly what I need. The only thing I'll probably change is so that it just responds back with the XML instead of storing it locally.

Hey Rozen, doing pretty good, you?

It doesn't. It stores it in structure.xml (overwrites the previous each time its run). I only opened it in the browser to show you the output.
Back to top
View user's profile Send private message
Aniblaze
Grandmaster Cheater Supreme
Reputation: 138

Joined: 23 Apr 2006
Posts: 1757
Location: The Netherlands

PostPosted: Mon Dec 03, 2012 4:39 am    Post subject: Reply with quote

I was too late. Ah well.

Small note: I wouldn't use the DOM parser due to the fact that it loads the entire XML into the memory as an object. Meaning that a lot of directory entries will cause it to exceed the memory limit set by PHP. Especially with the DOM you'll exceed that memory limit relatively fast. Instead use PHP's XMLWriter class, and XMLReader to read the file. DOM is easier, but the XMLWriter and XMLReader classes are safer when you're dealing with growing XML files.

Just my two cents. If the file stays under a 100 entries this isn't information worth reading.
Back to top
View user's profile Send private message
Aviar³
Grandmaster Cheater
Reputation: 50

Joined: 03 Jan 2008
Posts: 655
Location: Canada

PostPosted: Mon Dec 03, 2012 6:36 am    Post subject: Reply with quote

Once again Ani, you are an inspiring light.


To potaters, I know it does not do it right now, but I imagine it would not be hard to serialize the resulting XML to be sent on the wire instead of storing it.

To Hero, you never talk to me either.

_________________
This is the inception of deception, checking the depth of your perception.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Random spam All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites