Jump to content

Archived

This topic is now archived and is closed to further replies.

pedromau

login and send mailing list

Recommended Posts

Hi people!
I'm pretty new to php, so I'm a little blind right now!
I'm using a login system (in flash that loads variables) to show some content in a page, in this case, a mailing list sender. The user and pass are defined in the php.
Ok... till here everything goes fine!
But then, after the content is shown, when I press the button to send the mailing list, I get the error as if I failed in the log in, instead of showing the echo that confirms the malinglist send.

Can someone take a look and tell me what is wrong?! If I use the content hidden in the php by it self, it works fine.
Sorry the English...I'm Portuguese

here's the code:
<?php


$username[1] = "user";
$password[1] = "userpass";

$username[2] = "";
$password[2] = "";

$username[3] = "";
$password[3] = "";

$username[4] = "";
$password[4] = "";

$username[5] = "";
$password[5] = "";

$username[6] = "";
$password[6] = "";

$username[7] = "";
$password[7] = "";

$username[8] = "";
$password[8] = "";

$username[9] = "";
$password[9] = "";

$username[10] = "";
$password[10] = "";

$user = $HTTP_POST_VARS['name'];
$pass = $HTTP_POST_VARS['pass'];



function error ($error_message) {


echo $error_message."<BR>";


exit;

}


if ($user == null || $pass == null) {
header("HTTP/1.0 401 Unauthorized");

error("Não tem permissão para aceder a esta área!!!");
}
else {

if (
$user == $username[1] && $pass == $password[1] ||
$user == $username[2] && $pass == $password[2] ||
$user == $username[3] && $pass == $password[3] ||
$user == $username[4] && $pass == $password[4] ||
$user == $username[5] && $pass == $password[5] ||
$user == $username[6] && $pass == $password[6] ||
$user == $username[7] && $pass == $password[7] ||
$user == $username[8] && $pass == $password[8] ||
$user == $username[9] && $pass == $password[9] ||
$user == $username[10] && $pass == $password[10]
) {
}else {
header("HTTP/1.0 401 Unauthorized");

error("Não tem permissão para aceder a esta área!!!");


}
}
?>

<!-- Add code of your web page here -->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Freira Bar - Mailing List - Envio de Mensagem</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="author" content="TheXL (2006)">
<meta name="description" content="Very simple Mailscript">
<style type="text/css">
.style8 {background-color: inherit; color: #ff0000; font-size: 9px; font-family: Verdana, Arial, Helvetica, sans-serif; }
body {
background-color: #990000;
}
.style12 {
color: #000000;
font-size: 9px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style14 {background-color: inherit; color: #ff0000; font-size: 9px; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; }
</style>
</head>
<body topmargin="0">
<table width="424" border="0" align="center">
<tr>
<td width="526">
<?
$openmail = fopen("freira_maillist.txt", "r");
$bcc = fgets($openmail);
$to2 = eregi_replace(" ","<br>",$bcc);
$subject = $_REQUEST["subject"];
$data = $_REQUEST["content"];
$sig = $_REQUEST["sig"];
$content = $data."\n\n\n".$sig;
$content2 = eregi_replace("\n","<br>",$content);
$header2 = "From: freirabar@hotmail.com"."\r\n"."Bcc: ".$bcc;
if (!isset($_POST['submit2'])) {
?>
<br>
<br>
<form action="<?php echo $PHP_SELF;?>" method="POST">
<table width="100%">
<tr valign="top">
<td class="rightAlgn">
<span class="style8">De: </span>
</td>
<td class="style12">
&nbsp;<input name="from" type="text" disabled="disabled" class="style12" value="freirabar@hotmail.com" size="50">
</td>
</tr>
<tr valign="top">
<td class="rightAlgn">
<span class="style8">Para:</span>
</td>
<td class="style12">
&nbsp;<input name="to" type="text" disabled="disabled" class="style12" value="Mailing List Freira Bar" size="50">
</td>
</tr>
<tr valign="top">
<td class="rightAlgn">
<span class="style8">Assunto: </span>
</td>
<td class="style12">
&nbsp;<input name="subject" type="text" class="style12" size="50">
</td>
</tr>
<tr valign="top">
<td class="rightAlgn">
<span class="style8">Mensagem:</span>
</td>
<td class="style12">
&nbsp;<textarea name="content" cols="46" rows="15" class="style12"></textarea>
</td>
</tr>
<tr valign="top">
<td class="rightAlgn">
<span class="style8">Ass</span><span class="style8">inat</span><span class="style8">ura:</span>
</td>
<td class="style12">
&nbsp;<textarea name="sig" cols="46" rows="5" class="style12">Freira Bar
---------------------------------
http://www.freirabar.com</textarea>
<br>
<br>
<span class="style10">
<input name="submit2" type="submit" class="style8" value="Enviar">
</span></td>
</tr>
<tr valign="top">
<td colspan="2" class="rightAlgn"><div align="center"><span class="style10"><span class="style14"><br>
ATEN&Ccedil;&Atilde;O!!!</span> <span class="style12">Clique apenas uma vez no bot&atilde;o &quot;</span></span><span class="style14">Enviar</span><span class="style10"><span class="style12">&quot; e aguarde confirma&ccedil;&atilde;o.</span><br>
</span></div></td>
</tr>
</table>
</form>
<?
} else {
mail('no-reply@freirabar.com', $subject, $content, $header2);
echo '<span class="style8"><br><br>Mensagem enviada com sucesso para:</span><br>'.$to2;
echo '<span class="style8"><br><br>Assunto:<br></span>'.$subject;
echo '<span class="style8"><br><br>Mensagem:<br></span>'.$content2;
}
?>
</table>
</BODY></HTML>

Share this post


Link to post
Share on other sites

×

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.