PHP-URL-Shortener icon indicating copy to clipboard operation
PHP-URL-Shortener copied to clipboard

having an issue, I'm not getting inserts into the table

Open coredatarecovery opened this issue 13 years ago • 5 comments

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.

coredatarecovery avatar Aug 23 '11 20:08 coredatarecovery

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.

ryanluce avatar Aug 31 '11 18:08 ryanluce

I have the same issue. I tried $integer+=100 at the beginning of the function and I still can't get inserts.

dougwo avatar Nov 16 '11 21:11 dougwo

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

ryanluce avatar Nov 16 '11 21:11 ryanluce

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?

dougwo avatar Nov 16 '11 21:11 dougwo

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.

ryanluce avatar Nov 16 '11 21:11 ryanluce