首页 > 开发 > PHP > 正文

转载老外编写的一个maillist源代码

2024-05-04 22:55:10
字体:
来源:转载
供稿:网友

    



admin.php3

<?
    include("layout.inc.php3");
    include("config.inc.php3");
    include("./lang/$language.inc.php3");
    print_header("$admin_name");
    print_navbar();
    $string=implode($argv," ");
    $string2=explode("&",$string);    
    if($string=='')
{
echo"
     <p align=center>$program_name version: $ver<br><br>administration:</p>
     <form method=post action=/"admin.php3?admin/">
     <table border=0 width=50%>
     <tr><td>$admin_username:</td><td><input type=text name=adminuser1></td></tr>
     <tr><td>$admin_password:</td><td><input type=password name=adminpass1></td></tr>
     <tr><td></td><td><input type=submit value=/"$send/"><input type=reset value=$reset></td></tr>
     </table>
     </form>
    ";
}

    else if($string=='admin')
{
if($adminuser1==$adminuser)
    {
    if($adminpass1==$adminpass)
{
echo"
     <p align=center>$admin_name:</p>
     <a href=/"admin.php3?send&$adminuser1&$adminpass1/">$send_mail</a><br><br>
     <a href=/"admin.php3?users&$adminuser1&$adminpass1/">$show_users</a><br><br>
     <a href=/"admin.php3?delall&$adminuser1&$adminpass1/">$del_table</a><br><br>
     <a href=/"tablecreator.php3/">$create_table</a>
    ";
}
else { echo"$noaccess"; }
    }
    else { echo"$noaccess"; }
}

    else if($string2[0]=='delall')
{
if($string2[1]==$adminuser)
    {
    if($string2[2]==$adminpass)
{
$query="drop table $maillist_table";
mysql_db_query($database_name,$query,$conn) or die("$cant_del_table");
echo"$table_deleted";
}
else { echo"$noaccess"; }
    }
    else { echo"$noaccess"; }
        }

    else if($string2[0]=='users')
{
if($string2[1]==$adminuser)
    {
    if($string2[2]==$adminpass)
{
echo"
      $headline_users<br><br>
      <table border=0 width=100% cellspacing=1><tr bgcolor=/"#000084/"><td width=25%>name:</td><td width=25%>$prename:</td><td width=25%>e-mail</td><td width=25%> </td></tr>
      ";
      $query="select * from $maillist_table";
      $result=mysql_db_query($database_name,$query,$conn) or die("$database_error");
      while($data=mysql_fetch_row($result))
          {
  echo"<tr bgcolor=/"#0000a0/"><td>$data[0]</td><td>$data[1]</td><td>$data[2]</td><td><a href=/"admin.php3?deluser&$string2[1]&$string2[2]&$data[2]/">$delete</td></tr>";
  }
echo"
     </table>
    ";       
      
     
}
else { echo"$noaccess"; }
    }
    else { echo"$noaccess"; }
        }

    else if($string2[0]=='deluser')
{
if($string2[1]==$adminuser)
    {
    if($string2[2]==$adminpass)
{
$query="delete from $maillist_table where email='$string2[3]'";
mysql_db_query($database_name,$query,$conn) or die("$string2[3] $could_not_be_deleted");
echo"$string2[3] has_been_deleted";
}
else { echo"$noaccess"; }
    }
    else { echo"$noaccess"; }
        }

  
    else if($string2[0]=='send')
{
if($string2[1]==$adminuser)
    {
    if($string2[2]==$adminpass)
{
         echo"
      $send_mail:<br><br>
              <form method=post action=admin.php3?sendmail&$string2[1]&$string2[2]>
              $topic:<br><input type=text name=subject><br>
              $message:<br><textarea rows=20 cols=50 name=text wrap=physical></textarea><br>
      <input type=submit value=/"$send/"><input type=reset value=/"$reset/">
     ";
}
else { echo"$noaccess"; }
    }
    else { echo"$noaccess"; }
        }

