jQuery "Like" with id in HTML as identifier -
i working on project, it's possible users each others stuff. right jquery gets id html, identify thing like. people able open inspector in browser, , edit id, , way whole other thing.
i searching alternative ways this.
i've thought of making unique string, that's kinda same, since still able copy/paste string element.
thanks in advance.
try below code:
<?php if (!isset($_session)) session_start(); //consider ids of post fetched database. $pageids = array(1,2,3,4,5,6,7,8,9,10); foreach($pageids $index => $key) { $uniqueid = uniqid(); echo '<a href="#" class="like" rel="'.$index.'#'.$uniqueid.'"></a>'; $_session[$uniqueid] = $index; } //now when clicks on button, pass rel attribute in post variable pp if($_post['id']) { $array = explode('#',$_post['id']); $actualid = $_session[$array[1]]; if($actualid === $array['0']) { //everything fine return true; }else{ //some 1 edited html code } //you can destroy session variable here. } ?>
Comments
Post a Comment