• September 9, 2018

    +https://stackoverflow.com/questions/39763567/make-link-expire-after-x-minutes

    Send a timestamp in link and on other end while accepting the link I have to check the time with current time stamp.

    $base_url='http://172.16.0.60/WebServices/';
    $activation=md5($email.time());
    $time = time();
    email format to HTML
            $mail->Subject = 'Activate Your Account';
            $mail->Body    = 'Hi, <br/> <br/> We need to make sure you are human. Please verify your email and get started using your Website account. <br/> <br/> <a href="'.$base_url.'activation/'.$activation.'">'.$base_url.'activation/'.$activation.$time.'</a>';

    While when user clicks on link, following code will check the expiration of link.

    $u_time = $this->input->get('time'); // fetching time variable from URL
    $cur_time = time(); //fetching current time to check with GET variable's time
    if ($cur_time - $u_time < 10800) 
    {
     // link is not expired
    }
    else
    {
     // link has been expired
    }


เวอไนน์ไอคอร์ส

ประหยัดเวลากว่า 100 เท่า!






เวอไนน์เว็บไซต์⚡️
สร้างเว็บไซต์ ดูแลเว็บไซต์

Categories


Uncategorized