Stopp Posted March 16, 2006 Report Share Posted March 16, 2006 emocijikonas veidoju ar str_replace, piem. .. nu visi zina, kā ;) problēma ir ar ';)' smaidiņu, kas kopā ar htmlspecialchars dabū kļūdu - piem. ") pārveodojas par "[smaids] kā ar šito tikt galā ? Link to comment Share on other sites More sharing options...
Vebers Posted March 16, 2006 Report Share Posted March 16, 2006 Tad ari raksti str_replace('"[smaids]', 'images/[smaids.gif]', $txt); Link to comment Share on other sites More sharing options...
jauninjais Posted March 16, 2006 Report Share Posted March 16, 2006 (edited) a nevar gadiijumaa taa taisiit: $text = ereg_replace(";)", " <img src=\"images/sm04.gif\" width=\"17\" height=\"17\" title=\";)\" border=\"0\">", $text); un ... <A HREF="java script:setsmiley(';)')" ONFOCUS="filter:blur()"><img src="images/sm04.gif" width="17" height="17" title=";)" border="0"></a> ja tas tiek ielikts kaadaa laukaa Edited March 16, 2006 by jauninjais Link to comment Share on other sites More sharing options...
Stopp Posted March 16, 2006 Author Report Share Posted March 16, 2006 jauninjais, ar ko tad šai gadījumā atšķiras ereg_replace no str_replace ? MakaTaNaw, ir str_replace(";)", "<img ../>", $text); un .... pag, nupatkā laikam izdomāju. :P jātaisa smailpārveide pirms htmlspecialchars :) Link to comment Share on other sites More sharing options...
Vebers Posted March 16, 2006 Report Share Posted March 16, 2006 Stopp, es tev jau teicu str_replace('[b]"[smaids][/b]', 'images/[smaids.gif]', $txt); t.i. ar visu " raksti "mekleejamo textu", jo tads vinjs nak pec parveides. Link to comment Share on other sites More sharing options...
Stopp Posted March 16, 2006 Author Report Share Posted March 16, 2006 mm, MakaTaNaw, tu nesaprati domu. ja man ir htmlspecialchars($text); un str_replace(";)", "<img ../>", $text); tad sākumā " pārveidojas par " un ;) pārveidojas par <img ../>, tātad ") -> ") -> "<img ../> un līdzko nav " , bet ir " , tā WML lapas vispār never vaļā... bet ja sākumā ir str_replace un pēc tam htmlspecialchars, tad visam vajadzētu būt kārtībā. :) kaukad rīt pamēģināšu, tagad pālis. ;) Link to comment Share on other sites More sharing options...
Grey_Wolf Posted March 16, 2006 Report Share Posted March 16, 2006 Stopp--> nu bet tachu logjiskji: manuprrat vispaar pie formas datu apstraades ir praatiigi pietureetis pie shadas shemas:) 1) trim(); // novaacam tukshumus utt. no sakuma un beigaam 2) ja nepiechieshams apstradaajam datus // parbaudam validaati, nomanam visu kas janomaina (liekie simboli utt.. 3) ja nepiecieshams izmantojam htmlspecialchars 4) ja nepiecieshams izmantojam adslashes 5) saglabaajam / nosuutam /izvadam datus... Link to comment Share on other sites More sharing options...
Vebers Posted March 16, 2006 Report Share Posted March 16, 2006 un? sakaarto vinjus taa -> str_replace("")", "<img ../>", $text); str_replace(";)", "<img ../>", $text); jo replace ies pec kartas, vismaz ja lieto araajus, tad toch taa ir. Link to comment Share on other sites More sharing options...
Stopp Posted March 16, 2006 Author Report Share Posted March 16, 2006 (edited) str_replace("")", "<img ../>", $text); http://php.net/htmlspecialchars :) un to jau es arī iepriekšējā postā teicu :) edit: paaag.. nafig ") uz img vajag pārveidot ? ") vajag uz ") hmm, tu tiešām kaut ko nesaprati. :P ķipa lieta atrisināta, viss :) Edited March 16, 2006 by Stopp Link to comment Share on other sites More sharing options...
Vebers Posted March 16, 2006 Report Share Posted March 16, 2006 pameegjini -> <?php $text = htmlspecialchars('hah;) ")'); $text = str_replace("")", "ar guot", $text); $text = str_replace(";)", "ar quota", $text); echo $text; ?> un <?php $text = htmlspecialchars('hah;) ")'); $text = str_replace(";)", "ar quota", $text); $text = str_replace("")", "ar guot", $text); echo $text; ?> nebija man taisniiba ? Link to comment Share on other sites More sharing options...
Stopp Posted March 16, 2006 Author Report Share Posted March 16, 2006 wdf, nu vispār neko nesaprotu. quota, guot.. ? vsjo, viss atrisināts. aa, nu es sāku saprast tavu domu. bet jebkurā gadījumā vienkāršāk ir sākumā str_replace ar smaidiem, tad htmlspecialchars. Link to comment Share on other sites More sharing options...
Vebers Posted March 16, 2006 Report Share Posted March 16, 2006 (edited) ja htmlspecialchars laidiisi peec str_replace, tad visi <img ../> parvertisies par <img .. /> edit: un tad tas nedarbosies uz wm (cik sapratu, tavs merkis - wml) Edited March 16, 2006 by MakaTaNaw Link to comment Share on other sites More sharing options...
Grey_Wolf Posted March 16, 2006 Report Share Posted March 16, 2006 (edited) hmm.. a nevar shaadi sakumaa visus ;) utt.. parversh par bb tagiem peec tam htmlspecialchars.. un taalaak apstraadaat tos bb tagus? buus pilna garantija ka kautkur nepaliks netljauti HTML tagi.... un 'Vaboleem' arii buutu jaabuut mazaak.... Edited March 16, 2006 by Grey_Wolf Link to comment Share on other sites More sharing options...
Vebers Posted March 16, 2006 Report Share Posted March 16, 2006 Grey_Wolf, protams var, tikai tad ieilgs skripta izpildes laiks un daudzak darba pie skritpa. Manupraat izdevigak butu htmlspecialchars, sakartots str_replace, lai pazud iespeja, ka k-kas dublesies. Cik tad nu ir tie smailiji ar quoteem ? Es pat prakstiski tadus nelietoju. Un 1 tikai zinu "). Link to comment Share on other sites More sharing options...
Grey_Wolf Posted March 16, 2006 Report Share Posted March 16, 2006 njus es shajaa gadiijumaa domaaju ka lai kods buutu gana unversaals ;) ja nu tiek izmantoti tie BB tagi? tad taapat vinji buus jaapstraadaa :) un skripta izpildes laiks daudz svariigaaks ir pie izvades nevis pie ievades... P.S. vienkaarshaak vienreiz ruupiigaak paseedeet un paplaanot to kodu un tad nakamreiz darba faktiski nebuus... Link to comment Share on other sites More sharing options...
Recommended Posts