Hi,

I have been asked to add a Keyword Jump to one of our sites where a users enters a keyword in a textfield and is redirected to the term page (ex. www.domainname.com/terms/$enteredkeyword).

I could do a simple php form in a block but was thinking that there is probably a more durpalish way and I'd like to have some of the built in protection against script attacks.

Ideally, I'd like to be able to store access information in a database table but this isn't a requirement.

Could anyone point me in the right direction, module, snippet or otherwise? I have done a search but haven't found quite what I am looking for.

Thanks,
Rob

Comments

WorldFallz’s picture

I would think you could Just do a http://api.drupal.org/api/function/check_url or http://api.drupal.org/api/function/check_plain on the value of the field before turning it into a url and redirecting.

robertem’s picture

Thanks WorldFallz,

Would you recommend running both then? check_plain on the submitted data then check_url after the address is created or would that be redundant?

Rob

WorldFallz’s picture

Since you're just appending a taxonomy term to a known good url, I'd probably just use check_plain on the term. You might also need to use http://api.drupal.org/api/function/drupal_urlencode to account for special chars.