Jump to content

Cpanel email script help!

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
SeanStar

SeanStar

    Learning Programmer

  • Members
  • PipPipPip
  • 32 posts
I've already developed a cpanel api for this, but I'm in need of some help in this area..
Basically I need to put an if statement inside an else if statement.. with an else to something different if the else if statement is incorrect.

It might sound kinda complicated, but in the time that I've been developing php scripts, this has never been an issue. Help, please?

if($_POST['newpass']=="")

{

echo "";

}

else if($_POST['newpass']==$_POST['newpass2'])

{

/* Check if the response is true or false and give an output for each one */

else if($response === false)

{

echo "<center>Email password is invalid!</center>";

}

else

{

echo "<center>New password submitted.</center>";

$xmlapi->api1_query($email.'@'.$emaildomain, "Email", "passwdpop", array($email, $newpass, 0, $cpaneldomain));

/* Then if the post variable newpass doesn't equal newpass2 display this. */

}

else

{

echo "<center>The two new password fields must be the same.</center>";

}


#2
SeanStar

SeanStar

    Learning Programmer

  • Members
  • PipPipPip
  • 32 posts
It's getting late.. I'm probably missing something, maybe a slight mind blank on a work-around.

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
It looks like you're missing some closing braces. Something I find helpful is to get my indentation set up so I can clearly see which if/else/else if statements go together. Then, assuming your editor highlights matching opening/closing braces, it should be a lot easier to see what's going on.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
Feral

Feral

    Programmer

  • Members
  • PipPipPipPip
  • 162 posts
as WingedPanther said you are missing the closing bracket for the if else statement before the following else statement.

<?
if($_POST['newpass']=="")
{
echo "";
}
else if($_POST['newpass']==$_POST['newpass2'])
{
/* Check if the response is true or false and give an output for each one */
else if($response === false)
{
echo "<center>Email password is invalid!</center>";
}
else
{
echo "<center>New password submitted.</center>";
$xmlapi->api1_query($email.'@'.$emaildomain, "Email", "passwdpop", array($email, $newpass, 0, $cpaneldomain));
/* Then if the post variable newpass doesn't equal newpass2 display this. */
}
} //<-- your missing this
else
{
echo "<center>The two new password fields must be the same.</center>";
}