Page 1 of 1

E-Mail Filtering

Posted: Fri May 28, 2004 2:38 am
by crookedgoomba
I set up my email filter so that $header_to: begins "inq" filters to |/home/bandso2/email.php. I CHMOD the file to 755 and added the header #!/usr/bin/php. I then set up the script to insert a row into a MySQL table. I tested the script in my web browser and there are no flaws in the PHP, however when I test the email in the cPanel, the script does not run. Below is a copy of the code:

Code: Select all

#!/usr/local/bin/php 
<? 
$hd = mysql_connect(localhost, "******", "******") 
        or die ("Unable to connect"); 

mysql_select_db ("******", $hd) 
        or die ("Unable to select database"); 

mysql_query("INSERT INTO lists VALUES('test','worked')",$hd); 
?>
i asked lunarpages (my host) about this and their response was:

The filter itself is working. It is catching "inquiry" for me. This appears to be a script error. Please use our forums at http://lunarforums for help with scripting. We do not provide support for 3rd party scripts.

any thoughts??

Posted: Fri May 28, 2004 5:58 am
by Grim...
Changing your MySQL INSERT query to include the following should help you track your problem down:

Code: Select all

mysql_query("INSERT INTO lists VALUES('test','worked')",$hd) or die ( "My SQL Error: <b>".mysql_error() );
I always use that bit of script when using queries, it's nicely formatted and allows you to track down the problem quickly.

You may want to remove them from live sites to avoid security problems.