Ticket #3398: article.php

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

geeklog permalink redirects

Line 
1 <?php
2 require( dirname(__FILE__) . '/wp-config.php' );
3
4 $story = $_REQUEST['story'];
5
6 nocache_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
11 if ($ID) {
12   header('Location: ' . get_permalink($ID));
13 }
14 else {
15   header('Location: ' . get_settings('siteurl'));
16 }
17
18 ?>
19