if (file_exists("/home/xxx/xxx/folder/".$userdata['user_id'].".txt")) {
$fp = fopen("/home/xxx/xxx/folder/".$userdata['user_id'].".txt", "r+");
$sk = fread($fp);
$irasyt = $sk+1;
fwrite ($fp, $irasyt);
fclose($fp);
} else {
$fp = fopen("/home/xxx/xxx/folder/".$userdata['user_id'].".txt", "w");
$irasyt = 1;
fwrite ($fp, $irasyt);
fclose($fp);
}