SHARE
TWEET

PHP Barcde Webapp example using Scan2Shop for iOS or Android

w0lfiesmith Jan 24th, 2013 755 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top