I have a post form for a submission i have limited it to 160 characters
how would i ensure when the submit.php gets the post information that it’s limited to 160 characters
I have a post form for a submission i have limited it to 160 characters
how would i ensure when the submit.php gets the post information that it’s limited to 160 characters
in javascript you can check using string.length and in php you can check using strlen($string)
This is the fix i have used but it shows an error from another post form field so gotta suppress that some how
$count = mb_strlen($message);
if ($count<"161")
{
// Continue if 160 Chars
}
else
{
echo "<br>Failed...Nice Try Butt Munch";
exit();
}
remove double quotes of 161, its numeric value
$count = mb_strlen($message);
if ($count < 161)
{
// Continue if 160 Chars
}
else
{
echo "<br>Failed...Nice Try Butt Munch";
exit();
}
thank you very much for that
when i use tampa data to try and set the post value for something over the 160chars i am getting
Notice: Undefined index: sender in /var/zpanel/hostdata/zadmin/public_html/yoursite/login/submitphp on line 28
Failed...Nice Try Butt Munch
anyway i can suppress the error there?
Show us the code.
//initilize PHP
if ( isset ( $_POST['newsms'] ) ) //If submit is hit
{
// Grab the post fields
$to = $_POST['to'];
$message = $_POST['message'];
$from = $_POST['sender'];
$id = $_POST['id'];
$user = $_POST['user'];
$count = mb_strlen($message);
if ($count < 161)
{
// Continue if 160 Chars
}
else
{
echo "<br>Failed...Nice Try Butt Munch";
exit();
}
when i submit normally when it’s correct the sender post information is fine and works it’s only when using tamper data it messess up
$_POST[‘sender’]; doesn’t exist. Do you have the name of the form field correct?
further down the script
$sender is called
$sender = urlencode ($from);
so when some one submits the sender on the main page that is then captured as $from and then urlencoded and the variable then becomes $sender.
the weird thing is that the script works perfectly its only this if statement at the top that fails when i submit over 160 chars
Wrong variable. Your $_POST[‘sender’] which is being placed in $from does not exist. That is what the notice means. So your “$from” variable is empty.