WordPress.org

Make WordPress Core

Ticket #3398: article.php

File article.php, 403 bytes (added by justdave, 8 years ago)

geeklog permalink redirects

Line 
1<?php
2require( dirname(__FILE__) . '/wp-config.php' );
3
4$story = $_REQUEST['story'];
5
6nocache_headers();
7
8// insert article lookup here
9$ID = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_gl_sid' AND meta_value = '" . $wpdb->escape($story) . "' LIMIT 1");
10
11if ($ID) {
12  header('Location: ' . get_permalink($ID));
13}
14else {
15  header('Location: ' . get_settings('siteurl'));
16}
17
18?>