Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6133773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:16:16+00:00 2026-05-23T17:16:16+00:00

Right now I’m trying to make an email notification whenever somebody submits a comment

  • 0

Right now I’m trying to make an email notification whenever somebody submits a comment going into a database. I’m using mysql_real_escape_string() to protect against injections and I’m trying to strip the slashses off the name, email, and comment when they are sent in the email notification. The database entry code is commented out, as I don’t want there to be an entry made every time I test the email system.

The email is sent just fine, however stripslashes() is not working properly. For example, if the message is “Can’t wait!” the email will have “Comment: Can\’t wait!”. This is strange to me because when I have the comments displayed on the page, stripslashses works fine.

Is this because I’m not applying stripslashes() to data not coming directly out of the database?

$li = mysql_connect($dbHost, $dbUser, $dbPass) or die("Could not connect");
    mysql_select_db($dbDatabase, $li) or die ("could not select DB"); 

    $name = mysql_real_escape_string($HTTP_POST_VARS["name"]);
    $email = mysql_real_escape_string($HTTP_POST_VARS["email"]);
    $comment = mysql_real_escape_string($HTTP_POST_VARS["comment"]);
    $date = Date("Y-m-d h:i:s");
    /*
    $gb_query =     "insert into entries
            values(0, '$name', '$email', '$comment', '$date')";

    mysql_query($gb_query);
    $res = mysql_affected_rows();

    // See if insert was successful or not
    if($res > 0) {

    $ret_str="Your guestbook entry was successfully added!";*/
        $name2=stripslashes($name);
        $email2=stripslashes($email);
        $comment2=stipslashes($comment);
        $subject = 'New Guestbook Entry Has been Added!';
        $message = "Name:  $name2\nEmail:  $email2\nComment:  $comment2";
        $to = "chetg329@yahoo.com";
        mail($to, $subject, $message);
        //header('Location: guestbook.php?ps=1');
    //exit(); // End the request
    /*  
    } else {
        $ret_str = "There was a problem with your guestbook entry. Please try again.";
    }

    // Append success/failure message
    $gb_str .= "<span class=\"ret\">$ret_str</span><BR>";*/
    mysql_close();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:16:16+00:00Added an answer on May 23, 2026 at 5:16 pm

    My guess is that the problem lies within magic_quotes. I would take a look at your php.ini and see if you can turn it off (pending you are not relying on it to prevent SQL Injection). If you cannot access the php.ini to turn it off PHP provides a method for you to test it and act accordingly (IE stripslashes on the data before escaping it with mysql_real_escape_string ) It is called get_magic_quotes_gpc

    Alternatively, why are you using mysql_real_escape_string on data that is not being inserted into the database? If you do insert it later on, then move those calls till after the mail call.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now, I have three models Post, Comment and User (using Devise ) associated
Right now I have a database (about 2-3 GB) in PostgreSQL, which serves as
right now i m using adobe live media encoder to stream live webcam video
Right now I have a mysql database with a table userphone(id, phone, type,userid) and
this is what i have right now Drawing an RSS feed into the php,
Right now I have an application that loads a bunch of thumbnail images into
Right now I'm using the jQuery selector $('foo+bar') . Since I already have $('foo')
Right now we have a dll file that contains all the database calls and
Right now, I'm using this to allow a file to be moved to our
Right now I'm asking the user for two numbers. I'm trying to print the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.