On 18 February 2010 22:42, Daevid Vincent <daevid@xxxxxxxxxx> wrote: > I'll confess that I've done almost zero research on this topic as of right > now aside from pricing readers and blank cards. > > So we're opening a new super-club here in Seattle. One of the ideas we'd > like to pursue is that people are assigned a card. This can be a magstripe > card or something with a barcode. Not really sure at the moment which way > to go. > > The idea being that when they enter, we "swipe/scan" their card and we can > log stats (# of visits, # guests, favorite drink so the bar has it ready, > enter into contest, etc.) I was thinking we setup a simple netbook with a > USB reader at the front door when they pay. Then we have another back at > the bar. Connect via WiFi. Have a notebook somewhere behind the scenes that > runs LAMP (or a VM thereof). No internet needed. The backend database and > even web/GUI stuff is of course trivial with any LAMP stack. > > What I don't know is how do I interface _to_ PHP from say a magstripe > reader. They're dirt cheap ($50), but I assume come with zero software. > http://www.kanecal.net/mag-stripe-reader-scanner.html . And there are > hundreds of these gadgets out there all the same basically. > > I guess what I'm hoping for is some pointers, from someone who's done this > sort of thing. > > My gut thought is something so simple, where there is some XP software (or > Linux I suppose) that reads the card (and generally they only have a number > encoded on them) and this is sent via a URL we define, such as > http://192.168.10.100/door.php?id=123456 or > http://192.168.10.100/bar.php?id=123456 etc. (ignore the security issues > and all that. It's trivial to encode the parameters, plus it's a closed > system with WEP/WPA/WTF). But does anyone know of such a key piece of code? > > Like I said, I'm not locked into magcards. It could be a barcode reader > just as easily. Or fingerprint scanner, or facial recognition. In the end > it's just a unique "thing" that maps to a unique number. I just need the > "FM" (F*ckin' Magic -- it's a programmer term -- look it up!) that goes in > between PHP and the hardware. > > http://daevid.com > > "Some people, when confronted with a problem, think 'I know, I'll use > XML.'" > Now they have two problems. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > I used to develop EPOS (Electronic Point of Sale) s/w. As already mentioned, most scanners (barcode and magswipe) connect via the keyboard. As far as the app is concerned, the data is coming from the keyboard. You can normally program the barcode scanner to provide a prefix and a suffix to the data from the scan. This allows you to provide a "source" to the data. For example, if you have a web page watching for keypresses, then you want to know when the data is coming from the scanner rather than the keyboard. This allows you to do "out of order" processing. So, you scan 10 items, item 3 requires some additional data, but the next 7 items aren't "lost" because you didn't deal with item 3. The webpage can push the barcode data (AJAX maybe) to the server so they are all logged and fed back as part of the "basket" logic. If you have a prefix, you'll also need a suffix to tell the app that the data has finished. A similar situation exists with mag cards. A normal mag card (like your credit cards) can have up to 3 "tracks" of data. Normally track 2 is the interesting one and will normally consist of the following data. Start Sentinel Card Number Mid Sentinel Expiry Date Possibly other data (it was a LONG time ago since I was writing EPOS systems, so ... memory currently giving me a 404.) End Sentinel The sentinels aren't full characters, but are "signals" to the reader. The reader can be programmed to issue a specific character for each sentinel. So again, you can read from the mag card "out of order". E.g. you can scan your club card or your credit card at the beginning of the sale and then add your items. All without touching the keyboard to change the "focus" of the input. This was a major enhancement for usability for our customers when I introduced this. And that was for a DOS app, not GUI or Web! If you have an account on Experts Exchange, take a look at http://www.experts-exchange.com/Internet/Web_Development/Q_24179189.html?sfQueryTermInfo=1+barcod+javascript+rquadling which was a question on using a barcode reader in a web app and I gave JS code allowing for the "out of order" processing I mentioned here. If you are generating your own cards, then the quickest/cheapest way is to get blank cardboard "cards", print a barcode on them and then laminate them. That way you can build your own layout relatively cheaply. You also don't have to use black/white bars. For one our systems (Access control to buildings), we used infra-red detectable ink. When it was printed, we could only just see it in the right light. The scanners use a red laser and picked up the code easily. And the barcode was overprinted on a photo ID card and them laminated. Hope that all makes sense. Regards, Richard. -- ----- Richard Quadling "Standing on the shoulders of some very clever giants!" EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php