Results 1 to 9 of 9

Thread: Apache Web Server

  1. #1
    Join Date
    Dec 2012
    Beans
    26

    Apache Web Server

    Hi everyone,
    So recently I've been trying to make my own webserver (I have the basics set up now). My friend has his server set up so when you send a HTTP GET request to it the server turns it into a SQL query and returns all the data from that row as a JSON file. So the request would be somewebsite.com/something?=a%20SQL%20query. Does anyone have any clue how he did it?
    Thanks
    Ubuntu Server Edition 12.04 (LTS)

  2. #2
    Join Date
    Aug 2008
    Beans
    1,835
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Apache Web Server

    Why don't you ask him?

  3. #3
    Join Date
    Dec 2012
    Beans
    26

    Re: Apache Web Server

    Quote Originally Posted by alphacrucis2 View Post
    Why don't you ask him?
    So maybe friend is a bit too strong of a word... More of a person I met and briefly worked on a project with.

  4. #4
    Join Date
    Jun 2007
    Location
    Porirua, New Zealand
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Apache Web Server

    Thread moved to Server Platforms.

    One way would be to have a web page written using PHP that parses the passed URL, does the necessary SQL lookup, and outputs the appropriate HTML or XML based on the results of the SQL query.
    Forum DOs and DON'Ts
    Never assume that information you find using a search engine is up-to-date.

  5. #5
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    8,527
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Apache Web Server

    It's probably a PHP script. It could be pretty insecure if he doesn't apply strong validation checks against the input string. What if the query is "drop database"?
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  6. #6
    Join Date
    Mar 2013
    Beans
    30

    Re: Apache Web Server

    I would write a program that knows just enough about HTTP to parse incoming data ,interpret as sql request, etc. Or would create a plugin that does the same thing for an existing server such as NGINX or Apache.

    Using a standard PHP implementation would be extremely slow and inefficient for such a specialized and narrow purpose.
    Last edited by mharv; March 30th, 2013 at 07:55 PM.

  7. #7
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: Apache Web Server

    Quote Originally Posted by SeijiSensei View Post
    It's probably a PHP script. It could be pretty insecure if he doesn't apply strong validation checks against the input string. What if the query is "drop database"?
    Indeed...

    Cheesemill

  8. #8
    Join Date
    Jun 2007
    Location
    Porirua, New Zealand
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Apache Web Server

    Too true: sanity checks are essential for anything entered by URL and/or web form that will be used to query or update a database.
    Forum DOs and DON'Ts
    Never assume that information you find using a search engine is up-to-date.

  9. #9
    Join Date
    Jun 2011
    Beans
    318

    Re: Apache Web Server

    The concept is fairly simply, it could be done with a few lines of PHP code. However, as others have pointed out you need to make sure of two things:
    1. There is no sensitive information in the database as anyone in the world will be able to access the information.
    2. Do not allow the PHP script to have write/drop/delete access to the database. Make sure it has read-only access or someone will come along and erase your data.

Tags for this Thread

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
  •