Email form query with PHP

Discussion in 'PHP' started by ian_ok, Jan 27, 2006.

  1. #1
    I use php to mail me from any forms submitted on my website, but due to some code injection attacks I've locked them all down by stopping the code and returning an error when certain characters/symbols etc are used.

    So my question is, is it possible to write this information to a text file or other should it not send an email?

    Thanks Ian
     
    ian_ok, Jan 27, 2006 IP
  2. GeorgeB.

    GeorgeB. Notable Member

    Messages:
    5,695
    Likes Received:
    288
    Best Answers:
    0
    Trophy Points:
    280
    #2
    Store it in a database and check messages at your leisure.

    Use PHP to reply to the messages via email.

    That's about as secure as it gets... wait a sec... I feel a script coming on :D

    *gets to work*
     
    GeorgeB., Jan 27, 2006 IP
  3. ian_ok

    ian_ok Peon

    Messages:
    551
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi George,

    Thanks for that....

    I'm happy with the way it works, just I'd like to view the information that they were trying to send when it reports an error message, mainly to check that they where not valued customers but only robots/spam.

    Ian
     
    ian_ok, Jan 27, 2006 IP
  4. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Try tutorials like this one. Instead of echoing the error, just write the message as normal and pretend it was sent to fool them.
     
    T0PS3O, Jan 27, 2006 IP
  5. Perrow

    Perrow Well-Known Member

    Messages:
    1,306
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    140
    #5
    Perrow, Jan 27, 2006 IP
  6. ian_ok

    ian_ok Peon

    Messages:
    551
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks for that TOPS, God they love G ads on that site!

    According to the code does that mean I could do this...

    Change this:
    fwrite($fp, $your_data);
    Code (markup):
    TO
    fwrite($fp, $tel);
    Code (markup):
    With $tel being a post command $tel = $_POST['tel'];
     
    ian_ok, Jan 27, 2006 IP
  7. ian_ok

    ian_ok Peon

    Messages:
    551
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #7
    ian_ok, Jan 27, 2006 IP
  8. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Yeah, that should do the trick if $tel holds your data. You might want to add \n\n and and a whole line of ################## and \n\n again to separate entries.
     
    T0PS3O, Jan 27, 2006 IP