E-Mail Filtering

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
crookedgoomba
Forum Newbie
Posts: 4
Joined: Fri May 28, 2004 2:38 am

E-Mail Filtering

Post 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??
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post 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.
Post Reply