Giter Club home page Giter Club logo

cmprzurl's Introduction

cmprzurl 
    - a simple implement of TinyURL.com and deploy easily on your own domain.

==============
Introduction:
==============
    Have you ever heard of tinyurl.com or is.gd?
    Do you wanna make your domain have the ability to shorten long url?

    Yes, all we need is 4 files.
    Maybe you should read the section 'What each file do?' first ;-)

=============
Requirement:
=============
    * Apache web server and support .htaccess [2.0.63]
    * SQLite3                                 [3.2.1]
    * Python                                  [2.3.5]
    * pysqlite2 (or sqlite3) module

    # My environment is what you see in the brackets.

===========
Installation:
===========
    The following steps we are under root directory of your domain. e.g.:
    http://xxxxxx.org -> /home/xxxxxx/xxxxxx.org/

    0. Upload the files:

       cmprzurl.py, redirect.py, dotaccess, cmprzurl.sql, (cmprzurl.db)

    1. Create a sqlite3 database and a table using the following directive:

       $ sqlite3 cmprzurl.db < cmprzurl.sql

       # You can also skip this step by using the db I had created
       	 named 'cmprzurl.db'.

    2. Append the content of dotaccess into your .htaccess:

       $ cat dotaccess >> .htaccess

    3. Make the two scripts executable:

       $ chmod +x cmprzurl.py redirect.py

    4. Clean up & done:

       $ rm dotaccess cmprzurl.sql

====================
What each file do?:
====================
    * cmprzurl.py

      Generate an alias like 'eJk8pA' for mapping the long url,
      then store the alias and longurl into database.

    * redirect.py

      Redirect the request url like 'http://xxxxxx.org/eJk8pA'
      to the real url.

    * dotaccess

      Make the files/dirs under domain root directory works well
      as before, but the alias like 'eJk8pA' can be redirected
      correctly.

    * cmprzurl.db

      Store the aliases and their mapping longurls.

=======
Usage:
=======
    Type the url from browser address bar directly:
        http://xxxxxx.org/cmprzurl.py?longurl=http://www.faqs.org/rfcs/rfc3022.html

    Or, you can generate a html form like:

    <form method="post" action="http://xxxxxx.org/cmprzurl.py">
        <input type="text" name="longurl"> <!-- must be 'longurl' or modify the source code -->
        <input type="submit" value="Shorten!">
    </form>

    Then, 'cmprzurl.py' will generate an alias for the long url like:
        http://xxxxxx.org/a9Y7Hz

=========
License:
=========
    Copyright 2009 vvoody <ydoovv{AT}gmail.com>
    All rights reserved.

    The programs are released under GNU General Public License version 3.
    For license details, checkout:
        http://www.gnu.org/copyleft/gpl.html

Any problems please contact vvoody -> ydoovv_AT_gmail_DOT_com

cmprzurl's People

Contributors

ydoovv avatar

Stargazers

曹文忠 avatar Angus H. avatar vvoody avatar mlzboy avatar

Watchers

vvoody avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.