Forum Moderators: coopster
My customer runs a <form action="form.cgi" script.
Is it possible to add .cgi to be parsed by php and eg write there:
<?php
require_once('function.php');
if(!validate())
{
require_once('bad_url.html');
exit;
}
I have found a workaround at virtual [php.net] but that doesn't allow me to check validation.
I have no way of testing that myself.
Thanks for any info
Michal
AddType application/x-httpd-php .php .cgi
Should work :)
But I'm starting to have ideas on how to perform that in clear perl...
Thanks anyway
PS. If you know of any way to redirect to formmail.cgi that will work I'm open for suggestions.
<?
if ($_GET) {
$test="http://example.com/cgi-bin/test.cgi?".$_SERVER['QUERY_STRING'];
# DO VALIDATION
if ($valid) {
header("Location: $test");
exit;
}
else {
print "Not valid:<br />";
echo <<<FORM
<form method=get action="$PHP_SELF">
TEST1: <input type="text" name="test1" /><br />
TEST2: <input type="text" name="test2" /><br />
<input type="submit" />
</form>
FORM;
}
}
else {
echo <<<FORM
<form method=get action="$PHP_SELF">
TEST1: <input type="text" name="test1" /><br />
TEST2: <input type="text" name="test2" /><br />
<input type="submit" />
</form>
FORM;
}
?> $test string, because QUERY_STRING only grabs GET items ... but I'm too lazy to do that, this late on a Friday afternoon. ;) [edited by: StupidScript at 12:23 am (utc) on Mar. 3, 2007]