permalinks - Unique one time use URL

I’ve been searching for solution to my problem but posts already made are not fulfilling the answer to me, or I'm j

I’ve been searching for solution to my problem but posts already made are not fulfilling the answer to me, or I'm just not qualified enough to work this out. Here is what I need:

I’ve got a simple landing page with a form. What I need is a way to create unique url’s for people I choose so only they can access this site and fill out the form. URL has to be active only for 7 days and once used, deactivated immediately. The unique URL’s should work a long, which means at the same time I can generate multiple URL’s.

The other way to approach this problem is to generate many passwords that I can send to people I choose. Same story – every password is unique and works only once. Page is password restricted and when user puts the password in it’s no longer active.

The best possible addition to this would be - deactivating / expiring the URL / visitor access the moment they send the form <- but that's not necessary.

I’m really not type of guy who just wants solution given to him on a silver platter, but right now… I have my back against the wall and literally no time. Any help is appreciated. Thank you.

I’ve been searching for solution to my problem but posts already made are not fulfilling the answer to me, or I'm just not qualified enough to work this out. Here is what I need:

I’ve got a simple landing page with a form. What I need is a way to create unique url’s for people I choose so only they can access this site and fill out the form. URL has to be active only for 7 days and once used, deactivated immediately. The unique URL’s should work a long, which means at the same time I can generate multiple URL’s.

The other way to approach this problem is to generate many passwords that I can send to people I choose. Same story – every password is unique and works only once. Page is password restricted and when user puts the password in it’s no longer active.

The best possible addition to this would be - deactivating / expiring the URL / visitor access the moment they send the form <- but that's not necessary.

I’m really not type of guy who just wants solution given to him on a silver platter, but right now… I have my back against the wall and literally no time. Any help is appreciated. Thank you.

Share Improve this question asked Jun 4, 2019 at 21:31 estedogestedog 11 bronze badge
Add a comment  | 

2 Answers 2

Reset to default 2

You could add a setting using add_option( 'access_keys', [ 'key_1', 'key_2 ] ) to check against when loading the page.

add_action( 'init', 'wpse339612_check_access_codes' );
function wpse339612_check_access_codes(){

    if( isset( $_GET['key'] ) ){

        $available_keys = get_option( 'access_keys' );

        $key_index = array_search( filter_var( $_GET['key'], $available_keys );

        if( $key_index !== false ){

             /*User has access! Delete the key from the available keys*/
             unset( $available_keys[$key_index] );
             update_option( 'access_keys', $available_keys );

        }

    }

}

Then whenever a user hits a URL of https://yoursite?key=key_1 they will get to the access condition and the key will be deleted from the database.

Is the page something they pay to gain access to? Why is the accessing it one time so important? Can they access it as many times as they want, but only for a day? (I know this is a comment but I do not have enough reputation to comment so can a moderator please move this over to a comment? thanks.)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745437586a4627679.html

相关推荐

  • permalinks - Unique one time use URL

    I’ve been searching for solution to my problem but posts already made are not fulfilling the answer to me, or I'm j

    9小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信