ACS/AOLServer programming notes

Main Site : CNK's space : ACS Notes

Debugging help

I found this cool perl script for checking CGI variables on the web. I wanted an AOLServer/ACS specific version so I wrote form-validation.tcl. To use it, just make the "action" attribute of your form point here

Encrypting Passwords

Sometimes you set up a server with unencrypted user passwords and then decide you should have chosen to encrypt them after all. If you just flip the "encrypt passwords" parameter in your ACS parameters files, your existing users will not be able to log in. You need to first encrypt the passwords that are already in your ACS users table. Copy this script to your server and visit it with your web browser. Make sure to immediately remove it so that you don't do a second round of encrypting and lose everyone's passwords.

Is this a page request or robot?

One can use the AOLServer call "ns_conn isconnected" to let you use the same page from either the website or a scheduled proc. At the top of the tcl page or proc, use:
if {[ns_conn isconnected]} { # code that only works from a request like # set order_id [ns_queryget order_id] # or accessing any of the ad_conn(***) array values } else { # Supply them from within the script }