How to create a script file I want to create a script file that I can call using a form on submit. For example I can use:

action="action.php?uid=1&amp;method=deleteuser"


This would trigger the script to result in the function deleteuser in file action.php deleting uid 1. However, when I tried to create this file and put it in the home scripts folder it couldn't call basic drupal commands such as db_query. Where and how can I generate such a script file so that I can access drupals core functions?
You can make your script file with following statements:

&lt;?php
define('DRUPAL_ROOT', $_SERVER['DOCUMENT_ROOT']); // Define the DRUPAL_ROOT constant which is used in many places.
$base_url = 'http://'.$_SERVER['HTTP_HOST']; // Again, this is used in many places.
require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; // Include the boostrap file.
drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION); // Start things up to whatever level you need.
//drupal_set_message('custom script');
print db_query("SELECT title FROM {node} WHERE nid = :nid", array(':nid' =&gt; 1))-&gt;fetchColumn();
?&gt;


But it is not a good practice to handle form submit or whatever.