Mysql
INSERT INTO `users` (`user_id`, `user_name`, `user_email`, `user_password`, `user_coin`, `user_rank`) VALUES
INSERT INTO `coupons` VALUES('id' , 'code' , 'used ); VALUES
Php Kod
include('../system/system.php');
foreach($_POST as $key => $value) {
$protectie[$key] = filter($value);
}
if(isset($_POST['submit'])) {
$ext1 = mysql_query("SELECT * FROM `coupons` WHERE `code`='{$protectie['code']}' AND `used`='0'");
$ext = mysql_fetch_object($ext1);
if($ext->id != ""){
mysql_query("UPDATE `users` SET `user_coin`=`user_coin`+'{$ext->user_coin}' WHERE `id`='{$data->id}'");
mysql_query("UPDATE `coupons` SET `used`='1' WHERE `code`='{$protectie['code']}'");
}else{
}}?>
If you have received an coupon code, you can validate it here.