how to check validation mongodb id with php -
i mongodb id of query string. how check validation id? want if mongodb id not valid redirect url
get query string:
if(count($_get)>0 && $_get['uid']){ //get id string query $query = array("_id" => new mongoid($_get ['uid'])); $user = db::findone('users',$query); }else{ //redirect if not exist query string header('location:'.admin_url.'/items/forbidden.php'); }
plz help... thanks
since ext-mongo version 1.5 can check it
if(isset($_get['uid']) && mongoid::isvalid ($_get['uid'])) { // code here }
php.net mongoid.isvalid
php mongodb validation mongoid mongodb-query
No comments:
Post a Comment