Dining App Badge Scan Page

Customers scan(my customer uses a RFID scanner) or enter their badge in and this PHP page creates a SQL record with the following information:
badgeid,mealtype,price,scantime

The mealtype and price is automatically entered via PHP script into the SQL record based on time of day - breakfast or lunch.

If customer scans their badge number during breakfast or lunch time, they will receive a 'Thank You, enjoy your meal..' message. If badge number was not found in database, they will receive same message as well, but record will not be added in database, but logged in a .csv file for later review if desired. 
Also, email will be sent to specified user informing them that an invalid badge number was just scanned. This email contains the badge number and time/date of the scan!