üyelikli bir sitemizde üye olup hesabını aktif eden kullanıcıya xxxx kadar kredi eklemek isityoruz. Bunu php ile nasıl yaptırabiliriz.
hesap aktif etme ile ilgili dosya içeriğimiz aşağıdadır.
include 'config.php';
foreach($_GET as $key => $value) {
$protectie[$key] = filter($value);
}
if($protectie['cod'] != "" && $protectie['cod'] != 0){
$user1 = mysql_query("SELECT * FROM `users` WHERE `activate`='{$protectie['cod']}'");
$user = mysql_fetch_object($user1);
$numar = mysql_num_rows($user1);
if($numar > 0){
$aff1 = mysql_query("SELECT * FROM `users` WHERE `activate`='{$protectie['cod']}'");
$aff = mysql_fetch_object($aff1);
if($aff->ref > 0){
mysql_query("UPDATE `users` SET `coins`=`coins`+'50' WHERE `id`='{$aff->ref}'");
}
mysql_query("UPDATE `users` SET `activate`='0' WHERE `activate`='{$protectie['cod']}'");
$mesaj = "E-posta adresi basariyla dogrulandi! ";
}else{
$mesaj = "Incorrect Link! ";}
}else{
$mesaj = "Incorrect Link! ";}
echo $mesaj;
print "";
?>