mail () sending multiple times b/c mod_rewrite

Oh, the strange things mod_rewrite does!

mail () sending multiple times b/c mod_rewrite

Postby luiddog » Tue Oct 03, 2006 10:43 am

I have the following htaccess:

RewriteRule ^test2$ home.php?ID=1 [NC] [L]
RewriteRule ^test2/News$ news.php?ID=1 [NC] [L]
RewriteRule ^test2/Contact$ contact.php?ID=1 [NC] [L]
RewriteRule ^test2/ContactSent$ send.php?ID=1 [NC] [L]

RewriteRule ^test3$ home.php?ID=4 [NC] [L]
RewriteRule ^test3/News$ news.php?ID=4 [NC] [L]
RewriteRule ^test3/Contact$ contact.php?ID=4 [NC] [L]
RewriteRule ^test3/ContactSent$ send.php?ID=4 [NC] [L]

RewriteRule ^test4$ home.php?ID=5 [NC] [L]
RewriteRule ^test4/News$ news.php?ID=5 [NC] [L]
RewriteRule ^test4/Contact$ contact.php?ID=5 [NC] [L]
RewriteRule ^test4/ContactSent$ send.php?ID=5 [NC] [L]

Now when I send an email using the php mail() on the /ContactSent page it sends 3 emails. Only one is composed correctly. How can I stop that?
luiddog
 
Posts: 11
Joined: Fri Sep 29, 2006 12:04 pm

Postby luiddog » Tue Oct 03, 2006 2:12 pm

It gets stranger. When I use the test2/ContactSent it sends 1 email, test3/ContactSent sends 2 emails, test4/ContactSent sends 3 emails.
luiddog
 
Posts: 11
Joined: Fri Sep 29, 2006 12:04 pm

Postby luiddog » Tue Oct 03, 2006 2:31 pm

Had to add

if ($replyemail > '') {
mail(....

For it to work properly
luiddog
 
Posts: 11
Joined: Fri Sep 29, 2006 12:04 pm

Postby richardk » Tue Oct 03, 2006 2:35 pm

You should probably have this:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^test2$             home.php?ID=1    [NC,L]
RewriteRule ^test2/News$        news.php?ID=1    [NC,L]
RewriteRule ^test2/Contact$     contact.php?ID=1 [NC,L]
RewriteRule ^test2/ContactSent$ send.php?ID=1    [NC,L]

RewriteRule ^test3$             home.php?ID=4    [NC,L]
RewriteRule ^test3/News$        news.php?ID=4    [NC,L]
RewriteRule ^test3/Contact$     contact.php?ID=4 [NC,L]
RewriteRule ^test3/ContactSent$ send.php?ID=4    [NC,L]

RewriteRule ^test4$             home.php?ID=5    [NC,L]
RewriteRule ^test4/News$        news.php?ID=5    [NC,L]
RewriteRule ^test4/Contact$     contact.php?ID=5 [NC,L]
RewriteRule ^test4/ContactSent$ send.php?ID=5    [NC,L]


Does you're PHP script include any redirects? Maybe if it finds an error or that the path is wrong it tries to correct it? Else could you post or PM me your email script?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Idiosyncrasies

Who is online

Users browsing this forum: No registered users and 4 guests

cron