Jump to content

[solved] Token problems


ruilong

Recommended Posts

Anyone have any idea about the token?

I am currently trying to implement some security on a ajax call, so I pass the admin token in the ajax call, with the classname, class id and employee id, then use these values togheter with _COOKIE_KEY_ to create a token value too compare with the send value.

like this

var token=\''.$adminObj->token.'\';
var classname=\''.get_class($this).'\';
var classid=\''.intval($this->id).'\';
var employeeid=\''.intval($cookie->id_employee).'\';



and these vars are posted with ajax (jquery) GET to the reciever page.
inside the ajax recieve page I setup like this

$realtoken = Tools::getAdminToken(Tools::getValue('className').intval(Tools::getValue('classId')).intval(Tools::getValue('employeeId')));



If I echo all the values that is used for creating the token, I get the same in both pages, but after the token is different in both pages..

so.. any ideas on why the tokens get different? or any ideas on how to do it in another way?


I found the problem, inside the admin pages, it's the tab name and id that is used and not the class name and id..

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...