<?php
session_start();
include 'myfunctions.php'; 

$Username="";
$Password='';
$afm='';
$myafm='';

$afm=(isset($_REQUEST['afm'])?$_REQUEST['afm']:'');

if($conn == false){
	 echo 'Δεν υπαρχει συνδεση...<br>';
	  dbConnect();
}
 
 $query = "SELECT * FROM mitroo_parametroi WHERE IDc=1"   ;
$result = mysqli_query($conn, $query);
    $rs = mysqli_fetch_assoc($result);

$Username = $rs['Username'];
$Password = $rs['Password'] ;
$myafm = $rs['AFM']; 


if($myafm == ''){
    return 'Must set MYAFM';
    exit;
}

if($afm == ''){
    return 'Must request afm';
    exit;
}

$newURL = "https://www.visualsoft.gr/afmgreek/php/gr-vat-details.php?u=$Username&p=$Password&myafm=$myafm&afm=$afm";

header('Location: '.$newURL); 
 exit();
 
?>
