To prevent spam, I need the user text to have the <html> tag in the beginning, because the site is about blogger/myspace templates, so the system gotta recognize that there is a <html> tag somewhere in the text.
I think it can be easily done with condition function, but I don't know how where from start.
15 10459
i dont realy understand your question can you expanciate on what you want...are you trying to search for the occurence of <html> in the submitted string?
It's like:
1 - User is typing, then he submits the form.
2 - On submission, user get a message saying: The content you typed is not a myspace/blogger template, please use a template.
3 - To know if he's using a template or not, the system will see if in the submitted text there was a <html> tag, but the user doesn't know about.
I think that's a little like that "Required field" function, but here there is no if (empty) function.
i hope this should help you
if not let me know -
<?php
-
-
$word_a = "<html>";
-
$word_b = "</html>";
-
$main = $_POST['variable_name'];
-
-
#the main varible will be submitted by your form. Change the variable_name for the real name of your variable on the form
-
-
$errors = array();
-
#this will hold any error messages if found
-
-
if (strpos($main, $word_a) === false)
-
{
-
$errors[] = "Our Systems Detected that this is not a valid blogger/myspace template - Missing <html> tag";
-
}
-
-
if (strpos($main, $word_a) !== false)
-
{
-
echo "Your success messages or you could leave it blank";
-
}
-
-
if (strpos($main, $word_b) === false)
-
{
-
$errors[] = "Our Systems Detected that this is not a valid blogger/myspace template - Missing </html> tag";
-
}
-
-
if (strpos($main, $word_b) !== false)
-
{
-
echo "Your success messages or you could leave it blank";
-
}
-
?>
-
i hope this helps...let me know if not
i hope this should help you
if not let me know -
<?php
-
-
$word_a = "<html>";
-
$word_b = "</html>";
-
$main = $_POST['variable_name'];
-
-
#the main varible will be submitted by your form. Change the variable_name for the real name of your variable on the form
-
-
$errors = array();
-
#this will hold any error messages if found
-
-
if (strpos($main, $word_a) === false)
-
{
-
$errors[] = "Our Systems Detected that this is not a valid blogger/myspace template - Missing <html> tag";
-
}
-
-
if (strpos($main, $word_a) !== false)
-
{
-
echo "Your success messages or you could leave it blank";
-
}
-
-
if (strpos($main, $word_b) === false)
-
{
-
$errors[] = "Our Systems Detected that this is not a valid blogger/myspace template - Missing </html> tag";
-
}
-
-
if (strpos($main, $word_b) !== false)
-
{
-
echo "Your success messages or you could leave it blank";
-
}
-
?>
-
i hope this helps...let me know if not
Woa, that's awesome, I have to finish a few coding here, after it, I'll use ur script and let u know. Thx a lot :D
Bebore using it, have to insert a scroll bar, but is it possible to do that as php?
to insert a scroll bar using php?...if yes i don't think that's necessary insert your scroll bar using html and css. is the code working fine?
I still haven't tested it. I'm having an issue with the submitted content, it has to be inside a scroll bar after submitted, because it takes too much space.
may be this may work for you
the html - <div class=sub_content"><?php echo $submitted_content; ?></div
the css - .sub_content
-
{
-
overflow: scroll;
-
max-width: specify the width you want here eg 500px;
-
max-height: specify the height you want here eg 350px;
-
}
-
that should fix it for you.
am from nigeria...where are you?
Currently Brazil.
I still haven't used your script because I haven't fixed the form issue, thought it was just the scroll bar, inserted it, but there is another bug now, can I pm you?
Sorry, it's been 1 week since my last reply, I'm not being able to use ur script, it wont show the error messages.
give me your full source code and how you implemented the script let me find out why there is no error message
The text comes from a textarea tag - <?php
-
-
-
-
/**
-
-
-
-
* Elgg bloggertemplates Plugin
-
-
-
-
* @package bloggertemplates
-
-
-
-
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-
-
-
-
* @author slyhne
-
-
-
-
* @copyright slyhne 2010-2011
-
-
-
-
* @link www.zurf.dk/elgg
-
-
-
-
* @version 1.8
-
-
-
-
*/
-
-
-
-
-
-
-
-
// Get plugin settings
-
-
-
-
$allowhtml = elgg_get_plugin_setting('bloggertemplates_allowhtml', 'bloggertemplates');
-
-
-
-
$currency = elgg_get_plugin_setting('bloggertemplates_currency', 'bloggertemplates');
-
-
-
-
$numchars = elgg_get_plugin_setting('bloggertemplates_numchars', 'bloggertemplates');
-
-
-
-
if($numchars == ''){
-
-
-
-
$numchars = '250';
-
-
-
-
}
-
-
-
-
-
-
-
-
// Set title, form destination
-
-
-
-
$title = elgg_echo("bloggertemplates:addpost");
-
-
-
-
$tags = "";
-
-
-
-
$title = "";
-
-
-
-
$price = "";
-
-
-
-
$custom = "";
-
-
-
-
$description = "";
-
-
-
-
if (defined('ACCESS_DEFAULT')) {
-
-
-
-
$access_id = ACCESS_DEFAULT;
-
-
-
-
} else {
-
-
-
-
$access_id = 0;
-
-
-
-
}
-
-
-
-
-
-
-
-
// Just in case we have some cached details
-
-
-
-
if (isset($vars['bloggertemplatestitle'])) {
-
-
-
-
$title = $vars['bloggertemplatestitle'];
-
-
-
-
$body = $vars['bloggertemplatesbody'];
-
-
-
-
$price = $vars['bloggertemplatesprice'];
-
-
-
-
$custom = $vars['bloggertemplatescustom'];
-
-
-
-
$tags = $vars['bloggertemplatestags'];
-
-
-
-
}
-
-
-
-
-
-
-
-
-
-
-
-
?>
-
-
-
-
<script type="text/javascript">
-
-
-
-
function textCounter(field,cntfield,maxlimit) {
-
-
-
-
// if too long...trim it!
-
-
-
-
if (field.value.length > maxlimit) {
-
-
-
-
field.value = field.value.substring(0, maxlimit);
-
-
-
-
} else {
-
-
-
-
// otherwise, update 'characters left' counter
-
-
-
-
cntfield.value = maxlimit - field.value.length;
-
-
-
-
}
-
-
-
-
}
-
-
-
-
function acceptTerms() {
-
-
-
-
error = 0;
-
-
-
-
if(!(document.bloggertemplatesForm.accept_terms.checked) && (error==0)) {
-
-
-
-
alert('<?php echo elgg_echo('bloggertemplates:accept:terms:error'); ?>');
-
-
-
-
document.bloggertemplatesForm.accept_terms.focus();
-
-
-
-
error = 1;
-
-
-
-
}
-
-
-
-
if(error == 0) {
-
-
-
-
document.bloggertemplatesForm.submit();
-
-
-
-
}
-
-
-
-
}
-
-
-
-
</script>
-
-
-
-
<?php
-
-
-
-
echo "<label>";
-
-
-
-
echo elgg_echo("title");
-
-
-
-
echo " <small><small>" . elgg_echo("bloggertemplates:title:help") . "</small></small><br />";
-
-
-
-
echo elgg_view("input/text", array(
-
-
-
-
"name" => "bloggertemplatestitle",
-
-
-
-
"value" => $title,
-
-
-
-
));
-
-
-
-
echo "</label></p>";
-
-
-
-
-
-
-
-
$bloggertemplatescategories = elgg_view('bloggertemplates/bloggertemplatescategories',$vars);
-
-
-
-
if (!empty($bloggertemplatescategories)) {
-
-
-
-
echo "<p>{$bloggertemplatescategories}</p>";
-
-
-
-
}
-
-
-
-
-
-
-
-
if(elgg_get_plugin_setting('bloggertemplates_custom', 'bloggertemplates') == 'yes'){
-
-
-
-
$bloggertemplatescustom = elgg_view('bloggertemplates/custom',$vars);
-
-
-
-
if (!empty($bloggertemplatescustom)) {
-
-
-
-
echo "<p>{$bloggertemplatescustom}</p>";
-
-
-
-
}
-
-
-
-
}
-
-
-
-
-
-
-
-
echo "<p><label>" . elgg_echo("bloggertemplates:text") . "<br>";
-
-
-
-
if ($allowhtml != 'yes') {
-
-
-
-
echo "<small><small>" . sprintf(elgg_echo("bloggertemplates:text:help"), $numchars) . "</small></small><br />";
-
-
-
-
echo "<textarea name='bloggertemplatesbody' class='mceNoEditor' rows='8' cols='40' onKeyDown='textCounter(document.bloggertemplatesForm.bloggertemplatesbody,document.bloggertemplatesForm.remLen1,{$numchars}' onKeyUp='textCounter(document.bloggertemplatesForm.bloggertemplatesbody,document.bloggertemplatesForm.remLen1,{$numchars})'>{$body}</textarea><br />";
-
-
-
-
echo "<div class='bloggertemplates_characters_remaining'><input readonly type='text' name='remLen1' size='3' maxlength='3' value='{$numchars}' class='bloggertemplates_charleft'>" . elgg_echo("bloggertemplates:charleft") . "</div>";
-
-
-
-
} else {
-
-
-
-
echo elgg_view("input/text", array("name" => "bloggertemplatesbody", "value" => $body));
-
-
-
-
}
-
-
-
-
echo "</label></p>";
-
-
-
-
-
-
-
/*
-
echo "<p><label>" . elgg_echo("bloggertemplates:price") . " <small><small>" . elgg_echo("bloggertemplates:price:help", array($currency)) . "</small></small><br />";
-
-
-
-
echo elgg_view("input/text", array(
-
-
-
-
"name" => "bloggertemplatesprice",
-
-
-
-
"value" => $price,
-
-
-
-
));
-
-
-
-
-
-
-
-
echo "</label></p>";
-
*/
-
-
-
-
-
-
-
echo "<p><label>" . elgg_echo("bloggertemplates:tags") . " <small><small>" . elgg_echo("bloggertemplates:tags:help") . "</small></small><br />";
-
-
-
-
echo elgg_view("input/tags", array(
-
-
-
-
"name" => "bloggertemplatestags",
-
-
-
-
"value" => $tags,
-
-
-
-
));
-
-
-
-
echo "</label></p>";
-
-
-
-
-
-
-
-
echo "<p><label>" . elgg_echo("bloggertemplates:uploadimages") . "<br /><small><small>" . elgg_echo("bloggertemplates:imagelimitation") . "</small></small><br />";
-
-
-
-
echo elgg_view("input/file",array('name' => 'upload'));
-
-
-
-
echo "</label></p>";
-
-
-
-
-
-
-
-
echo "<p><label>" . elgg_echo('access') . " <small><small>" . elgg_echo("bloggertemplates:access:help") . "</small></small><br />";
-
-
-
-
echo elgg_view('input/access', array('name' => 'access_id','value' => $access_id));
-
-
-
-
echo "</label></p>";
-
-
-
-
-
-
-
-
echo "<p>";
-
-
-
-
// Terms checkbox and link
-
-
-
-
$termslink = elgg_view('output/url', array(
-
-
-
-
'href' => "mod/bloggertemplates/terms.php",
-
-
-
-
'text' => elgg_echo('bloggertemplates:terms:title'),
-
-
-
-
'class' => "elgg-lightbox",
-
-
-
-
));
-
-
-
-
$termsaccept = sprintf(elgg_echo("bloggertemplates:accept:terms"),$termslink);
-
-
-
-
echo "</p>";
-
-
-
-
echo "<input type='checkbox' name='accept_terms'><label>{$termsaccept}</label></p>";
-
-
-
-
-
-
-
-
echo elgg_view('input/submit', array('name' => 'submit', 'text' => elgg_echo('save')));
-
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Daniel Ruscoe |
last post by:
Hi chaps,
I'm relatively new to the language, but I want to create a simple order
form using PHP and cookies. Please let me know if there's a better way
in this situation, database isn't...
|
by: Batezz |
last post by:
I have created a form (below)
How do I stop it redirecting to another page (productsearchresults.php) when
form is submitted if both the fields are blank?
Any help appreciated.
Batezz
|
by: Eric |
last post by:
Hey Everyone..
I have a form that has approximately 7 text fields and 1 checkbox.
Generally when this form is submitted(to itself BTW) it works fine,
however, when the checkbox is only field...
|
by: jwa6 |
last post by:
I have a user/pc specific problem in access.
This doesn't occur on any other ( windows xp pc) that I have used the
..mbd on.
This involves a query that's using a range of dates as a parm. This...
|
by: karen987 |
last post by:
I have a form on a html page which one fills in and submits using email.
The form has been opened in a pop up page,
Once the form has been submitted, (emailed) I need to add some javasript...
|
by: mckbill |
last post by:
Is there a way I can direct the cursor to a specific field (variable)
in a form by typing the field name while in form view?
I have a form with many fields, and it would be nice if there were...
|
by: Francesco Pietra |
last post by:
I forgot to add that the lines to strip are in present case of the type of the
following block
HETATM 7007 O WAT 446 27.622 34.356 55.205 1.00 0.00 O
HETATM 7008 H1 WAT...
|
by: Deccypher |
last post by:
Hi I am trying to give my customers an option to save favorite products for easy storage and reorderig.
it works great and on the single item add to cart i have no problem, how ever i would also...
|
by: Palehorse |
last post by:
I'd like to apologize upfront for me saying "I'm not a programer", I'm sure you all hear this a hundred times a day. Unfortunately, in this case, it's true. I've been working on trying to figure out...
|
by: Ron Mowry |
last post by:
I am wanting to create a macro that will fill a specific field on a form and then go to the next record set. I have a blank field in the table that the form is pulling from. I want the user to be...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |