You are here

function shurly_get_redirect in ShURLy 6

Same name and namespace in other branches
  1. 8 shurly.module \shurly_get_redirect()
  2. 7 shurly.module \shurly_get_redirect()

Given the short URL, return the long one NOTE: Always check $redirect->active before using the result

2 calls to shurly_get_redirect()
shurly_expand in ./shurly.module
Function to get the long url.
shurly_url_exists in ./shurly.module
Check to see if this short URL already exists

File

./shurly.module, line 822
description http://www.youtube.com/watch?v=Qo7qoonzTCE

Code

function shurly_get_redirect($short_url, $check_active = FALSE) {
  $query = "SELECT * FROM {shurly} WHERE source = '%s'";
  if ($check_active) {
    $query .= ' AND active = 1';
  }
  $redirect = db_fetch_object(db_query($query, $short_url));
  return $redirect;
}