Forum Moderators: coopster
if (!isset($_SESSION['signed-in-variable'])) {echo 'you must be signed in to do that!';}
else if (!isset($_SESSION['signed-in-permission'])) {echo 'you do not have permission to do that!';}
else if (!isset($_POST['required'])) {echo 'you are missing form data!';}
else if (strlen($_POST['title'])<16) {echo 'your title is too short';}
else
{
//do the intended actions here
}
if (isset($_SESSION['signed-in-variable']))
{
if ($_SESSION['signed-in-permission']<128)
{
if (isset($_POST['required']))
{
if (strlen($_POST['title'])<16)
{
//do the intended actions here
}
else {echo 'your title is too short';}
}
else {echo 'you are missing form data!';}
}
else {echo 'you do not have permission to do that!';}
}
else {echo 'you must be signed in to do that!';}
#check args/assertions/etc..
#if not met, return/exit/etc...
#do useful work here
$required_args = array(
"func1" => array("param1", "param2", "param3"),
"func2 => array("param1", "param3")
);
$diff = array_diff($required_args[$func], $arguments);
if(!empty($diff))
{
printf("You are missing the following required arguments: %s", implode(',',$diff))
exit; //or return, whichever
}
// do useful code here
if (!isset($_SESSION['signed-in-variable'])) {echo 'you must be signed in to do that!';}
else if (!isset($_SESSION['signed-in-permission'])) {echo 'you do not have permission to do that!';}
else if (!isset($_POST['required'])) {echo 'you are missing form data!';}
else if (strlen($_POST['title'])<16) {echo 'your title is too short';}
else
{
//do the intended actions here
}
...or...
if (isset($_SESSION['signed-in-variable']))
{
if ($_SESSION['signed-in-permission']<128)
{
if (isset($_POST['required']))
{
if (strlen($_POST['title'])<16)
{
//do the intended actions here
}
else {echo 'your title is too short';}
}
else {echo 'you are missing form data!';}
}
else {echo 'you do not have permission to do that!';}
}
else {echo 'you must be signed in to do that!';}
if (!isset($_SESSION['signed-in-variable'])) {
echo 'you must be signed in to do that!';
} else if (!isset($_SESSION['signed-in-permission'])) {
echo 'you do not have permission to do that!';
} else if (!isset($_POST['required'])) {
echo 'you are missing form data!';
} else if (strlen($_POST['title'])<16) {
echo 'your title is too short';
} else {
//do the intended actions here
}
if (isset($_SESSION['signed-in-variable'])) {
if ($_SESSION['signed-in-permission']<128) {
if (isset($_POST['required'])) {
if (strlen($_POST['title'])<16) {
//do the intended actions here
} else {
echo 'your title is too short';
}
} else {
echo 'you are missing form data!';
}
} else {
echo 'you do not have permission to do that!';
}
} else {
echo 'you must be signed in to do that!';
}
if (!isset($_SESSION['signed-in-variable'])) {
echo 'you must be signed in to do that!';
} else if (!iss..... I see brackets on individual lines (where not necessary to be on seperate line) as a beginners trait and big waste of space/lines, especially when you get in to bigger programs it's hideous.
function func_name()
{
}