Script URL: http://gabsal.100webspace.net/testingbook/gbook.php
Version of script: 143
Hosting company: http://www.100webspace.com/
URL of phpinfo.php: http://gabsal.100webspace.net/testingbook/phpinfo.php
URL of session_test.php: http://gabsal.100webspace.net/testingbo ... n_test.php
What terms did you try when SEARCHING for a solution: spaces, multiple spaces, line breaks...
Write your message below:
Hi! I have 2 questions, (maybe they are the same):
Q1:
I would like to know if there is a way to avoid a user entering multiple empty lines. In other words: if a user enters something like this:
test
test
I would like to change it into this (turn n empty lines (spaces) into just one):
test
test
Q2:
Another problem is the following: If a user enters a lot of empty lines between words (see example here: http://gabsal.100webspace.net/testingbook/ ) Then a strange < br> tag appears and the end of the comments became bold (in the example I ONLY entered the word "test" at the first line and again the word "test" at the last line). Can that be avoided?
Thanks for your help.
[Maybe a way to avoid these problems would be to set a maximum number of characters that a user can enter in the text field, then that would refrain the user from doing this stupid input. If that is so, do you know how that can be accomplished?]
(Sorry if my questions look too naive; I am a php newbee and my mother tongue is not english!)
How to remove multiple empty lines (spaces) entered by user
So you finally were able to login to the forum
Try opening gbook.php in a plain text editor (Notepad) and change lines 620 to 623 from to this:
Haven't really tested it so please come back and say if it worked or not.
I think I'll include this in the next version by default.

Try opening gbook.php in a plain text editor (Notepad) and change lines 620 to 623 from
Code: Select all
$comments = str_replace("\r\n","<br>",$comments);
$comments = str_replace("\n","<br>",$comments);
$comments = str_replace("\r","<br>",$comments);
$comments = wordwrap($comments,$settings['max_word'],' ',1);
Code: Select all
$comments = wordwrap($comments,$settings['max_word'],' ',1);
$comments = preg_replace('/(\n|\r)+/','<br>',$comments);
I think I'll include this in the next version by default.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools