Code Monkey home page Code Monkey logo

shorterlinks's Introduction

Shorter Links

Yes it's another shorter links, I tried to leave it as simple as possible so as to make it usable and understandable by as many people as possible.


Live Demo:

You can test the it on THIS SITE!

ShorterURL_test.gif


Features:

  • Same output in case of same input link

  • Possibility to create almost 100 million short links (99795696 to be precise)

  • Checks on user input:

    • The user must actually enter a valid URL

    • The URL entered must be at least 22 characters (protocol included) otherwise it would be shorter than the exit short link

  • The site is responsive

  • Button to copy the short link

  • Prevent SQL injection

Note:

Due to how the database and the scripts have been structured, these features can be easily added:

  • Custom short link (Ex: ed0.it/google)

  • Elimination of short links after a certain time


Prerequisites:

  • PHP

  • A site (obviously)

  • A database (I use MySQL)


Installation:

  1. Create a database with a table called "associations" with this schema:

    code link data
    varchar() varchar() timestamp
    CREATE TABLE `associations` (
      `code` varchar(20) DEFAULT NULL,
      `link` varchar(767) DEFAULT NULL,
      `data` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
      UNIQUE (`code`),
      UNIQUE (`link`)
    );
  2. Edit index.php with the database login credentials you just created

  3. Replace in the various files the word "xx.xx" with your site, in my case it was "ed0.it"

  4. Insert the .htaccess and redirect.php into the site root

  5. Create a sub folder called sl

  6. Insert the index.php, result and style.css into the sub folder sl

  7. That's all folks!


Donation:

Buy me a coffee (PayPal): Ed0ardo

Buy me a coffee (Binance Pay): 268880867

Buy me a coffee (Binance Wallet): 0x2a895d54c5249349a27183139d5975aa3518d573

Buy me a coffee (Trust Wallet): 0x825fFeB482BE713eA3bFea0F3B8c398813B65269

Buy me a coffee (CashApp): $Ed0ardo

shorterlinks's People

Contributors

ed0ardo avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

mighel881

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.