1
34 points at
74%
Posted June 11 '09 at 02:59 PM
Posts: 782
i just cannot seem to figure out how to remove slashes from the first loop. no matter how i implement striplashes it will remove the text preceding the apostrophe that
is causing the slash.
<?php
$pspell_link = pspell_new("en");
if(isset($_GET['text'])) {
$words = stripslashes($_GET['text']) ; }
echo "<form method='get' action='spell.php'>";
if (isset($_GET['0'])) echo "0";
{
foreach($_GET as $key0 => $marker)
{
$value = split('[ ]', $marker );
$value0[] = $value[0] ; $value1[] = $value[1] ; echo "Value : |0| $value0 |1| $value1 |Key| $key0 <hr>";
echo "Print Value Stage 1:"; print_r($value0); print_r($value1); echo "<hr>";
}
$print = str_replace( $value0 , $value1 , $words );
}
if(!isset($_GET['0']))
{
$print = $words;
}
if (isset($_GET['check']))
{ echo "<b><i> $words </i></b><hr>";
$string = split('[ ]', $words); foreach($string as $key1 => $word)
if (!pspell_check($pspell_link, $word))
{
echo "<hr><b><i>$word</i></b><br>"; $suggestions = pspell_suggest($pspell_link, $word);
foreach($suggestions as $key2 => $suggestion)
{
$send = "$word $suggestion"; echo "<input type='checkbox' name='$key1' value='$send'>$suggestion<br>";
}
}
}
echo "<hr><textarea name='text'class='textarea' type='text/plain' rows='15' cols='40'>$print</textarea><hr>";
if(!isset($_GET['check'])) { echo "<button name='check' value='check check' type='submit'>Check Spelling</button>"; }
if(isset($_GET['check'])) { echo "<button name='done' value='done done' type='submit'>Done</button>"; }
echo "</form>";
unset($print);
?>
further if you see any other part of this code you would like to comment on please do so.
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein
Last edited June 13 '09 at 05:19 PM by Dorky.
Reply
Advertisement
Register for free to hide these ads and participate in discussions!
2
345 points at
100%
Wired, Admin and WDF Alien Overlord
Home page
Private message
Posted June 12 '09 at 04:34 AM
Posts: 6,275
What other thread?
Admin at
houseofhelp.com
WDF Resources:
The Rules
Founder/Creator/Admin of
ZE SECRET PROJECT!
Was another WDF member's post helpful? Click the positive rating button (

) above the post.
Wired is online now!
Reply
3
34 points at
74%
Posted June 13 '09 at 09:05 PM
Posts: 782
actualy i need to allow for punctuation all together. yes yes security, i can take care of that and welcome suggestions but i have been at this for a long bit now and out of 55 views on 3 forums have gotten 1 suggestion that only errored out.
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein
4
34 points at
74%
Posted June 13 '09 at 11:22 PM
Posts: 782
well still no joy. im sure there has to be a simple solution to allowing punctuation. i refuse to believe the creators of php didnt think punctuation would need to be passed on a regular enough bases to not simplify it without an extra 200 line of code to get it passed.
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein
5
58 points at
100%
Posted June 14 '09 at 01:19 AM
Posts: 156
Do I understand correctly that you're just trying to allow an entry like "Matt's" into a database?
If so, use this:
function noslash($var){
$bad = array("
\\\"", "\'", "
\\\\", "\"", "'");
$good = array(""", "'", "\", """, "'");
$return = str_replace($bad, $good, $var);
return $return;
}
6
34 points at
74%
Posted June 14 '09 at 02:10 AM
Posts: 782
yes that it. and all puntuation for that matter.
is there no command for this?
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein
7
34 points at
74%
Posted June 14 '09 at 02:11 AM
Posts: 782
oh no not a databes
its for a spell check
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein
8
34 points at
74%
Posted June 14 '09 at 02:12 AM
Posts: 782
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein
9
58 points at
100%
Posted June 14 '09 at 02:19 AM
Posts: 156
I believe the original intent was for magic quotes to handle this though it's sketchy...
10
34 points at
74%
Posted June 14 '09 at 03:05 AM
Posts: 782
i did this but no matter where i put it the text preceding
the punctuation gets cut out. ?????
$print = stripslashes(str_replace( $value0 , $value1 , $words ));
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein
11
34 points at
74%
Posted June 14 '09 at 04:23 AM
Posts: 782
<input type='checkbox' name='$key1' value='$send'>$suggestion
this is where it is happening duuuuuuu!
value='blablabla's'
whats wrong with that picture lol.
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein
12
34 points at
74%
Posted June 14 '09 at 05:26 AM
Posts: 782
i present the accomplishment of my month
<?php
$pspell_link = pspell_new("en");
if(isset($_GET['text'])) {
$words = stripslashes($_GET['text']) ; }
echo "<form method='get' action='spell.php'>";
if (isset($_GET['done'])) echo "0";
{
foreach($_GET as $key => $markers)
{ $marker = rawurldecode($markers);
$value = split('[ ]', $marker ); if(empty($value[0])) continue; if(empty($value[1])) continue;
$value0[] = stripslashes($value[0]) ; $value1[] = stripslashes($value[1]) ;
}
echo "Print Value Stage 1:"; print_r($value0); print_r($value1); echo "<hr>";
$print = str_replace( $value0 , $value1 , $words );
}
if(!isset($_GET['done']))
{
$print = $words;
}
if (isset($_GET['check']))
{ echo "<b><i> $words </i></b><hr>";
$string = split('[ ]', $words); foreach($string as $key1 => $word)
if (!pspell_check($pspell_link, $word))
{
echo "<hr><b><i>$word</i></b><br>"; $suggestions = pspell_suggest($pspell_link, $word);
foreach($suggestions as $key2 => $suggestion)
{
$set = "$word $suggestion"; $send = rawurlencode($set); echo "<input type='checkbox' name='$key1' value='$send'>$suggestion<br> ";
}
}
}
echo "<hr><textarea name='text'class='textarea' type='text/plain' rows='15' cols='40'>$print</textarea><hr>";
if(!isset($_GET['check'])) { echo "<button name='check' value='check check' type='submit'>Check Spelling</button>"; }
if(isset($_GET['check'])) { echo "<button name='done' value='done done' type='submit'>Done</button>"; }
echo "</form>";
unset($print);
?>
http://studio378d.com/spell.php 
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein
13
32 points at
100%
Posted June 18 '09 at 05:10 AM
Posts: 76
The string replace method works, also stripslashes should also work, and really is the only method to work properly. I think though you can run an eval(); on the text as well, php should auto-strip from there.
Lead Web Designer
MLW & Associates, LLP.
W3C Standards Complaint and SEO Friendly
Admin of Vraul
14
34 points at
74%
Posted June 18 '09 at 05:35 AM
Posts: 782
actually i fixed the prob with urlencode and urldecode but thx much for the reply.
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein