public function index() { $this->model('compareImages'); $mysql_host = 'localhost'; $mysql_username = '******'; $mysql_password = ''; $mysql_database = 'carmy'; mysql_connect("localhost", "root", "") or die('Error connecting to MySQL server: ' . mysql_error()); mysql_select_db($mysql_database) or die('Error selecting MySQL database: ' . mysql_error()); $s = new compareImages(); include_once 'lib/QrReader.php'; $qrcode = new QrReader('images/uploads/webcam.jpg'); $_SESSION['user'] = ''; $text = ''; $text = $qrcode->text(); $image = ''; $query = mysql_query("SELECT NAME FROM item WHERE NSN = '{$text}'"); $num_rows = mysql_num_rows($query); if ($num_rows > 0) { $image = mysql_result(mysql_query("SELECT NAME FROM item WHERE NSN = '{$text}'"), 0, 'NAME') or die("Unable to show field"); $_SESSION['user'] = $image; print json_encode($_SESSION['user']); //header("location:main"); } else { $_SESSION['user'] = '******'; echo $_SESSION['user']; } /*if( $s->compare('images/uploads/webcam.jpg',$image)<15) { echo "Succesful login"; } else echo "Try again"; } */ }
<? include_once('./lib/QrReader.php'); $dir = scandir('qrcodes'); foreach($dir as $file) { if($file=='.'||$file=='..') continue; print $file; print ' --- '; $qrcode = new QrReader('qrcodes/'.$file); print $text = $qrcode->text(); print "<br/>"; }
/** * Private method. * The method reads the QRcode within the image object and sets the resulting value to $this->qrtext. * @return void */ private function read_QRcode() { $blob = $this->img->getImageBlob(); $qrcode = new QrReader($blob, QrReader::SOURCE_TYPE_BLOB); $this->qrtext = $qrcode->text(); }