Jump to content

Recommended Posts

On my code, about lines 35-53, I did this:

 

	if($action==1)
	{
		$number_messages = $_POST['number'];
		$message = $_POST['message'];

		if($number_messages < 200)
		{
			echo "The maximum message amount is 200.";
		}
		else
		{
		echo "Your message has been duplicated by ". $number_messages ." times.<br/><br/>";

		for($i = 0; $number_messages > $i; $i++)
		{
			echo $message."<br/>";
		}
		}
	}

 

If $number_messages is above 200, it still doesn't say you've exceeded the maximum. The full code is right here:

 

<?php

echo "<center><a href='index.php'>Home</a> | <a href='index.php?page=1'>BBcode to HTML</a> | <a href='index.php?page=2'>Make a big message</a></center><hr>";

$page = $_GET['page'];
$page_p = $_POST['page'];
$action = $_POST['action'];


if(!$page && !$page_p)
{
	echo "Welcome to our site! On this site you can find a varity of cool scripts that can help you on certain things, or just entertain you. ";
}
elseif($page==1 || $page_p==1)
{
	echo "You can easily use this script to change forum BBCodes into HTML.<br/><br/>";

	if($action==1)
	{
		$before = $_POST['before'];
		$change_this = array('[b]','[b]','[/b]','[/b]','[img=','[img]',']', '[/img]');
		$after = array('<b>', '<b>', '</b>','</b>','<img src="', '<img src="','">', '">');
		$output = str_replace($change_this, $after, $before);
		echo "Before: ". $before ."<br/><br/><br/>After </br><textarea rows='30' cols='100'>". $output ."</textarea>";
	}
	else
	{
	echo "<form action='index.php' method='POST'>BBCode Text<br/>
	<input type='hidden' name='action' value='1'><input type='hidden' name='page' value='1'>
	<textarea name='before' cols='70' rows='20'></textarea><br/><input type='submit'></form>";
	}
}
elseif($page==2 || $page_p==2)
{
	if($action==1)
	{
		$number_messages = $_POST['number'];
		$message = $_POST['message'];

		if($number_messages < 200)
		{
			echo "The maximum message amount is 200.";
		}
		else
		{
		echo "Your message has been duplicated by ". $number_messages ." times.<br/><br/>";

		for($i = 0; $number_messages > $i; $i++)
		{
			echo $message."<br/>";
		}
		}
	}
	else
	{
		echo "<form action='index.php' method='POST'>Message: <input type='text' name='message' maxlength='50'> Number: <input type='text' name='number' length='10'>
		<input type='hidden' name='page' value='2'><input type='hidden' name='action' value='1'><input type='submit' value='Create'>
		</form>";
	}
}
else
{
	echo "Your on an unknown page.";
}

if(!$page && !$page_p)
{
	echo "<br/><br/><br/>Your currently on the main page.";
}
elseif(!$page && $page_p)
{
	echo "<br/><br/><br/><br/>Your currently on page ".$page_p;
}
elseif(!$page_p && $page)
{
	echo "<br/><br/><br/><br/>Your currently on page ".$page;
}
else
{
	echo "<br/><br/><br/>Your currently on an unknown page.";
}
?>

if($number_messages > 200)

 

I'm not checking to see if they entered in something smaller. I'm trying to see if they entered in something greater than 200, and if they did, it gives them the error message. Else, everything works and they don't get an error message.

dude, its checking if the string is GREATER than 200...

 

Thats what I want it to do. I want it to check and see if they typed in a number greater than 200, if they did, give them the error message. But when I keep trying it on my website, it doesn't work.

> equals "greater than"

< equals "less than"

 

The point always points at the lower value.

if($number_messages < 200)
{
echo "The maximum message amount is 200."; //IF $number_messages is LESS THAN 200, print this message.
}

But by your account jcbones, the users would be seeing that maximum message ammount error until they hit 200 messages..  which will be never since its an error..  so his checking of greater than is correct.  because he wants to find messages above 200 not below 200.

But by your account jcbones, the users would be seeing that maximum message ammount error until they hit 200 messages..  which will be never since its an error..  so his checking of greater than is correct.  because he wants to find messages above 200 not below 200.

well said
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.