SanderK
05-09-2006, 09:55 AM
Hi,
When requiring files, the required files usually have a if(!defined('FOO')) or some other code at the top to check if the file can be accessed. This is so that people can't directly access the files and break something.
Anyway, lately I've been trying out the new web-hype, Ajax. I've managed to create a script that updates a news item without having to reload the page. The thing is, I'm accessing this 'edit.php' file to make the database changes, but the 'define' method as mentioned won't work. When I define a variable in the first file and then use the XMLHTTPRequest to access another file, the accessed file won't find the variable defined. Using POST or GET to check for validity also isn't an option since everyone can see the Javascript files.
So, how are you supposed to know your files are being accessed with XMLHTTPRequest, and thus giving it access?
Thanks.
When requiring files, the required files usually have a if(!defined('FOO')) or some other code at the top to check if the file can be accessed. This is so that people can't directly access the files and break something.
Anyway, lately I've been trying out the new web-hype, Ajax. I've managed to create a script that updates a news item without having to reload the page. The thing is, I'm accessing this 'edit.php' file to make the database changes, but the 'define' method as mentioned won't work. When I define a variable in the first file and then use the XMLHTTPRequest to access another file, the accessed file won't find the variable defined. Using POST or GET to check for validity also isn't an option since everyone can see the Javascript files.
So, how are you supposed to know your files are being accessed with XMLHTTPRequest, and thus giving it access?
Thanks.