";
} else {
// We are in pix/show... get the sequence number:
if (strlen($aj_id)==1) {
$aj_seq = $aj_id;
$cur_url = substr("$cur_url", 0, -2);
} elseif (strlen($aj_id)==2) {
$aj_seq = $aj_id;
$cur_url = substr("$cur_url", 0, -3);
} else {
// sequence is too long?
}
$aj_id = path_get_last_arg($cur_url);
//echo "";
}
$results = $wpdb->get_results("SELECT * FROM wp_6_postmeta m, wp_6_posts p WHERE p.ID = m.post_id AND m.meta_key='aj_id' AND m.meta_value='" . $aj_id . "'");
if (count($results)==0) {
//echo "No Entry found for ID " . $aj_id;
header("Location: /404/" . $aj_id );
} else {
foreach ($results as $result) {
if ($pos_pix_show === false) {
$perm = get_permalink($result->post_id);
} else {
$perm = "/fotos/".$result->post_name."/".$result->post_id."/".$aj_seq;
}
// Redirect browser
header("Location: " . $perm );
}
}
?>