SitePoint Sponsor

User Tag List

Results 1 to 20 of 20
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cross-Site Scripting

    Does anyone know of any code for "cross-site" scripting? I want to access a directory from another site and run the files through a while loop to put them in a mysql database.

    This is because my files are one server, and my site is on another. The reasoning for the setup ois that the site can become very slow with the file downloads, and theres also limited space on the server I'm hosting hte pages on.

  2. #2
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look at FTP Functions

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is FTP the only option? I have a weird problem with FTP on my server in that only the local IP address works, as opposed to 65.97.19.150.

  4. #4
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is FTP the only option?
    Maybe not. Is the home server running apache? If so I suppose you could read in and parse the directory index over HTTP.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is. How would this be accomplished? There's no index file for it, so I can't parse that...what do you suggest?

  6. #6
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Then you can't. Fix your NAT router and use FTP. Or use the auto-generated DirectoryIndex in apache.

  7. #7
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, I'm saying I do have apache, but that I don't know how to use the DirectoryList. Could you suggest some PHP functions, or maybe a tutorial?

  8. #8
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you have any virtual hosts on the server or is it a stock setup?

  9. #9
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's stock.

  10. #10
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah I attempted the FTP, it didnt work. Whats your idea on apache's directory list parsing?

  11. #11
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First get indexes to work. Add a line like this in httpd.conf and restart apache:
    Code:
    <Directory />
        Options Indexes
        AllowOverride None
    </Directory>

  12. #12
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's already there.

  13. #13
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Then do you have any directives further down that would turn Indexes off?

  14. #14
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not to my knowledge. Directory Indexing is on, I just don't know how to parse it.

  15. #15
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright, I'm back, sorry. So do you know how to accomplish it?

  16. #16
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So then you'd read the directory index in with fgets() or similar and parse the file with preg_match().

  17. #17
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I have actually looked in to learning how to use regular expression, but I can't figure it out. Seems to be over my head. How would I "match" names of 100+ files anyway?

  18. #18
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look at preg_match_all(). If you can match one, you can match billions of them. They all get stored in a nice two dimensional array that you can manipulate to your heart's content.

  19. #19
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What will the array look like? This is a hell of a lot more complicated than i thought it would be. I don't know how to use arrays either.

  20. #20
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, I don't have time to write the script for you. RTFM , try writing some code, come up with some more specific questions, and I'll be glad to help.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •