You have 2 make a new template. Put in the new template the same code as you have on the template: error_nopermission_loggedout
Now go 2 your new template and look for this line:
<input type="hidden" name="url" value="$scriptpath">
And change that to:
<input type="hidden" name="url" value="1.php">
Now link in your script to your new template name with the modification instead of referring to error_nopermission_loggedout.
Its not tested but it should work