kimili / no-db-url-shortener Goto Github PK
View Code? Open in Web Editor NEWA simple little URL shortener script that saves its data in flat files rather than a database.
License: MIT License
A simple little URL shortener script that saves its data in flat files rather than a database.
License: MIT License
I believe the "_generate_new_hash" function in URLShortener.php is missing a step.
In the case where the hash already exists, it is to increment the daily count and then generate the new hash. However, the return value to the recursive call to generate the new hash is never stored. Therefore, the returned value will be the duplicate hash.
I believe the fix should be as follows:
Before:
// Check to see if the hash is already in use
if ( $this->_does_hash_exist($hash) ) {
$this->_increment_daily_count();
$this->_generate_new_hash();
}
After:
// Check to see if the hash is already in use
if ( $this->_does_hash_exist($hash) ) {
$this->_increment_daily_count();
$hash=$this->_generate_new_hash();
}
Hi,
thanks for providing this code, but I cannot get this work in subfolder.. I followed your readme file. im on debian classic virtualmin setup.. when I do generate link I get following:
{"originalURL":"https:\/\/github.com\/kimili\/No-DB-URL-Shortener","shortURL":"http:\/\/mydomain.uk\/xyeqP","baseURL":"mydomain.uk","hash":"xyeqP"}
but shortener is in mydomain.uk/l/ - any thoughts?
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.