xsavitar / url-shortener Goto Github PK
View Code? Open in Web Editor NEWThis is a URL shortener application built using PHP and MySQL database MS.
Home Page: https://tools.wmflabs.org/durl-shortener/shortener.php
License: MIT License
This is a URL shortener application built using PHP and MySQL database MS.
Home Page: https://tools.wmflabs.org/durl-shortener/shortener.php
License: MIT License
Travis CI should be setup for the repo / project for automated testing to be done before review is carried out on PR and/or the project. Consider a minimum PHP version of 5.6 for the project.
When the long link is gotten from the browser, there should be a check for whether the link already exist in the DB. If its found in the DB, then the application should just returned its corresponding short link else it should then do the hashing and return the short link in the browser.
After shortening URL in production: https://tools.wmflabs.org/durl-shortener/shortener.php, the short URL doesn't redirect to the long URL. NOTE: however, this works in localhost, so some debugging needs to be done to figure out why it's not working in production / test server.
Do a solid README.md for how the project can be setup locally or on deployment. To do this, one must have to understand how the project works so that steps will not be misleading.
Looking at the db-connection file in php-scripts folder, you can clearly see that there are 2 configurations for connecting to the DB. There is one for localhost and another for tool labs (deployment env). Also, if you look at the shortener.php in the root directory, you will see that;
$LINK = "tools.wmflabs.org/durl-shortener/shortener.php/" which is only valid on tool labs. But when used on localhost, we need something like this:
$LINK = "localhost:3000/shortener.php" where 3000 is the localhost deployment port. So check files that have link that point to tool labs and create a local host version.
You can decide to make the tool labs link variable like this: $LINK_TL and the localhost variable like this: $LINK_LH.
When using Chrome browser, the url-shortner site opens well but does not when using firefox. It reports erros like:
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
This problem can sometimes be caused by disabling or refusing to accept cookies.
Codes for connecting to database is really procedural and needs to be changed to an object oriented paradigm. So a class for this operation should be created and used in the codes.
On production it returns something like localhost:3000/shortener.php/zdjmmwiy
and writes it to DB so it's impossible to get the right redirect.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.