Ive never worked with functions, so bear with me if thats the problem. Im not getting any errors but my echo isnt returning anything and the file isnt getting added to.PHP Code:<?php
function open_file($filetype,$increment,$filename)
{
$handle = fopen($filename, 'r');
$contents = @fread($handle,filesize($filename));
fclose($handle);
If($increment == '-'){
$contents--;
}else{
$contents++;
}
$handle = fopen($filename, $filetype);
$contents = @fread($handle,filesize($filename));
fwrite($handle,$contents);
fclose($handle);
return $contents;
}
Switch($_GET['user']){
Case "+":
echo open_file('w','+','users.txt');
Case "-":
echo open_file('w','-','users.txt');
}
?>
Im making a script to add one if in the url add=+ or minus one from the file if its add=-
Thanks![]()





Reply With Quote