Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
coredatarecovery opened this issue Aug 23, 2011 · 5 comments
Open

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

coredatarecovery opened this issue Aug 23, 2011 · 5 comments

Comments

@coredatarecovery
Copy link

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.

@ryanluce
Copy link

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.

@dougwo
Copy link

dougwo commented Nov 16, 2011

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

@ryanluce
Copy link

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

@dougwo
Copy link

dougwo commented Nov 16, 2011

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?

@ryanluce
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants