= 500) { $quote = substr($quote, 0, 500); $quote = $quote."..."; } // Same thing for the name but with length of 100 characters. if (strlen($name) >= 100) { $name = substr($name, 0, 100); $name = $name."..."; } // So long as the quote is not null, it is stored in the quotes.txt file // NOTE: Permissions need to be set on this file as 777 so that it can be added to automaticaly if ($quote != "") { $fp = fopen("quotes.txt", "a"); // If the name is not null, write directly to the quotes.txt, if not, set $name = 'Anon' if ($name == "") { $name = "Anon"; } fwrite($fp, "$quote [$name]\n"); // close the 'quotes.txt' file fclose($fp); // Mail the quote to me (or if this code is on your site, to you) mail("natbat77@hotmail.com", "[AUTO] New quote added", "A new quote has been added to 'quotes.txt'\nThe quote was added by: $name\nThe quote added was: $quote", "From: nat@natbat.co.uk\r\n"); print "
New quote added: $quote
Added by: $name
"; } print ''; } else { // close the php statement so it is possible to enter normal html, // just dont forget to end the if statement at the end ?>To submit a quote to the database of quotes, enter it along with your name. It is then part of the list of options for the random generator.
Note: The quote will be limited to 150 characters, and all HTML will be striped.