#!/usr/local/bin/php
<?php
$stdin = fopen('php://stdin', 'r');
   echo "dvzljk PHP alap alrskszt alkalmazsunkban!\n";
   echo "Adja meg teljes nevt: ";
$nev = trim(fgets($stdin,100));
   echo "Adja meg teleplsen belli postacmt (utca, hzszm): ";
$cim = trim(fgets($stdin,100));
   echo "Adja meg a teleplst, ahol l: ";
$telepules = trim(fgets($stdin,100));
   echo "Adja meg az llamot (megyt), ahol a telepls 
      tallhat: ";
$allam_megye = trim(fgets($stdin,100));
   echo "Adja meg postai irnytszmt: ";
$irszam = trim(fgets($stdin,100));
   echo "Adja meg telefonszmt: ";
$telefon = trim(fgets($stdin,100));
   echo "Adja meg e-mail cmt: ";
$email = trim(fgets($stdin,100));
   echo "Adja meg a ltrehozand alrsfjl nevt: ";
$alairas = trim(fgets($stdin,100));
fclose($stdin);
$adatok = "$nev\n$cim\n$telepules, $allam_megye $irszam\n$telefon
   \n$email";
shell_exec("touch $alairas");
if (!$alairasfajl = fopen($alairas, 'w')) {
   print "Az llomny nem nyithat meg rsra!\n";
} else {
   if (!fwrite($alairasfajl,$adatok)) {
      print "\n\nHiba az adatok rsa kzben!\n";
   } else {
        print "\n\nAlrs-llomnya elkszlt.\n";
   }
   fclose($alairasfajl);
}
?>