lame Posted July 3, 2003 Report Share Posted July 3, 2003 Probleema: Ar fwrite() ierakstu failaa noteiktu infu, kas nāk no <textarea>, bet pa vidu tiek sabaazti '' sleshi. Vai to izdara fwrite() vai arii tas notiek pie "POST" no <textarea>. Kaads mosh var paliidzeet? Link to comment Share on other sites More sharing options...
PheliX Posted July 3, 2003 Report Share Posted July 3, 2003 no textarea jau tiek sanjemts ar slashiem - prieksh tam ir stripslashes(); Link to comment Share on other sites More sharing options...
Venom Posted July 3, 2003 Report Share Posted July 3, 2003 gr... print_r($_POST); View>Source un redzēsi kas tieši to nodod. Parasti tas arī ir $_POST. Dažos gadījumos varētu pievienoties, ja raksti fwrite($fp,"$stringa no textareas") resp. iekš dubultiekavām, tāpēc jāliek fwrite($fp,stripslashes($stringa_no_textareas)); man tādiem gadījumiem ir dažas paštaisītas f-jas: //get value from POST by var keyname < key > value function p($reuse,$reuse1=0) { if (!isset($_POST[$reuse])){$_POST[$reuse]='';} if ($reuse1) { if ($_POST[$reuse]=='') return array(); return $_POST[$reuse]; } return trim($_POST[$reuse]); } //check whether a var length is more than 1 character (non-!isset,non-space string) < string > boolean function l($reuse) { return strlen(trim($reuse)); } //prepare 4 query (string inquoting) function < string > string which is safe for putting inside query //if second argument is true, all thml entities are converted to &xxxx; equivalents function p4q($reuse,$reuse1=0) { if ($reuse1) { return mysql_escape_string(stripslashes(htmlspecialchars($reuse))); } return mysql_escape_string(stripslashes($reuse)); } čekojam: if (l(p('textarea'))) { @fwrite($fp,p4q(p('textarea'))); } tas pats arī labi nostrādās priekš $query="SELECT * FROM database WHERE `something` LIKE '%".p4q(p('textarea')).'%"; Link to comment Share on other sites More sharing options...
lame Posted July 3, 2003 Author Report Share Posted July 3, 2003 Paldies visiem! Link to comment Share on other sites More sharing options...
Recommended Posts