Advertisement
w0lfiesmith

PHP Barcde Webapp example using Scan2Shop for iOS or Android

Jan 24th, 2013
1,141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. <?php
  2. require_once('wp-blog-header.php'); // ensures we can use Wordpress functions and db access
  3. if(isset($_REQUEST['code'])):
  4.     query_posts( array(
  5.       'post_type' => 'post',
  6.       'meta_key' => 'barcode',
  7.       'meta_value' => $_REQUEST['code'],
  8.       'meta_compare' => '='
  9.     ) );
  10.     if (have_posts()) :
  11.         while (have_posts()) : the_post();
  12.             $url = get_permalink() ;
  13.             wp_redirect($url);
  14.         endwhile;
  15.     else :
  16.         echo '<p style="font-size:64px;">No entry for game '.$_REQUEST["code"].' exists yet</p>';
  17.     endif;
  18. else:
  19.     echo "<a href='p2spro://configure?lookup=http%3A//ipadboardgames.org/barcode.php?code=CODE'>Click here to configure your copy of scan2shop automatically</a>";
  20. endif;
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement