<?php session_start();
   //include("../config/db_config.php");
   $purchase_code = ($_GET['id']);
   $current_uri='https://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
   $replace_link =  str_replace("admin/backend/deactive_user_account.php","",$current_uri);
  // echo $replace_link;
  // die;
   ini_set('display_errors', 1);
   ini_set('display_startup_errors', 1);
   error_reporting(E_ALL);
   
   //include("../validateuserlogin.php");
   
   
    // echo $purchase_code;
    // die;
    $curl = curl_init();
   curl_setopt_array($curl, array(
       CURLOPT_URL => 'http://91.203.133.129/mailforgetapi/mail_api_decative_useraccount.php',
       CURLOPT_RETURNTRANSFER => true,
       CURLOPT_ENCODING => '',
       CURLOPT_MAXREDIRS => 10,
       CURLOPT_TIMEOUT => 0,
       CURLOPT_FOLLOWLOCATION => true,
       CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
       CURLOPT_CUSTOMREQUEST => 'POST',
       CURLOPT_POSTFIELDS =>'{ "purchase_code":"'.$purchase_code .'" 
     
     }',
       CURLOPT_HTTPHEADER => array(
         'X-API-KEY-AUTH: adsaf3@ds!8y6xxrwa4',
         'Content-Type: application/json',
         'Cookie: PHPSESSID=qsco0d01sm0133aep3tm643s63'
       ),
     ));
     
     $response = curl_exec($curl);
     
     curl_close($curl);
     if(http_response_code()==200){
      // echo "abc";
       
  
           $myfile = fopen("./../../config/coredb.php","w") or die("Unable to open file!");
               
       $txt = "<?php \$domain=\$_SERVER['HTTP_HOST'];
      if(\$domain=='localhost'){ 	
      define('DB_HOST', '');
      define('DB_USER', '');
      define('DB_PASS', '');
      define('DB_NAME', '');
      }else{	
      define('DB_HOST', '');
      define('DB_USER', '');
      define('DB_PASS', '');
      define('DB_NAME', '');
      }   
      ?>";
// echo $txt ;
fwrite($myfile, $txt);
fclose($myfile);
echo "<script>window.location='$replace_link';</script>";

}
$_SESSION['forgot_pass']='success';
//echo $cinit_verify_data;
?>