Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Feb 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smart Card Reader with PHP

    Hi,

    the project I am working on would like to implement the use of a smart card reader to input data into a form field. (Insert card to reader and pass info contained on card to form field to query application database)Does anyone know how this can be done?

    Thanks Martin

  • #2
    Regular Coder ralph l mayo's Avatar
    Join Date
    Nov 2005
    Posts
    951
    Thanks
    1
    Thanked 31 Times in 29 Posts
    Depends on the interface to the hardware. PHP is almost certainly a bad choice for this unless the device is built for HTTP and you've already got a web server on the network. Java's probably got a majority market share on this kind of thing now, FWIW.

    edit: Err, well, you're free to use PHP for the form but you'r still going to need some logic between to convert the data into something useable, eh? Maybe if javascript has access to the device's output it can use AJAX to post the id to the server and get back some XML from PHP/SQL describing the form contents.
    Last edited by ralph l mayo; 05-02-2006 at 11:44 PM.

  • #3
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,106
    Thanks
    11
    Thanked 101 Times in 99 Posts
    Dunno about smartcard readers but with barcode scanners and fingerprint scanners its easy, just focus on the form field and scan.

    I suspect a reader is similar to this?
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #4
    New Coder
    Join Date
    Oct 2007
    Posts
    33
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by firepages View Post
    Dunno about smartcard readers but with barcode scanners and fingerprint scanners its easy, just focus on the form field and scan.

    I suspect a reader is similar to this?
    How do I add narrow (n) and wide (w) bars to the following code, as explained at the following URL, in order to create code 39 barcodes.

    http://www.codeproject.com/bitmap/ba...select=1905375

    Code:
    <?php
    $rectangle_width = 2;
    $rectangle_height = 20;
    
    $image = imagecreatetruecolor(500, 182);
    $white = imagecolorallocate($image, 255, 255, 255);
    $black = imagecolorallocate($image, 0, 0, 0);
    imagefill($image, 0, 0, $white);
    
    $find = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*');
    $replace = array('00110000', '00110001', '00110010', '00110011', '00110100', '00110101', '00110110', '00110111', '00111000', '00111001', '00101010');
    
    $string = '*1101*';
    $textstring = str_replace($find, $replace, $string);
    
    $j = 0;
    $sarray = str_split($textstring, 1);
    for($i = 0; $i < count($sarray); $i++)
    {
        if($sarray[$i] ==  '0')
        {
            imagefilledrectangle($image, $rectangle_width * $j, 0, ($rectangle_width * $j) + $rectangle_width, $rectangle_height, $white);
            $j++;
            
        }
        elseif($sarray[$i] ==  '1')
        {
            imagefilledrectangle($image, $rectangle_width * $j, 0, ($rectangle_width * $j) + $rectangle_width, $rectangle_height, $black);
            $j++;
        }
    } 
    
    header("Content-type: image/jpeg");
    imagejpeg($image);
    imagedestroy($image);
    ?>

  • #5
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,529
    Thanks
    8
    Thanked 1,091 Times in 1,082 Posts
    Why not use a 39 Code True Type Font?

  • #6
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,128
    Thanks
    2
    Thanked 327 Times in 319 Posts
    Please don't hijack other threads by posting your questions in them, especially since you have an existing thread - http://www.codingforums.com/showthread.php?t=125913. Also, this current thread does not have anything to do with your question of generating bar codes.

    Have you researched how the wide/narrow/quiet zone should be generated? I don't see any logic in your code that puts in a quiet zone between characters.

    Continue your question in your own existing thread please.
    Last edited by CFMaBiSmAd; 10-31-2007 at 07:55 PM. Reason: fixed word
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •