PHP Remove Get requests from url -


i working on voting system works requests know post id must updated. when vote done there still request in url (/?vote_up=123), if user refreshes page vote set again. , should not happen.

i have after vote done, doesn't work.

$_server['request_uri'] = strtok( $_server['request_uri'], '?' ); 

can me this?

in first place, vote casting action shouldn't rely on request, definition should retrieve information instead of setting information.

that said, should use put request (or post request make things simpler), , vote casting shouldn't access directly backend url, because if it's post request retrigger if user reloads.

i'd suggest use ajax voting system in frontend, posts or puts data php backend asynch request doesn't affect current user's location url.

in meantime, 1 emergency solution cast vote post request, land on url redirects user wherever came (assuming can vote multiple pages). in end of process, user's location not 1 listens post, 1 redirected to, , therefore it's harmless him refresh or reload.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -