why isn't this script working? (this script has other files submiting data to it in the form of Vars)
<?php
$userlist = file(\"users.inc.php\");
$done = false;
$auth = false;
$found = false;
$i = 0;
while ((!$found) && ($i<count($userlist))) {
$i++;
list($n,$p,$a,$e,$g,$s,$m,$a1,$a2,$a3) = explode(\':\',$userlist[$i]);
$found = ($n==$user);
if (!$price) { die(\"<br><b>Error</b><br>\"); }
elseif (!$item) {die(\"ERROR\");}
elseif ($item == \'1\' && $m >= $price) {
$m -= $price;
$a3 += \'1\';
$m = ($m < $price) ? $m : $m;
$userlist[$i] = implode(\':\',array($n,$p,$a,$e,$g,$s,$m,$a1,$a2,$a3));
$fd = fopen(\"users.inc.php\",\"w\");
fputs($fd,\"<?php die(\\"Access restricted\\"); ?>\n\");
for ($i=1; $i<count($userlist); $i++) {
fputs($fd,chop($userlist[$i]).\"\n\");
}
fclose($fd);
echo \"<script>window.close();</script>\";
}
}
?>
When i test this script it closes, but doesn\'t take the money away, or add the item 🙁