Jump to content

Secure Ajax Call


CXM_Julien

Recommended Posts

Hello,

 

in my admin module i am calling a PHP file with some ajax to change some prices in the database but anyone can run this script from outside so my question is, how can i secure the ajax call? i found some thing related to tokens and secure_key but i did not get it at all...

Link to comment
Share on other sites

Found a way of checking if the current user has the administrator privileges by doing this

	include_once('../../config/config.inc.php');
	include_once('../../config/settings.inc.php');
	include_once('../../classes/Cookie.php');

	$cookie = new Cookie('psAdmin');
	
	if ($cookie->profile != 1) {
		die();
	}

Is that really secure?

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...