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

    function base64url_decode($data) { 
      return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT)); 
    }  

    if( isset($_GET['code']) ){
 
        $code = $_GET['code'] ?? ''; 
        $code = base64_decode($code); 
        $code = explode(",", $code);     
        $email = $code[0];

        $sql = mysqli_query($con," SELECT firstname FROM users WHERE email = '$email' ");

        if( mysqli_num_rows($sql) != 0 ){

            $_SESSION['resetpassword'] = $email ;
            header("Location:../../home/reset.php") ;

        }
        else{
            echo "user dosent exist";
        }

    }
?>        