else if($string2[0]=='sendmail')
{
if($string2[1]==$adminuser)
    {
    if($string2[2]==$adminpass)
{
                $query="select * from $maillist_table";
                $result=mysql_db_query($database_name,$query,$conn) or die("$database_error");
                while($data=mysql_fetch_row($result))
                        {
                        mail("$data[2]","$subject","$text","from: $from/nx-mailer: $mailer/nreply-to: $reply/n") or die("$send_error");
}
                        echo"
                     $xxx_has_been_sent:<br><br>
                     $topic:<br>
                             $subject<br>
                             $message:<br>
                             $text<br>
                    ";
}
else { echo"$noaccess"; }
    }
    else { echo"$noaccess"; }
        }
    
    print_back();
    print_footer();
?>



english.inc.php3
<?
$mailadd_text="if you are in our newsletter, you get an e-mail with informations
       about our homepage every month. just fill in the following form.<br>to unsubscribe click";

$remember_pass="please remember your password, otherwise, you can't delete your mailadress from the list";
$wrong_mail="you've entered a bad e-mail adress";
$admin_name="newsletter administration";
$program_name="newsletter-manager";
$admin_username="admin-username";
$admin_password="admin-password";
$send="submit";
$reset="reset";
$noaccess="access denied";
$send_mail="send a mail to the list";
$show_users="show/delete members";
$del_table="delete table $maillist_table";
$create_table="create table $maillist_table";
$cant_del_table="can't delete table $maillist_table";
$table_deleted="table $maillist_table has been deleted";
$headline_users="every user on one place:";
$prename="prename";
$database_error="error on database: $database_name";
$delete="delete";
$could_not_be_deleted="could not be deleted";
$has_been_deleted="has been deleted";
$topic="topic";
$message="message";
$send_error="send error";
$xxx_has_been_sent="the following has been sent";
$already_there="you are already in the list!!!";
$xxx_has_been_entered="the following has been entered";
$password="password";
$cant_find_entry="can't find entry!";
$isnt_in_db="$email is not entered in the database";
$error_del="error while trying to delete";
$entry_del="entry has been deleted";
$here="here";
$click="";
$all_fields_must_be_edited="error! all fields have to be filled in completely!";
?>


tablecreator.php3
<?

include"layout.inc.php3";
include"config.inc.php3";
print_header("create table $maillist_table");
print_navbar();
$query="create table $maillist_table
        (name char (50) not null , vorname char (50) not null ,
email char (255) not null , pass char (10) not null ,
primary key (email), index (email), unique (email))";

mysql_db_query($database_name,$query,$conn) or die("could not create table");
echo"table /"$maillist_table/" has been created";
print_back();
print_footer();
?>

index.php3
<?

/******************************************************************************/
/*       */
/* mailinglisten-manager       */
/*        */
/* by: marcel beerta         */
/* http://www.supertown.de/computer/mazen/       */
/* [email protected]               */
/*       */
/******************************************************************************/

    include "config.inc.php3";    
    include "./lang/$language.inc.php3";    
    include "layout.inc.php3";

print_header("$program_name");
        print_navbar();
    $string=implode($argv," ");

if ($string=='add')
    {
     if($name&&$prename&&$email&&$pw)
     {
    $query="insert into $maillist_table(name,vorname,email,pass) values('$name','$vorname','$email','$pw')";
    mysql_db_query($database_name,$query,$conn) or die("$already_there");

    echo"
$xxx_has_been_entered<br><br>
         name: $name<br>
         $prename: $vorname<br>
         e-mail: $email<br>
         $password: $pw<br><br>
$remember_pass<br>
";
}
else
{
echo"$all_fields_must_be_edited";
}

}
    

else if($string=='delete')
    {
    echo"
<form method=post action=/"index.php3?delme/">
<table border=0 align=left cellspacing=0 width=50%>
<tr><td>e-mail:</td><td><input type=text name=email></td></tr>
<tr><td>$password:</td><td><input type=text name=pw></td></tr>
<tr><td><input type=submit value=/"$send/"></td><td></td></tr>
</table>
</form><br><br><br><br><br><br><br>
";

    }
