There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Solved: Slashes in messages created by PHP file


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
rkselby98's Avatar
Distinguished Member with 4,025 posts.
 
Join Date: May 2000
Location: Gettysburg, PA
Experience: Still Learning
01-Mar-2008, 10:32 AM #1
Solved: Slashes in messages created by PHP file
I have a PHP file and it puts in slashes when a " or ' is used. This only does this in the message box, not in the other fields. I figured out how to remove them from the other fields but the message text box they still appear.

The PHP file is attached.

Thank you for any help you can provide and have a great day.
Attached Files
File Type: zip test.zip (1.4 KB, 7 views)
__________________
Rick
http://rselby.net
General Help With MS Products
It is with the heart that one sees rightly; what is essential is invisible to the eye.
Antoine de Saint-Exupéry

Last edited by rkselby98 : 01-Mar-2008 11:04 AM.
Sequal7's Avatar
Computer Specs
Distinguished Member with 2,369 posts.
 
Join Date: Apr 2001
Location: Around the corner!
Experience: Including today?
01-Mar-2008, 11:42 AM #2
Hello, have you tried adding stipslashes to your source code?

http://ca.php.net/stripslashes
rkselby98's Avatar
Distinguished Member with 4,025 posts.
 
Join Date: May 2000
Location: Gettysburg, PA
Experience: Still Learning
01-Mar-2008, 11:58 AM #3
I just gave that a try and on the page that shows the person who is submitting the forms what was submitted the following shows at the top of the page so I must have the code entered wrong.

$array = array("f\\'oo", "b\\'ar", array("fo\\'o", "b\\'ar"));

And this is the code I inserted, below is part of the php file, the red is what I had and the blue is the code I inserted.

function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);

return $value;
}

// Example
$array = array("f\\'oo", "b\\'ar", array("fo\\'o", "b\\'ar"));
$array = stripslashes_deep($array);

// Output
print_r($array);

Below is how I put the code on the php file, must be incorrect

# ----------------------------------------------------
# -----
# ----- This script was generated by PHP-Form Wizard 1.2.5 on 3/1/2008 at 9:46:00 AM
# -----
# ----- http://www.tools4php.com
# -----
# ----------------------------------------------------
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);

return $value;
}

// Example
$array = array("f\\'oo", "b\\'ar", array("fo\\'o", "b\\'ar"));
$array = stripslashes_deep($array);

// Output
print_r($array);


include("contact-header.htm");
// Receiving variables
@$pfw_ip= $_SERVER['REMOTE_ADDR'];
@$name = ($_POST['name']);
@$streetaddress = ($_POST['streetaddress']);
@$city = ($_POST['city']);
@$state = ($_POST['state']);
@$zip = ($_POST['zip']);
@$telephone = ($_POST['telephone']);
@$email = ($_POST['email']);
@$message = ($_POST['message']);


Plus the slashes are still in the message.
Example: Message: Testing\'s \"testing\"

Thanks for the quick rely.
__________________
Rick
http://rselby.net
General Help With MS Products
It is with the heart that one sees rightly; what is essential is invisible to the eye.
Antoine de Saint-Exupéry
Sequal7's Avatar
Computer Specs
Distinguished Member with 2,369 posts.
 
Join Date: Apr 2001
Location: Around the corner!
Experience: Including today?
01-Mar-2008, 01:08 PM #4
Hi again, you can't copy and paste the code, you have to define your own variables.

This post should lead you closer into the right direction;
http://ca.php.net/manual/en/function...shes.php#73658
rkselby98's Avatar
Distinguished Member with 4,025 posts.
 
Join Date: May 2000
Location: Gettysburg, PA
Experience: Still Learning
01-Mar-2008, 04:12 PM #5
Okay that is the problem, then I am going to have to find another solution or just forget it for I know nothing about code or writing scripts. Me a total idiot when it comes to that. I have a program that creates the PHP file for me and I contacted the programmer and he was no help at all.

Thanks for your time and help, it is appreciated.
__________________
Rick
http://rselby.net
General Help With MS Products
It is with the heart that one sees rightly; what is essential is invisible to the eye.
Antoine de Saint-Exupéry
Sequal7's Avatar
Computer Specs
Distinguished Member with 2,369 posts.
 
Join Date: Apr 2001
Location: Around the corner!
Experience: Including today?
01-Mar-2008, 08:43 PM #6
What is it exactly you are trying to so with this form?
Can you provide the files included in the script
Code:
include("contact-header.htm");
for me to have a look at.
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 02:16 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.