In the past, news alerts worked. We changed hosts and they magically stopped. I used to set individual alerts to every player, at one point where i was with the code it would send me 154 alerts, which i assume is the amount of alerts it should send on a news update, but to all unique players, now it only sends one alert, and to me. I removed $time (its not even in the columns and so i don't know why it was there) and put a comma by $date. this didn't change anything.
It sends multiple alerts when i admin send items to all active players. this makes an individual alert per player. admin sending items functions correctly.
if($_GET['action']=='items'){
$id=$_POST['id'];
$who=$_POST['who'];
$item=$_POST['item'];
$gifts = $_POST[gifts];
$active=$_POST['active'];
$q=mysql_query("select * from items where itemid='$item'")or die(mysql_error());
$r=mysql_fetch_array($q);
extract($r);
$name=addslashes($name);
$sellprice=$gypsy_price * 2;
if($who=="one"){
if ($item == 143 or $item == 145) {
$uses = $gifts;
}
if (is_numeric($uses) and !empty($uses)) {
mysql_query("insert into inventory(name,ownerid,storeitem,uses,store,gypsy_price,gypsy_sell) values ('$name', '$id', '$item', '$uses', '$store','$gypsy_price','$sellprice')")or die(mysql_error());
mysql_query("update users set alert='1' where id='$id'")or die(mysql_error());
$note="You have just received an item!<br>($name)";
mysql_query("INSERT INTO alerts(player_from, player_to, note, date, type, extra) VALUES('0','$id','$note','$time', '7', '')") or die(mysql_error());
$error="Player $id has been given item #$item.<br>($name)";
} else {
$error = "Please choose the number of gifts you would like this giftbox to contain.";
}
}
elseif($who=="active"){
if ($item == 143 or $item == 145) {
$uses = $gifts;
}
if (is_numeric($uses) and !empty($uses)) {
$q=mysql_query("select id from users where lastlogin > '$active'")or die(mysql_error());
$num=mysql_num_rows($q);
while($row=mysql_fetch_array($q)){
extract($row);
mysql_query("insert into inventory(name,ownerid,storeitem,uses,store,gypsy_price,gypsy_sell) values ('$name', '$id', '$item', '$uses', '$store','$gypsy_price','$sellprice')")or die(mysql_error());mysql_query("update users set alert='1' where id='$id'")or die(mysql_error());
$note="You have just received an item!<br>($name)";
mysql_query("INSERT INTO alerts(player_from, player_to, note, date, type, extra) VALUES('0','$id','$note','$time', '7', '')") or die(mysql_error());
}
$error="All active players ($num) have been given item #$item.<br>($name)";
} else {
$error = "Please choose the number of gifts you would like this giftbox to contain.";
}
}
}
also, putting the var_dump( $id ); in news.php causes an error. Not sure how to use this function.