close

Privacy guaranteed - Your email is not shared with anyone.

Did I mention I love PHP?

Discussion in 'Tech Talk' started by Sinister Angel, Feb 5, 2005.

  1. Sinister Angel

    Sinister Angel I'd Hit It!

    Joined:
    Oct 11, 2004
    Messages:
    252
    Likes Received:
    0
    Location:
    Traverse City, Michigan
    I think my streak over the past few days of Apache/directory listing customization is a message from god that I should start coding more and actually learn PHP instead of hacking **** together as I go.

    Few days ago I got bored and started playing around with Apache's HeaderName and ReadmeName directives. Well, I had played around with them prior because a friend wanted to know how to change the link color for his directory listings on his site, but I didn't really get too involved, just did some code to call a CSS file.

    Then, like I said, I started playing with customizing directory listings a few days ago a bit more heavilly. At first, I wanted to change the header so it said "Thank you for perusing the directory listing of *dir*"
    Well, I tried using SSI (which I more or less gave myself a crash course in) and tried echoing PATH_INFO. But for whatever reason, I couldn't seem to get that to work. No big deal - I have PHP :D

    Well, I originally tried using a php file itself in the HeaderName directive - then I found out that it only takes files with the mimetype of text/*. Well, that's a nogo for PHP (Remember kids, PHPs mimetype is application/x-httpd-php). Oh well, no big deal, back to using server side includes. Well, that works like a champ. Only problem is that it will show the sorting options if the link is clicked. I'll save that problem for another day.

    On to the ReadmeName directive. I wanted to throw in my "Song of the Day" and the lyrics. That was easy. Had the SotD in another file. Simple SSI call. I then thought "Hey, I wonder if I can make this thing show what song I'm currently listening to in winamp..." A while back, I had a program that allowed me to telnet in and control winamp. I figured a little reading of PHPs documentation on fsockopen() and some other stuff should do the trick, but I couldn't seem to find that plugin. I did however find something else, which in the end probably made my life 10 million times easier. I got the plugin httpQ, which more or less takes http requests and returns data based on parameters. What's even nicer is that the creator threw sample PHP code on his site for a user defined function for making the call to the plugin. Dear Diary: Jackpot!


    Sorry for the long post that probably is kinda lame, but I just felt like sharing the return to my geek roots. If anyone is interested in seeing the site and/or source, let me know.
     
  2. David_G17

    David_G17 /\/\/\/\/\/\/\/

    Joined:
    Oct 7, 2002
    Messages:
    2,046
    Likes Received:
    0
    PHP is great. i've just started using it, and where i work we are trying to transition from cold fusion to PHP.

    i'm loving it.
     

  3. Sinister Angel

    Sinister Angel I'd Hit It!

    Joined:
    Oct 11, 2004
    Messages:
    252
    Likes Received:
    0
    Location:
    Traverse City, Michigan
    I just love how bloody versatile it is.
     
  4. Vince

    Vince

    Joined:
    Jul 3, 2001
    Messages:
    15
    Likes Received:
    0
    Location:
    Midland, MI, USA
    I appreciate you posting your experience with PHP. A couple of months ago, I started a thread on this board asking what languages people recommended learning, and the recommendations for PHP were convincing. I started learning it, but then quickly realized it would be beneficial to learn JavaScript first. I'm getting a good handle on JavaScript, and am excited to get back to learning PHP soon.

    I would be interested in seeing the site/source code.

    Thanks,
     
  5. SamBuca

    SamBuca

    Joined:
    Aug 9, 2002
    Messages:
    317
    Likes Received:
    0
    Location:
    Carlisle, PA
    I live and breathe PHP. I swear by it for all tasks (web or shell).

    Try the ForceType directive in apache.
     
  6. Sinister Angel

    Sinister Angel I'd Hit It!

    Joined:
    Oct 11, 2004
    Messages:
    252
    Likes Received:
    0
    Location:
    Traverse City, Michigan
    Update folks!

    I just spent all night working on it some more, and with the help of the friendly folks at the local Linux Users Group over IRC, I now not only have the current song I am listening to, but the lyrics as well (if they are available). This involved a brutal crash course in regexs. You can look at the source, and see the product of the source here.

    Yeah, I shoudl have commented my ****, but I was kinda busy for doing that. If you need any explaination as to what stuff does, feel free to ask.

    Oh yeah, my cable upload sucks, so try not to slashdot it ;f