Welcome Guest, Not a member yet? Register   Sign In
search feature & result with pagination links
#4

[eluser]lukeinjax[/eluser]
When passing the search criteria in the URL, you have to be careful because the user can type in ANYTHING. However, you have a few options:

1) enable query strings
2) allow additional characters in the URL using the config setting
3) encode the search criteria in some way

I chose #3 because I didn't want to open my app to security risks. You'll be giving up human-readable URLs, but in my opinion, security is more important.

I used a modified base64_encode/decode for my search strings. The only problem with the normal base64_encode function is that it can introduce some additional chars that are not allowed by default in CI, so I extended the URL helper with these functions in one of the comments from the base64_encode documentation on php.net:

Code:
function base64_url_encode($input) {
    return strtr(base64_encode($input), '+/=', '-_,');
}

function base64_url_decode($input) {
    return base64_decode(strtr($input, '-_,', '+/='));
}

Hope this helps.


Messages In This Thread
search feature & result with pagination links - by El Forum - 09-02-2008, 06:43 AM
search feature & result with pagination links - by El Forum - 09-02-2008, 06:11 PM
search feature & result with pagination links - by El Forum - 09-03-2008, 03:22 AM
search feature & result with pagination links - by El Forum - 09-03-2008, 10:30 AM
search feature & result with pagination links - by El Forum - 09-04-2008, 09:50 AM
search feature & result with pagination links - by El Forum - 09-04-2008, 11:05 AM
search feature & result with pagination links - by El Forum - 09-05-2008, 10:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB