Results 1 to 7 of 7

Thread: Got good(ish) PHP/Web developing skills? *nix is your breakfast? Get over here!!!

  1. #1
    <<== UT3 Player spoon_'s Avatar
    Join Date
    Nov 2008
    Location
    London
    Posts
    1,870
    Thanks
    101
    Thanked
    123 times in 115 posts

    Got good(ish) PHP/Web developing skills? *nix is your breakfast? Get over here!!!

    What I'm trying to do seems very simple but I DON'T have any skills whatsoever to do this... I'm willing to learn though.

    Basically I have installed Dropbox app on my server running cut down version of Ubuntu. No GUI is available.

    If you're not familiar with Dropbox head over to their website at http://www.dropbox.com

    Its basically file syncing app, you drop files into your Dropbox folder(s) and they get synced up to the cloud and other devices that are linked to your account. iPhones, Mac/Linux/Windows clients. Pretty awesome stuff.

    Daemon of Dropbox is running and to get any sort of output/status from it you need to mess about with the command line via SSH.

    Not very user friendly if you ask me.

    Server is running web-server [Apache ], got PHP installed [5.2.11], MySQL & Python 2.7 if needed.

    Now you probably know where I'm going with this...

    I'd like to build nice looking front end to be able to perform very basic (for now) functionality on Dropbox. Example, to check if all my folders are synced up I need to issue this command:

    /share/MD0_DATA/.qpkg/Dropbox/tools/dropbox.py filestatus /share/Dropbox/*

    Output:

    /share/Dropbox/!!!: up to date
    /share/Dropbox/Backups: up to date
    /share/Dropbox/Certs: up to date
    /share/Dropbox/Docs: up to date
    /share/Dropbox/Drivers Win7 x64: up to date
    /share/Dropbox/Drivers WinXP x86: up to date
    /share/Dropbox/ImageX: up to date
    /share/Dropbox/Installs Win7 x64: up to date
    /share/Dropbox/Links: up to date
    /share/Dropbox/My Docs: up to date
    /share/Dropbox/Photos: up to date
    /share/Dropbox/Projects: up to date
    /share/Dropbox/Public: up to date
    /share/Dropbox/Scripts: up to date
    /share/Dropbox/Shared_Folders: up to date
    /share/Dropbox/Software: up to date


    More commands are available:

    [~] # /share/MD0_DATA/.qpkg/Dropbox/tools/dropbox.py help
    Dropbox command-line interface

    commands:

    status get current status of the dropboxd
    help provide help
    puburl get public url of a file in your dropbox
    stop stop dropboxd
    start start dropboxd
    filestatus get current sync status of one or more files
    ls list directory contents with current sync status



    Now what I know about PHP is that's server side so should be able to output what I need & nicely formatted if I press a button on the page. I'd probably like to have a button for each function above i.e. status, help, puburl etc

    Question - where do I even start?


    Adrian

  2. #2
    "make it so" scaryjim's Avatar
    Join Date
    Jan 2009
    Location
    Manchester
    Posts
    9,236
    Thanks
    726
    Thanked
    1,144 times in 1,008 posts
    • scaryjim's system
      • Motherboard:
      • Asus M4A785TD-M EVO
      • CPU:
      • Phenom II X4 905e
      • Memory:
      • 2x 4GB Crucial Ballistix Tactical VLP
      • Storage:
      • 750GB Seagate
      • Graphics card(s):
      • Sapphire 7750 Low Profile
      • PSU:
      • FSP 250W TFX
      • Case:
      • AOpen H360b
      • Operating System:
      • Windows 7 Professional x64
      • Monitor(s):
      • IBM ThinkVision C220P (6735-60N) (22" CRT)

    Re: Got good(ish) PHP/Web developing skills? *nix is your breakfast? Get over here!!!

    Where do you start? By reading up on security concerns! You can run shell commands from PHP, but you're risking all sorts of security holes writing a web application to do it, so be *very* careful.

    Although I don't know anything about it myself, I'd be inclined to suggest that it may be safer / easier to learn Python and use that - you should be able to import the Dropbox python scripts and run them directly which *should* present less security problems then trying to run shell / system commands directly from PHP. Although as I said, I don't know python, so I might be mistaken on that...

  3. #3
    <<== UT3 Player spoon_'s Avatar
    Join Date
    Nov 2008
    Location
    London
    Posts
    1,870
    Thanks
    101
    Thanked
    123 times in 115 posts

    Re: Got good(ish) PHP/Web developing skills? *nix is your breakfast? Get over here!!!

    Yeah that's right, you can imagine someone fairly easily executing rm -rf * lol

  4. #4
    explodingdog streetster's Avatar
    Join Date
    Jul 2003
    Location
    Copenhagen
    Posts
    4,121
    Thanks
    117
    Thanked
    99 times in 81 posts
    • streetster's system
      • Motherboard:
      • Asus P7P55D-E
      • CPU:
      • Intel i5 750 2.67 @ 4.0Ghz
      • Memory:
      • 4GB Corsair XMS DDR3
      • Storage:
      • 2x1TB Drives [RAID0]
      • Graphics card(s):
      • 2xSapphire HD 4870 512MB CrossFireX
      • PSU:
      • Corsair HX520W
      • Case:
      • Coolermaster Black Widow
      • Operating System:
      • Windows 7 x64
      • Monitor(s):
      • DELL U2311
      • Internet:
      • Virgin 50Mb

    Re: Got good(ish) PHP/Web developing skills? *nix is your breakfast? Get over here!!!

    I was going to recommend having a read about 'exec' but it could be a dangerous route... so instead i'll point you to the dropboxAddons wiki page for you to have a look if someone has already done something similar

  5. #5
    <<== UT3 Player spoon_'s Avatar
    Join Date
    Nov 2008
    Location
    London
    Posts
    1,870
    Thanks
    101
    Thanked
    123 times in 115 posts

    Re: Got good(ish) PHP/Web developing skills? *nix is your breakfast? Get over here!!!

    I have checked Wiki pages for Dropbox already, nothing there that might help me. Also I'd mixed results with exec command wrapped around some rather experimental php code.

    Oh well.

    How you do these things in rather secure manner? I mean how can you execute commands from the web server without compromising the server itself?

  6. #6
    PHP Geek Flash477's Avatar
    Join Date
    Dec 2008
    Location
    Devon
    Posts
    777
    Thanks
    50
    Thanked
    70 times in 63 posts

    Re: Got good(ish) PHP/Web developing skills? *nix is your breakfast? Get over here!!!

    It wouldn't be real time, but you could have the status written to a text file through cron, and then have PHP query the contents of the file.

  7. #7
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    14,617
    Thanks
    591
    Thanked
    1,550 times in 1,033 posts

    Re: Got good(ish) PHP/Web developing skills? *nix is your breakfast? Get over here!!!

    I don't know much about dropbox, but surely you can query that info without been root?

    I would have hoped they have httpd running as a very hevily restricted user, it might just be a case of granting it execute on some scripts?
    throw new ArgumentException (String, String, Exception)

Thread Information

Users Browsing this Thread

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

Posting Permissions

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