473,396 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Forms Proccessing

Hello,

I have a premade for that is having probelms dealing with aposterphies
and forward slahes. Is there a way to edit the code so it does not alter
aposterphies and forward slahes?
Example:
If I enter ' the form displays it as /'
If I enter / the for displays it as //

I'm a very very new comer to PHP, so please be gental.

Thanks in advance for your help,

HTH Brand
Jul 17 '05 #1
6 1748
I noticed that Message-ID:
<0l****************@newssvr23.news.prodigy.net> from Honky Tonk Hero
contained the following:
If I enter ' the form displays it as /'
If I enter / the for displays it as //

I'm a very very new comer to PHP, so please be gental.


Instead of

echo $_POST['name_of_field'];

do

echo stripslashes($_POST['name_of_field']);

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2
*** Honky Tonk Hero escribió/wrote (Tue, 08 Feb 2005 18:15:24 GMT):
I have a premade for that is having probelms dealing with aposterphies
and forward slahes. Is there a way to edit the code so it does not alter
aposterphies and forward slahes?
Example:
If I enter ' the form displays it as /'
If I enter / the for displays it as //


It's a pretty stupid "feature" that PHP has. It can either be enabled or
disabled, in your server it seems to be enabled. Check this:

http://es2.php.net/manual/en/security.magicquotes.php

You can either disable it (if it's possible) or use code to detect it and
act accordingly.
--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Manda tus dudas al grupo, no a mi buzón
-+ Send your questions to the group, not to my mailbox
--
Jul 17 '05 #3
On Tue, 8 Feb 2005 20:29:47 +0100
"Alvaro G. Vicario" <kA*****************@terra.es> wrote:
*** Honky Tonk Hero escribió/wrote (Tue, 08 Feb 2005 18:15:24
GMT):
I have a premade for that is having probelms dealing with
aposterphies and forward slahes. Is there a way to edit the
code so it does not alter aposterphies and forward slahes?
Example:
If I enter ' the form displays it as /'
If I enter / the for displays it as //
It's a pretty stupid "feature" that PHP has. It can either be
enabled or disabled, in your server it seems to be enabled.
Check this:


Yeah, totally useless.

[...]
You can either disable it (if it's possible) or use code to
detect it and act accordingly.


Yes, and it's better not to depend on the server. Here's a way:

$r = get_magic_quotes_gpc();

function strip_r($v) {
$v = is_array($v) ?
array_map('strip_r',$v) : stripslashes($v);
return $v;
}

if ($r) {
$_POST = array_map('strip_r', $_POST);
$_GET = array_map('strip_r', $_GET);
$_COOKIE = array_map('strip_r', $_COOKIE);
}

And for runtime magic quotes,

$i = get_magic_quotes_runtime();
$r = set_magic_quotes_runtime(0);

if($i)
if (!$r)
print "Can't set. Can't help.\n";

Jul 17 '05 #4
Hey thanks for the great support fellas!

Now for a very newb question... (I mean very newb. New as in "This is
the first time I've messed with PHP".)
Based on the code below, how and were would I set up the code to fix the
Magic Quotes?

-- BEGINE CODE --
$blanks = 0;
foreach($_POST as $key => $value) {
if ($value)
{
$url .= "&" . $key . "=" . urlencode($value);
}
else
{
if (!(($key == "Address2") || ($key == "OtherNetEquip") || ($key ==
"PVR") || ($key == "PremChannel") || ($key == "OtherAV") || ($key ==
"Mailinglist") || ($key == "Comments")))
$blanks++;
}
}

// echo "url:$url<br>\n";

// $url = urlencode(urlencode($url));

// echo "urlencoded:$url<br>\n";

if ($blanks)
echo '<meta http-equiv="refresh" content="'.$delay.';url='.$url.'">';
else
{
-- END CODE --

Thank you very much for your help.

Warren
HTH Brand
Jul 17 '05 #5
I noticed that Message-ID:
<%s****************@newssvr23.news.prodigy.net> from Honky Tonk Hero
contained the following:
Hey thanks for the great support fellas!

Now for a very newb question... (I mean very newb. New as in "This is
the first time I've messed with PHP".)
Based on the code below, how and were would I set up the code to fix the
Magic Quotes?
<snip> $url .= "&" . $key . "=" . urlencode($value);

$url .= "&" . $key . "=" . stripslashes(urlencode($value));

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #6
Thanks for the help Geoff!

I appreciate it.

James
Geoff Berrow wrote:
I noticed that Message-ID:
<%s****************@newssvr23.news.prodigy.net> from Honky Tonk Hero
contained the following:

Hey thanks for the great support fellas!

Now for a very newb question... (I mean very newb. New as in "This is
the first time I've messed with PHP".)
Based on the code below, how and were would I set up the code to fix the
Magic Quotes?

<snip>
$url .= "&" . $key . "=" . urlencode($value);


$url .= "&" . $key . "=" . stripslashes(urlencode($value));

Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
3
by: Joshua Russell | last post by:
Hi, Both the methods below open up a windows form called MasterForm. However, one works better than the other. Method 1 opens the form correctly but I don't have any reference to the instance of...
7
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls...
13
by: MD | last post by:
I have been converting a program from VB6 to VB.Net and enhancing it as well. All has been progressing OK although its been hard work. Now, all of a sudden, when I try to execute a ShowDialog()...
15
by: Joshua Kendall | last post by:
I have a script in which it keeps opening the same form instead of only one instance. I also need help with a form that has a password. Where do I put the actual password? can I use a database for...
3
by: Lloyd Sheen | last post by:
I have the following situation: Need a user resizable user control. After much trying with user control I came across the idea of hosting the controls in a form marked as not TopLevel = false. ...
8
by: Stephen Rice | last post by:
Hi, I have a periodic problem which I am having a real time trying to sort. Background: An MDI VB app with a DB on SQL 2000. I have wrapped all the DB access into an object which spawns a...
3
by: Geraldine Hobley | last post by:
Hello, In my project I am inheriting several forms. However when I inherit from a form and add additional subroutines and methods to my inherited form I get all sorts of problems. e.g. I sometimes...
6
by: dbuchanan | last post by:
I have a Windows Forms application that accesses SQL Server 2k from a small local network. The application has been used for weeks on other systmes but a new install on a new machine retruns...
1
by: jayeshmahajan23 | last post by:
what is multi proccessing in apache server and threading ? anybody tell i want to learn about apache server and also tell me how it handles the request ?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.