czesc
mam skrypt do wysyłania maill tylko ze wyskakuje mi pare błedów które nie potrafię usunoć prosze o pilną pomoc
<?
require('config.inc.php');
require('functions.inc.php');
// Max execution time of script. This does not include sleep time, so only restricts time
// allowed for mailing.
$type = $_GET['type'];{}
if ($type == 'sub') {
// subscribe address. Actually, all it does is send the confirmation email
if (!preg_match('#^([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+[^\".,?! ])$#i', $addr)) { $err = 'Your email address appears to be invalid.';
}
$f = openfile($cfg['listfile']);
$exists = false;
while ($item = readitem($f)) {
if ($item['addr'] == $addr) {$exists = true;break;}
}
if ($exists) {
$err = 'That address is already subscribed to the list.';
}
}
// send confirmation email
$headers = 'From: '.$cfg['from'];
if ($cfg['headers']) {
foreach ($cfg['headers'] as $val) $headers .= "\n".$val;
}
$headers .= "\n".$cfg['header_plain'];
if (!@mail($addr, $cfg['subj_conf'], sprintf($cfg['msg_conf'], '?type=confirm&email='.urlencode($addr)), $headers)) { $err = 'There was an error sending the confirmation email. Please try again later.';
}
}
// confirmation sent
if (isset($cfg['returnto_conf']) && $cfg['returnto_conf'] != '') { header('Location: '.$cfg['returnto_conf']); }
else {
printf($cfg['template'], 'Awaiting confirmation', 'An email has been sent to your address, '.$addr.', with a URL you must visit to confirm your subscription.'); }
}
else {
// problem with subscription
echoerr($err);
}
}
elseif ($type == 'unsub') {
// unsubscribe address
$f = openfile($cfg['listfile']);
$exists = false;
while ($item = readitem($f)) {
if ($item['addr'] == $addr) {$exists = true;break;}
}
if ($exists) {
delitem($f, $item['id']);
}
else {
$err = 'That address was not found.';
}
// unsubscribe successful
if (isset($cfg['returnto_unsub']) && $cfg['returnto_unsub'] != '') { header('Location: '.$cfg['returnto_unsub']); }
else {
printf($cfg['template'], 'Unsubscribed', 'Your address, '.$addr.' has successfully been unsubscribed from our mailing list.'); }
}
else {
// problem with unsubscription
echoerr($err);
}
}
elseif ($type == 'confirm') {
// subscribe a confirmed address
if (!preg_match('#^([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+[^\".,?! ])$#i', $addr)) { $err = 'Your email address appears to be invalid. If you are pasting the URL from your confirmation email, make sure the URL wasn\'t split into two lines.';
}
$f = openfile($cfg['listfile']);
$exists = false;
while ($item = readitem($f)) {
if ($item['addr'] == $addr) {$exists = true;break;}
}
if ($exists) {
$err = 'That address is already subscribed to the list.';
}
}
// subscribe successful
writeitem($f, $addr);
if (isset($cfg['returnto_sub']) && $cfg['returnto_sub'] != '') { header('Location: '.$cfg['returnto_sub']); }
else {
printf($cfg['template'], 'Subscribed', 'Your address, '.$addr.', is now subscribed to our mailing list!'); }
}
else {
// problem with subscription
echoerr($err);
}
}
function echoerr($err) {
printf($GLOBALS['cfg']['template'], 'Error', '<font color="red">Error: '.$err.'</font>'); }
?>
i ten pokazuje mi błąd
Notice: Undefined index: type in /home/adri/public_html/ok/index.php on line 9 Notice: Undefined index: email in /home/adri/public_html/ok/index.php on line 10
i drugi skrypt
<?
require('config.inc.php');
require('functions.inc.php');
if (isset($_POST['logsub'])) { if ($_POST['uname'] == $cfg['uname'] && $_POST['pword'] == $cfg['pword']) {
$_SESSION['lin'] = true;
}
else {
$err = 'Invalid username or password';
}
}
elseif ($_GET['do'] == 'logout') {
}
// write header
?>
<html>
<head>
<title>txtList admin</title>
<style type="text/css">
body {
font-family: Arial, sans-serif;
font-size: 10pt;
}
td {
font-family: Arial, sans-serif;
font-size: 10pt;
}
.txtbox {
font-family: Arial, sans-serif;
font-size: 10pt;
}
.smalltxt {
font-size: 8pt;
color: #cdcdcd;
}
A {
color: #C43232;
}
.smalltxt A {
color: #cdcdcd;
}
</style>
<script language="JavaScript">
function phelp(pg) {
window.open('admin_help.php?pg='+pg,'help','width=400,height=500,resizable=yes,toolbars=no,scrollbars=yes,status=no');
}
</script>
</head>
<body>
<?
if ($_SESSION['lin']) {
// we are logged in.
function writemenu($item) {
'email' => 'send email',
'archive' => 'email archive',
'newsub' => 'add subscribers',
'list' => 'subscriber list',
'logout' => 'log out'
);
foreach ($items as $a => $b) {
if (isset($str)) $str .= ' · ';else
$str = ''; $str .= ($a == $item)?
'<b>':'<a href="admin.php?do='.$a.'&'.strip_tags(SID
).'">'; $str .= $b;
$str .= ($a == $item)?'</b>':'</a>';
}
return $str;
}
?>
<div style="font-size: 14pt;" align="center">txtList admin</div>
<div align="center"><?=writemenu($_GET['do'])?> · <a href="java script:phelp('<?=$_GET['do']?>')">help</a></div>
<hr width="300" size="1" noshade color="#cdcdcd">
<p>
<?
if ($_GET['do'] == 'email') {
// ---------------------------- EMAIL SUBSCRIBERS
require('admin_email.inc.php');
}
elseif ($_GET['do'] == 'archive') {
// ---------------------------- EMAIL ARCHIVE
require('admin_archive.inc.php');
}
elseif ($_GET['do'] == 'list') {
// ---------------------------- LIST SUBSCRIBERS
require('admin_list.inc.php');
}
elseif ($_GET['do'] == 'newsub') {
// ---------------------------- ADD SUBSCRIBERS
require('admin_newsub.inc.php');
}
else {
// ---------------------------- DISPLAY MENU
?>
<center>You are logged-in. Choose a function from the list above</center>
<p>
<?
?>
<table border="0" cellpadding="0" cellspacing="0" width="400" align="center">
<tr><td>
<p><center><font color="red"><b>Note:</b></font> PHP is running in safe mode. This means txtList
cannot set the script time limit itself.<p>
<?
if (ini_get('max_execution_time') == 0) { ?>
However, currently PHP is not set up to impose a time limit, so this may not be a problem.
<?
}
else {
?>
Your current time limit is
<?=ini_get('max_execution_time')?> seconds. This may not be enough if you
intend to email large numbers of subscribers.
<?
}
?>
</td></tr></table>
<?
}
}
}
elseif ($_GET['do'] == 'logout') {
// ---------------------------- JUST LOGGED-OUT
?>
<div style="font-size: 14pt;" align="center">txtList admin</div>
<hr width="50%" size="1" noshade color="#cdcdcd">
<p>
<div align="center">
You have been logged-out successfully.
<p>
<a href="admin.php">Click here</a> to log-in again.
</div>
<?
}
else {
// ---------------------------- LOGIN FORM
?>
<div style="font-size: 14pt;" align="center">txtList admin</div>
<hr width="50%" size="1" noshade color="#cdcdcd">
<p>
<form name="txtlist" action="admin.php?do=<?=$_GET['do']?>" method="post">
<table border="0" cellpadding="4" cellspacing="0" bgcolor="#efefef" align="center" style="border: #dedede 3px double;">
<?=(isset($err))?
'<tr><td colspan="2" align="center"><font color="red">'.$err.'</font></td></tr>':''?> <tr><td>username:</td><td><input type="text" name="uname" value="" size="20" maxlength="100"></td></tr>
<tr><td>password:</td><td><input type="password" name="pword" value="" size="20" maxlength="100"></td></tr>
<tr><td colspan="2" align="center"><input type="submit" name="logsub" value="login"></td></tr>
</table>
</form>
<?
}
// footer
?>
<br><br><br>
<hr width="300" size="1" noshade color="#cdcdcd">
<div class="smalltxt" align="center">powered by <a href="http://txtbox.co.za/p_txtlist.php">txtList</a> · copyright © 2004, Txtbox</div>
</body>
</html>
wyświetla mi cos takiego
Notice: Undefined index: do in /home/compart1/public_html/ok/admin.php on line 18
Notice: Undefined index: do in /home/compart1/public_html/ok/admin.php on line 79
Notice: Undefined index: do in /home/compart1/public_html/ok/admin.php on line 84 Notice: Undefined index: do in /home/compart1/public_html/ok/admin.php on line 88 Notice: Undefined index: do in /home/compart1/public_html/ok/admin.php on line 92 Notice: Undefined index: do in /home/compart1/public_html/ok/admin.php on line 96