[PHP] RegEx problems...
This is baffling me, I have a form on one page that opens a php file in a text area for editing. In order to view the contents of the file in the text area I had to setup a eregi_replace(,a) string. When I save the changes back to the text file I setup a reverse string i.e. [ eregi_replace(a,) ] however it just blows right by this portion of the script. I have tried a few different variations ex. $file_name= blank.php; $file_open = fopen($file_name, wr+); $replace = eregi_replace(a,, $passwords); fwrite($replace, $file_open, stripslashes($passwords)); print ($passwords was written to $file_name); and $file_name= blank.php; $file_open = fopen($file_name, wr+); fwrite(eregi_replace(a,), $file_open, stripslashes($passwords)); print ($passwords was written to $file_name); So far nothing has worked, actually the last example overwrites the file with nothing. Anyone come across a problem similar to this? If so how did you solve it? Thanks in advance, Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RegEx problems...
On Mon, Jun 03, 2002 at 11:15:15AM -0600, Jas wrote: In order to view the contents of the file in the text area I had to setup a eregi_replace(,a) string. 's are not legal in HTML. You need to escape them. When pulling stuff out of the file, use htmlspecialchars() before displaying the text in your form. THEN, when you're putting the user input from the form back into the file, use this: $Replace['amp;'] = ''; $Replace['lt;'] = ''; $Replace['gt;'] = ''; $Replace['quot;'] = ''; $UserInput = strtr($UserInput, $Replace); --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Regex problems.....
Guys/Gals: For some reason too long to explane .. i have this site that i need to make all the image names in an image src all lowercase.. Here is what I have so far. Please someone tell me what I am doing wrong. ? $contents="img src=ThisOneReallyNeedsToBeAllLowercase.gif alt=ThisOneReallyNeedsToBeAllLowercase.gif"; $contents = EREG_REPLACE("([-_a-zA-Z0-9]+).gif",strtolower("\\0"),$contents); ? Output of $contents needs to equal img src=thisonereallyneedstobealllowercase.gif alt=thisonereallyneedstobealllowercase.gif I have the top part of my script reading the whole DIR and only editing the HTML files so that part is taken care of All I need it help with making the images tag all lower case. Ian LeBlanc 2tonecafe.com Admin 727-517-3866 You can have [EMAIL PROTECTED] free too. Apply today! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Regex problems.....
You should either do this with ereg, or strtolower and not a combination of the two, and in all actuality strtolower is specifically desinged to do this very easily so I would go with it. ? $contents="img src=ThisOneReallyNeedsToBeAllLowercase.gif alt=ThisOneReallyNeedsToBeAllLowercase.gif"; $contents = strtolower($contents); ? Should do what you want. -- phill "Ian LeBlanc" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Guys/Gals: For some reason too long to explane .. i have this site that i need to make all the image names in an image src all lowercase.. Here is what I have so far. Please someone tell me what I am doing wrong. ? $contents="img src=ThisOneReallyNeedsToBeAllLowercase.gif alt=ThisOneReallyNeedsToBeAllLowercase.gif"; $contents = EREG_REPLACE("([-_a-zA-Z0-9]+).gif",strtolower("\\0"),$contents); ? Output of $contents needs to equal img src=thisonereallyneedstobealllowercase.gif alt=thisonereallyneedstobealllowercase.gif I have the top part of my script reading the whole DIR and only editing the HTML files so that part is taken care of All I need it help with making the images tag all lower case. Ian LeBlanc 2tonecafe.com Admin 727-517-3866 You can have [EMAIL PROTECTED] free too. Apply today! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]