php halp plez

Status
Not open for further replies.

Macemore

Circumcised pineapples
Aug 26, 2011
1,681
819
Stupid emaily thingy is broken, here's my error:
Parse error: syntax error, unexpected T_ELSE in /home/ubrltcom/public_html/send.php on line 25
Source codes:
PHP:
<?php
 
# Variables #
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: [email protected]' . "\r\n";
$headers .= 'From: [email protected]' . "\r\n";
$usr = $_POST['usr'];
$req = $_POST['req'];
$desc = $_POST['desc'];
$res = $_POST['res'];
$email = $_POST['mail'];
$subject = 'New request';
 
$message = "<html><body><body><h1>New Request</h1><><p>Username: ".$usr."</p><p>Request: ".$req."</p><p>Description: ".$desc."</p><p>Reason: ".$res."</p><p>Email: ".$email."</p>";
 
if(isset($usr)) {
    if(isset($req)) {
        if(isset($desc)) {
            if(isset($res)) {
                if(isset($email)) {
                    mail("[email protected]", $subject, $message, $headers);
                } else {
                echo "You did not specify an email, please go back and try again";
            } else {
            echo "You did not specify a reason, please go back and try again";
        } else {
        echo "You did not specify a description, please go back and try again";
    } else {
    echo "You did not specify a request, please go back and try again";
} else {
echo "You did not specify a username, please go back and try again";
echo "<div class='mainbox'><div class='mainheader'><div class='headerlefttext'>Welcome to ub3rl33t.</div></div><div class='text'>Email successfuly sent<div class='startheader'><div class='headerlefttext'>Other:</div></div>Nothing here to see.</div>";
// header("Location: http://ub3rl33t.net/");
?>

Line 25:
PHP:
            } else {


Any help is greatly appreciated.
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,132
2,457
You also aren't closing this ones:

Code:
if(isset($usr)) {
    if(isset($req)) {
        if(isset($desc)) {
            if(isset($res)) {
and ofcourse this one, but ThomasJamesHeeney already said that:
Code:
else {
echo "You did not specify a username, please go back and try again";
echo "<div class='mainbox'><div class='mainheader'><div class='headerlefttext'>Welcome to ub3rl33t.</div></div><div class='text'>Email successfuly sent<div class='startheader'><div class='headerlefttext'>Other:</div></div>Nothing here to see.</div>";
// header("Location: http://ub3rl33t.net/");
?>
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
Underneath each if statement you haven't ended them.

What you're looking for is this:

PHP:
<?php
 
# Variables #
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: [email protected]' . "\r\n";
$headers .= 'From: [email protected]' . "\r\n";
$usr = $_POST['usr'];
$req = $_POST['req'];
$desc = $_POST['desc'];
$res = $_POST['res'];
$email = $_POST['mail'];
$subject = 'New request';
 
$message = "<html><body><body><h1>New Request</h1><><p>Username: ".$usr."</p><p>Request: ".$req."</p><p>Description: ".$desc."</p><p>Reason: ".$res."</p><p>Email: ".$email."</p>";
 
if(isset($usr)) {
    if(isset($req)) {
        if(isset($desc)) {
            if(isset($res)) {
                if(isset($email)) {
                    mail("[email protected]", $subject, $message, $headers);
                } else {
                echo "You did not specify an email, please go back and try again";
                }
            } else {
            echo "You did not specify a reason, please go back and try again";
            }
        } else {
        echo "You did not specify a description, please go back and try again";
        }
    } else {
    echo "You did not specify a request, please go back and try again";
    }
} else {
echo "You did not specify a username, please go back and try again";
echo "<div class='mainbox'><div class='mainheader'><div class='headerlefttext'>Welcome to ub3rl33t.</div></div><div class='text'>Email successfuly sent<div class='startheader'><div class='headerlefttext'>Other:</div></div>Nothing here to see.</div>";
}
// header("Location: http://ub3rl33t.net/");
?>
 

Macemore

Circumcised pineapples
Aug 26, 2011
1,681
819
Underneath each if statement you haven't ended them.

What you're looking for is this:

PHP:
<?php
 
# Variables #
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: [email protected]' . "\r\n";
$headers .= 'From: [email protected]' . "\r\n";
$usr = $_POST['usr'];
$req = $_POST['req'];
$desc = $_POST['desc'];
$res = $_POST['res'];
$email = $_POST['mail'];
$subject = 'New request';
 
$message = "<html><body><body><h1>New Request</h1><><p>Username: ".$usr."</p><p>Request: ".$req."</p><p>Description: ".$desc."</p><p>Reason: ".$res."</p><p>Email: ".$email."</p>";
 
if(isset($usr)) {
    if(isset($req)) {
        if(isset($desc)) {
            if(isset($res)) {
                if(isset($email)) {
                    mail("[email protected]", $subject, $message, $headers);
                } else {
                echo "You did not specify an email, please go back and try again";
                }
            } else {
            echo "You did not specify a reason, please go back and try again";
            }
        } else {
        echo "You did not specify a description, please go back and try again";
        }
    } else {
    echo "You did not specify a request, please go back and try again";
    }
} else {
echo "You did not specify a username, please go back and try again";
echo "<div class='mainbox'><div class='mainheader'><div class='headerlefttext'>Welcome to ub3rl33t.</div></div><div class='text'>Email successfuly sent<div class='startheader'><div class='headerlefttext'>Other:</div></div>Nothing here to see.</div>";
}
// header("Location: http://ub3rl33t.net/");
?>
Thanks I realized that after what Craig said.
 
Status
Not open for further replies.

Users who are viewing this thread

Top