PHP-URL-Shortener
PHP-URL-Shortener copied to clipboard
having an issue, I'm not getting inserts into the table
The database is not getting updated, any suggestions for debug? I'm running on qrtrk.us for my shortener, I'm getting qrtrk.us/0 for every shortened url and it's not forwarding no lines have been inserted into the table shortenedurls
I've double checked the user name, the password, the database name I can phpadmin and manually add lines/records but no redirect happens.
I Don't think this works if the row count is less than the string length of ALLOWED_CHARS... kind of weird, don't know how this wasn't an issue when he built it. In the getShortenedURLFromID function if you insert $integer+=100 it works for me. Strange.
I have the same issue. I tried $integer+=100 at the beginning of the function and I still can't get inserts.
here's the code I had modified awhile back:
function getShortenedURLFromID ($integer, $base = ALLOWED_CHARS) { $integer += 100; $length = strlen($base); $out = ""; while($integer > $length - 1) { $out = $base[fmod($integer, $length)] . $out; $integer = floor( $integer / $length ); print "while loop: " . $out . " - ". $integer . "\n"; } print "getshortened url:" . $out . ' ' . $base; return $base[$integer] . $out; }
This was in shorten.php
I got mine working Ryan, but I am confused. This doesn't seem to be a shortener at all. It only stores an index. What is the point of $base of there isn't even a column in the database for a shortened slug?
Yeah, I think it's fundamentally flawed. I used it for a brief time and then I believe I just implemented my own method. I can't speak for what the original author intended.