AJAX and Dragonfly - Where and how?
-> Add-Ons & Blocks

#1: AJAX and Dragonfly - Where and how? Author: greenday2kLocation: CO PostPosted: Tue Aug 25, 2009 3:46 am
    ----
That is, i'm thinking about adding AJAX to my website (Only for Reg Users), until now I've chosen to use AJAX on:

- Private Messages: Deleting PM's.
- On Comments Deletion (for the comment Class written by www.cmsdreams.co.uk ).
- Adding / deleting a friend on the "Buddys" Module.
- Poll Block: View Results on Demand or After Voting.
- Auto suggest Country / City for the location field on Your_Account Module.

AND

- Send a New PM, auto suggesting usernames (already done).
For this, I've just a written a PHP File that creates a plain text file on includes/somecrazyname.js with the usernames sorted by Alphabetical order. A Javascript command does the auto/suggestion/completion.

My question is there a risk of having a complete list of users on a plain text file?

the file is a JavaScript and looks like:

Code::
var usernames = ["_Whatsername" ,"_LUXI_" ,"_KERPLUNK_" ,"_Estragon_" ,"_ArgentinianIdiot_"];




I'm not planning to turn my website into a Bloated Ajaxed site.
But certainty simplifying some actions performed by the users (to improve the user experience!!! Laughing ).

My second Question is: What are the "right" places to implement Ajax on a Dragonfly Powered Website? Where is useful?




The simplest setup to use AJAX using the core functions of DragonFlys should be (something to):
PHP:
<?php

<?require_one('includes/cmsinit.inc');
ajax_detection_and perfom_basic_task ();
echo
$ajax_response;
die();
?>

is it right?

Thanks.

#2: Re: AJAX and Dragonfly - Where and how? Author: Emsland-Party.deLocation: Lummer Land (Germany) PostPosted: Tue Aug 25, 2009 9:18 am
    ----
Hy!!

Yes, its useful!!

I have Ajax in Dragonfly/Coppermine.

#3: Re: AJAX and Dragonfly - Where and how? Author: NanoCaiordoLocation: Melbourne, AU PostPosted: Tue Aug 25, 2009 10:58 am
    ----
1. Not really a big issue but I wouldn't like to give all usernames away so easily ... why am I saying "easily"?

AJAX requests can be seen, debugged and reproduced within the same session and reaching the file would be a joke.

Long story short ...
  • your AJAX should call a php script
  • your AJAX should send a header request
  • .htaccess protect the php file but allow the request if the AJAX header is set
  • change txt to inc, using php tags deny direct access to the file if not called by DF
  • your php script will need to validate the header sent and is_user()
  • your php script may finally load the inc file

At this point its not going to be easy anymore, just a little harder.

2. Its fine but again read above.

NOTE: all this if we don't want to touch core files, otherwise we could skip a couple of steps



-> Add-Ons & Blocks

All times are GMT

Page 1 of 1