kanotix.com

Anything goes - A bit of a strange request ...

jesseman - 22.05.2006, 17:07 Uhr
Titel: A bit of a strange request ...
I need your help in setting up a script. I post news for a large online gaming league. Now, although it is in HTML, I have to post the news via forum. The forum interprets all tabs and carriage returns in my HTML. This means my readable code renders real crazy in the forums.

So, I need a script to remove all tabs and carriage returns. Help!
zulu9 - 22.05.2006, 19:23 Uhr
Titel: A bit of a strange request ...
there may be a better/faster/easier way, but you could try use perl.
in perl,there is a function, which cuts off the CR at the end of a line.
chomp($var);
markb - 22.05.2006, 23:20 Uhr
Titel: RE: A bit of a strange request ...
Code:
tr -d '\t\r'

h2 - 23.05.2006, 00:18 Uhr
Titel: RE: A bit of a strange request ...
PHP:
// data in form field:
$formdata = $_POST['form field name'];// replace with real form input data names
$replace_stuff = array("\r\n","\n","\t");// str_replace will use this array to search for all present array items
$cleaned_form_field_data = str_replace( $formdata, '', $replace_stuff);

I think that will do it.
jesseman - 23.05.2006, 13:04 Uhr
Titel: RE: A bit of a strange request ...
I will be trying markb and h2's ideas later today. Results will be coming! Thanks guys!
Alle Zeiten sind GMT + 1 Stunde
PNphpBB2 © 2003-2007