else if($string=='delme')
    {
    $query1="select * from $maillist_table where $maillist_table.email like '$email'";
    $result=mysql_db_query($database_name,$query1,$conn) or die("$cant_find_entry");
    $data=mysql_fetch_row($result) or die("$isnt_in_db<br><br>");
    if($data[3]==$pw)
{
$query="delete from $maillist_table where email='$email'";
mysql_db_query($database_name,$query,$conn) or die("$error_del");
echo"$entry_del";
}
    else
{
echo"$noaccess";
}
    }
else
    {
    echo"$mailadd_text
<a href=/"index.php3?delete/">$here</a> $click ...<br><br>  
<form method=post action=index.php3?add>
<table border=0 align=left cellspacing=0 width=50%>
<tr><td>name:</td><td><input type=text name=name></td></tr>
<tr><td>$prename:</td><td> <input type=text name=vorname></td></tr>
<tr><td>e-mail:</td><td> <input type=text name=email></td></tr>
<tr><td>$password:</td><td> <input type=text name=pw></td></tr>
<tr><td><input type=submit value=/"$send/"></td></tr>
</table>
</form><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
";
    }
    
print_back();
print_footer();
?>



layout.inc.php3
<?
/******************************************************************************/
/*       */
/* layout datei ...       */
/*       */
/* einfach auf eigene layout-wuensche anpassen ...       */
/*       */
/* by marcel beerta       */
/* http://www.supertown.de/computer/mazen/       */
/*       */
/******************************************************************************/

function print_header ($title)
{
echo"<html><head>
<meta http-equiv=/"content-type/" content=/"text/html; charset=iso-8859-1/">
<meta name=/"description/"
content=/"/">
<meta name=/"keywords/"
content=/"/">
<meta name=/"distribution/" content=/"global/">
<meta name=/"robots/" content=/"index/">
<meta name=/"robots/" content=/"follow/">
<meta name=/"revisit-after/" content=/"1 days/">
<meta name=/"language/" content=/"/">
<meta name=/"author/" content=/"/">
<meta name=/"copyright/" content=/"/">
<meta name=/"programmer/" content=/"marcel beerta (www.game-center.de)/">

<title>$title</title>
</head>
<body topmargin=/"0/" leftmargin=/"0/" bgcolor=#040732 link=#ffc600 text=#ffffff vlink=#ffc600 style=/"font-family: verdana; color: #ffffff/">";
}

function print_navbar ( )
{
echo"
<br>
";


}


function print_footer ( )
{
echo"
<p align=center>

</p>
</body></html>
";
}


function print_back ( )
{
echo"<br><br><a href=/"javascript:history.go(-1)/"><strong><< back </strong></a><br><br>";
}

?>


config.inc.php3
/*****************************************************************************/
/*                                                                           */
/*                           datenbank-connector                             */
/*                             marcel beerta                                */
/*                             http://www.supertown.de/mazen/maillist        */
/*****************************************************************************/

/**************************************/
/* just edit the following few lines: */
/**************************************/
//admin-username:
$adminuser='szw';
//admin-password:
$adminpass='szw';
//language
$language='english'; //other languages: 'german','english'
//the hostname of the mysql-server
$hostname = 'localhost';
//mysql-server username
$user = 'root';
//mysql-server password
$pass = '';
//database-name
$database_name = 'maillist';
//maillinglist-table
$maillist_table='marcel_maillist';
//from-e-mail
$from='[email protected]';
//reply-to-e-mail
$reply='[email protected]';
//x-mailer
$mailer='php-maillist by mazen';
/************************************************/
/* don't edit this, if you don't know, what you */
/* do...         */
/************************************************/
$conn=mysql_pconnect ($hostname,$user,$pass);
$ver="1.0.0";
?>



发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表