<?php
	session_start();
	include"../../connect/db.php";

	if( isset($_POST['refid']) ){

		$refid = mysqli_real_escape_string($con,$_POST['refid']);
		$user = isset($_POST['user']) ? mysqli_real_escape_string($con,$_POST['user']) : '';
		$amount = isset($_POST['amount']) ? mysqli_real_escape_string($con,$_POST['amount']) : '';
		$status = isset($_POST['status']) ? mysqli_real_escape_string($con,$_POST['status']) : 'active';
		$date = date('Y-m-d H:i:s');

		$sql = mysqli_query($con,"INSERT INTO refers (refid, user, amount, status, date) VALUES ('$refid', '$user', '$amount', '$status', '$date')");

		if( $sql ){
			echo "success";
		}
		else{
			echo "error";
		}

	}
	else{
		echo "error";
	}
?>