Printer Friendly Version Print this thread
Email this thread to a friend eMail this thread to a friend
  • Parsing of any sites in convenient form (grab, inf (In: Professionals Corner)
  • what is best php or html? (In: General Search Engine Optimization)
  • Featured Web Site Template

    Hundreds More at Free Site Templates.com!

    Web Site Partners
    Sponsored Links
    Jet City Software
     
    Whos Here ?
    There are 0 guests and 1 members in the forums right now.
    Reflects user activity within the last 5 minutes
    Moderator(s): Prowler, jcokos
    Member Message

    redgtsviper
    Joined: Feb 27, 2006
    # Posts: 3

    View the profile for redgtsviper Send redgtsviper a private message

    Posted: 2006-Feb-28 03:41
    Edit Message Delete Message Reply to this message

    To start with I am new to PHP. Very green. I have a form on my site using the code below. From what I have been (told and can tell myself) for form is being used to send out spam. Does anyone know hoe to fix this problem. If so please send code.

    Thanks
    Charles


    <?php
    $msg = "My Website Online Contact Submission";
    $msg .= "Name: $name";
    $msg .= "Comments: $emailAddress";
    $msg .= "Comments: $phone";
    $msg .= "Comments: $message";

    // Edit if it is nessecery
    $to = "$toaddress";
    $subject = "CONTACT PAGE FROM WEBSITE";
    $mailheaders = "From: Website Submission Form <$emailAddress>";
    $mailheaders .= "Reply-To:$Email_Address <$emailAddress>";

    // Mail to address
    mail ( $to, $subject, $msg, $mailheaders );

    ?>




    dirty_shame
    Joined: Aug 28, 2005
    # Posts: 191

    View the profile for dirty_shame Send dirty_shame a private message

    Posted: 2006-Feb-28 06:07
    Edit Message Delete Message Reply to this message

    OOPS! I just noticed that lizardz posted the same code snip I just posted in the NEXT thread down...So I guess you can disregard my reiteration of the same below. Same source.

    Here's some code (somebody else's) that I saved some time ago that filters the MIME type and some other things that will help you eliminate spammers almost completely. You can figure it out...Your own code would go after the last part (with a closing bracket, of course).

    $error = '';

    // get all the email form data

    $ems = '';

    // stop email server hacks
    $ems .= $message;
    $ems .= $subject;
    $ems .= $address;

    if ( stristr( $ems, 'content-type:' ) ¦¦ stristr( $ems, 'multipart/mixed' ) ¦¦ stristr( $ems, 'boundary="' ) ¦¦ stristr( $ems, 'cc:' ) ¦¦ stristr( $ems, 'multi-part message in mime format' ) ¦¦ stristr( $ems, 'to:' ) ¦¦ eregi( "(%[a-f0-9])", $ems ) ¦¦ stristr( $ems, '0x' ))
    // the last two are in case they try using hex or other non standard characters
    {
    $error .= "<p>Don't bother</p>";
    }

    if ( $error )
    {
    echo $error;
    }
    else
    {
    ...... finish email sending



    redgtsviper
    Joined: Feb 27, 2006
    # Posts: 3

    View the profile for redgtsviper Send redgtsviper a private message

    Posted: 2006-Feb-28 15:08
    Edit Message Delete Message Reply to this message

    So would the following be right

    <?php

    $error = '';

    // get all the email form data

    $ems = '';

    // stop email server hacks
    $ems .= $message;
    $ems .= $subject;
    $ems .= $address;

    if ( stristr( $ems, 'content-type:' ) ¦¦ stristr( $ems, 'multipart/mixed' ) ¦¦ stristr( $ems, 'boundary="' ) ¦¦ stristr( $ems, 'cc:' ) ¦¦ stristr( $ems, 'multi-part message in mime format' ) ¦¦ stristr( $ems, 'to:' ) ¦¦ eregi( "(%[a-f0-9])", $ems ) ¦¦ stristr( $ems, '0x' ))
    // the last two are in case they try using hex or other non standard characters
    {
    $error .= "<p>Don't bother</p>";
    }

    if ( $error )
    {
    echo $error;
    }
    else
    {

    $msg = "My Website Online Contact Submission";
    $msg .= "Name: $name";
    $msg .= "Comments: $emailAddress";
    $msg .= "Comments: $phone";
    $msg .= "Comments: $message";

    // Edit if it is nessecery
    $to = "$toaddress";
    $subject = "CONTACT PAGE FROM WEBSITE";
    $mailheaders = "From: Website Submission Form <$emailAddress>";
    $mailheaders .= "Reply-To:$Email_Address <$emailAddress>";

    // Mail to address
    mail ( $to, $subject, $msg, $mailheaders );
    }
    ?>

    [ Message was edited by: redgtsviper 02/28/2006 09:08 pm ]





    dirty_shame
    Joined: Aug 28, 2005
    # Posts: 191

    View the profile for dirty_shame Send dirty_shame a private message

    Posted: 2006-Mar-01 19:51
    Edit Message Delete Message Reply to this message

    Well, you just have to change the variables for the $ems .= [somevariable]; to match the ones coming in from your form in order for the script to check ALL of them for hackers/spammers. Then, if the subject, address and message are legit, you can set up the mailing variables and send it with the mail() function.


    You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
    1. You have not yet logged in, or registered properly as a member
    2. You are a member, but no longer have posting rights.
    3. This is a private forum, for which you do not have permissions.

    If you are a recent member, it's possible that you simply have not yet confirmed your account. Please check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions contained within.

    If you cannot find this message, click here to Re-Send it.

    If you are still experiencing problem, please read the Login Assistance Article for some advice on what may be causing your login not to work properly.

    Switch to Advanced Editor and ... Create a New Topic or Reply to this Thread

    New posts Forum is locked
    © 1995  ·  iWeb, Inc  ·  DBA JimWorld Productions