Close

Results 1 to 11 of 11
  1. #1
    DF Super Moderator
    DejaVu's Avatar
    Join Date
    Nov 2005
    Location
    Essex
    Posts
    9,107
    Thanks
    1,836
    Thanked:        4,004
    Karma Level
    954

    Default Any PHP Coders on here can help solve a simple (ish) script?

    I'm trying to add something to MediaFrontPage for XBMC. It's essentially a web program running on a Server that helps monitors all your XBMC Web Programs like Sickbeard, CouchPotato and SabNZBd.

    I need help with a PHP Script that loads the config and layout files into the web page so they can be edited and then saved instead of SSH'ing in. It just makes it more simple.

    It's a bit difficult to explain, but if you load edit.php in this zip file, it will give some idea of what I mean.

    I made a Youtube Video of how far I have got, but it only Saves the files back to config.php. layout.php has not been added as I do not know how to. It's unable to load a different file into the textarea at the moment.
    http://www.youtube.com/watch?v=otwfbV6lA5c

    I'm fine with HTML, CSS and minor Javascript, but PHP tends to lose me.

    To see the whole thing in action, I have it on my Repo, but am a little stumped at how to sort it. Googling for it brings up the wrong thing... Inline/Online PHP File Editor.
    https://github.com/DejaVu77/mediafrontpage

    Hoping someone here with some skills can point me in the right direction.


  2. #2
    DF Moderator EvilBoB's Avatar
    Join Date
    Jan 2001
    Location
    Bedfordshire
    Posts
    6,353
    Thanks
    583
    Thanked:        620
    Karma Level
    607

    Default Re: Any PHP Coders on here can help solve a simple (ish) script?

    So you just need a web based file editor?

    This should be fairly simple - open a server side file into a variable, dump the stored data into a textbox and put in some routines to save it. Is this the kind of thing you want it to do?
    DF Moderator
    XBox One | Panasonic 4k | MS Surface Pro 3 | 3DSXL | WiiU | RPi3
    XBL : TheSumOfAllEvil

  3. #3
    DF Super Moderator
    DejaVu's Avatar
    Join Date
    Nov 2005
    Location
    Essex
    Posts
    9,107
    Thanks
    1,836
    Thanked:        4,004
    Karma Level
    954

    Default Re: Any PHP Coders on here can help solve a simple (ish) script?

    Sorry. Forgot about this. Someone jumped on and completely rewrote this bit and it's been sorted!

    I have another PHP related question now though.

    Can PHP Change a "Templated" page dependent on a URL?

    I have a PHP Page that has been styled and written all one way. The only thing that would change is a piece of wording (Title) and an iFrame link - the iFrame links and Title have variables within a config.php and are set in the content.php page.

    How I mean.
    If the URL was - http://server.com/page?=content.php&=info

    The page would change depending on the &=info bit. The iFrame link would change dependent on the variable in the config.php and info would be the Title on the page.

    I've been hunting for a few days, learning PHP for Numpties and googling my little heart out trying to work it out - but completely failed everytime.

    --EDIT--
    Nope, even done this now.
    Takes me some time to get to grips with some of this PHP Coding business. But the answers are out there, so long as you know what to look for.
    Last edited by DejaVu; 30th June 2011 at 02:44 AM.


  4. #4
    DF VIP Member drdude's Avatar
    Join Date
    Oct 2002
    Location
    Putney
    Posts
    949
    Thanks
    72
    Thanked:        40
    Karma Level
    327

    Default Re: Any PHP Coders on here can help solve a simple (ish) script?

    Notepad++ is a free and good quality text-editor that formats PHP nicely. Let me know if you get stuck with anything as I did a considerable amount of PHP at university and can probably help.

    In addition to PHP, I found it worthwhile learning Smarty (a PHP template engine) and RedBeanPHP (a really easy and object-oriented way of interacting with databases).

  5. #5
    DF VIP Member drdude's Avatar
    Join Date
    Oct 2002
    Location
    Putney
    Posts
    949
    Thanks
    72
    Thanked:        40
    Karma Level
    327

    Default Re: Any PHP Coders on here can help solve a simple (ish) script?

    P.S. iframes are deprecated in HTML5 so you may want to look in to presenting your content differently, perhaps by using some jQuery AJAX stuff.

  6. #6
    DF Super Moderator
    DejaVu's Avatar
    Join Date
    Nov 2005
    Location
    Essex
    Posts
    9,107
    Thanks
    1,836
    Thanked:        4,004
    Karma Level
    954

    Default Re: Any PHP Coders on here can help solve a simple (ish) script?

    Indeed, this is what I have been trying to do, but it does not seem as easy as I first thought.
    I will be looking into this once I have the original Framset out of the original Repo.

    http://frinity.blogspot.com/2008/06/load-remote-content-into-div-element.html

    I'm not so sure AJAX would work so well considering there are XMLHttpRequests Cross Domain limitations (just stuff I have read and not experienced yet).


  7. #7
    DF VIP Member drdude's Avatar
    Join Date
    Oct 2002
    Location
    Putney
    Posts
    949
    Thanks
    72
    Thanked:        40
    Karma Level
    327

    Default Re: Any PHP Coders on here can help solve a simple (ish) script?

    Cross-domain limitations are only a problem if you are looking to pull in information from an external source (e.g. www.example.com trying to AJAX content from www.other.com). Even still, you should be able to get around that by writing a local PHP script which screen scrapes the data from the external source (and AJAX that script):

    Very simple solution
    Code:
    <?php
    # the URL to be scraped
        $url = 'http://www.example.com/scrape.html';
    
    # get the HTML
        $source = file_get_contents($url);
    ?>
    Using cURL - can do some fancy stuff with this if needed
    Code:
    <?php
    # the URL to be scraped
        $url = 'http://www.example.com/scrape.html';
    
    # initialise curl variable
        $ch = curl_init();
    # define parameters
        curl_setopt($ch, CURLOPT_URL,$url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
        curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    
    # get HTML
        $source = curl_exec($ch);
    
    # free resources
        curl_close($ch);
    }
    ?>
    Last edited by drdude; 3rd July 2011 at 07:48 AM.

  8. #8
    DF VIP Member drdude's Avatar
    Join Date
    Oct 2002
    Location
    Putney
    Posts
    949
    Thanks
    72
    Thanked:        40
    Karma Level
    327

    Default Re: Any PHP Coders on here can help solve a simple (ish) script?

    Is mfpedit.php the file that we should be looking at?

  9. #9
    DF Super Moderator
    DejaVu's Avatar
    Join Date
    Nov 2005
    Location
    Essex
    Posts
    9,107
    Thanks
    1,836
    Thanked:        4,004
    Karma Level
    954

    Default Re: Any PHP Coders on here can help solve a simple (ish) script?

    The one that has the iFrames called now is programs.php on my testing repo @ http://github.com/DejaVu77/mediafrontpage
    I dont think mfpedit.php has any iframes in it.

    What programs does, is calls the programs -SickBeard from the Query String

    http://server:ip/programs.php?p=SickBeard and uses the name within the page itself too.

    If the iFrame can be stripped out and Sickbeard can still be operated properly within that page would be awesome.

    Will loading times increase though?


  10. #10
    DF VIP Member drdude's Avatar
    Join Date
    Oct 2002
    Location
    Putney
    Posts
    949
    Thanks
    72
    Thanked:        40
    Karma Level
    327

    Default Re: Any PHP Coders on here can help solve a simple (ish) script?

    If you can wait a week, then I will be more than willing to help you out when I get back from the USA. There's a good two months before I start my graduate job, so will have plenty of time to help write whatever you need :-)

    Thanks to drdude

    DejaVu (5th July 2011)  


  11. #11
    DF Super Moderator
    DejaVu's Avatar
    Join Date
    Nov 2005
    Location
    Essex
    Posts
    9,107
    Thanks
    1,836
    Thanked:        4,004
    Karma Level
    954

    Default Re: Any PHP Coders on here can help solve a simple (ish) script?

    That would be excellent if you could! Nice one!


Similar Threads

  1. URGENT weird problem i can't solve
    By PimpMasterT in forum PC Problems
    Replies: 4
    Last Post: 21st October 2002, 03:02 PM
  2. Simple AES 128 DECRYPTION SOFT
    By Katgis in forum PC Software
    Replies: 0
    Last Post: 15th October 2002, 10:15 AM
  3. nhl 2003 - razor - crack.exe is a script virus?
    By petegas in forum PC Gaming
    Replies: 1
    Last Post: 6th October 2002, 10:29 PM
  4. Superman : new script review
    By TigerShark in forum Movie Talk
    Replies: 2
    Last Post: 25th September 2002, 01:50 PM
  5. coders lunch box - web site dev
    By wadgey in forum Forum Bug & Error Reports
    Replies: 1
    Last Post: 30th August 2002, 05:10 AM

Social Networking 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
  •