Location: PHPKode > scripts > Amailer > amailer/admin.php
<?
include "ver.php";
include "function.php";

//First put this lil header function from function.php
headers();
//connecting to mysql
$link_id = db_connect();
if(!$link_id) die(sql_error());

mysql_select_db("$default_dbname" ,$link_id);
if(!$default_dbname) die("MYSQL ERROR!!");


//Well this is of course the main function!
//for editing yoru sites prefs and etc you know.
//lets start

//the...site prefs, form function, ya!
function site_prefs_form() {
global $rec, $result, $PHP_SELF;
global $webmaster, $notify, $adminusername, $adminpassword, $copyleft, $loglogin;
global $logfile, $message, $pmessage, $urls, $pathmailer;

$result = mysql_query("SELECT * FROM admin");
while($rec = mysql_fetch_array($result)) {

$webmaster = $rec['webmaster'];
$notify = $rec['notify'];
$adminusername = $rec['admin_username'];
$adminpassword = $rec['admin_password'];
$copyleft = $rec['copyleft'];
$loglogin = $rec['log_login'];
$logfile = $rec['log_file'];
$message = $rec['message'];
$pmessage = $rec['pmessage'];
$urls = $rec['urls'];
$pathmailer = $rec['pathmailer'];
} // end of while 
?>
<form method="POST" action="<? echo "$PHP_SELF?site=site_prefs"; ?>">
  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
    <tr>
      <td width="100%"><hr></td>
    </tr>
  </table>
  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="99%" height="1">
    <tr>
      <td width="29%" height="1" valign="top"></td>
      <td width="29%" height="1" valign="top">
      </td>
      <td width="44%" height="1" valign="top">
      <p align="right"><font face="Courier New"><font size="2">You have to fill 
      the fields with </font><font color="#800000" size="2">*</font></font></td>
    </tr>
    <tr>
      <td width="29%" height="17"><font face="Courier New">
      <font size="2" color="#800000">*</font><font size="2"> Web Masters Email:</font></font></td>
      <td width="29%" height="17">
      <input type="text" name="webmaster" size="32" style="font-family: Verdana (serif); font-size: 8pt; color: #000000; border: 1px solid #C0C0C0; background-color: #C0C0C0" value="<? echo $webmaster; ?>"></td>
      <td width="44%" height="17"><font face="Courier New" size="2">- Fill in 
      your email address</font></td>
    </tr>
    <tr>
      <td width="29%" height="16"><font face="Courier New">
      <font size="2" color="#800000">*</font><font size="2"> Admin Username:</font></font></td>
      <td width="29%" height="16">
      <input type="text" name="adminusername" size="32" style="font-family: Verdana (serif); font-size: 8pt; color: #000000; border: 1px solid #C0C0C0; background-color: #C0C0C0" value="<? echo $adminusername; ?>"></td>
      <td width="44%" height="16"><font face="Courier New" size="2">- Fill in a 
      desire username</font></td>
    </tr>
    <tr>
      <td width="29%" height="18"><font face="Courier New">
      <font size="2" color="#800000">* </font><font size="2">Admin Password:</font></font></td>
      <td width="29%" height="18">
      <input type="password" name="adminpassword" size="32" style="font-family: Verdana (serif); font-size: 8pt; color: #000000; border: 1px solid #C0C0C0; background-color: #C0C0C0" value="<? echo $adminpassword; ?>"></td>
      <td width="44%" height="18"><font face="Courier New" size="2">- Fill in a 
      desire password</font></td>
    </tr>
    <tr>
      <td width="29%" height="18"></td>
      <td width="29%" height="18"></td>
      <td width="44%" height="18"></td>
    </tr>
    <tr>
      <td width="29%" height="18"><font face="Courier New">
      <font size="2" color="#800000">*</font><font size="2"> Copyright:</font></font></td>
      <td width="29%" height="18">
      <input type="text" name="copyright" size="1" style="font-family: Verdana (serif); font-size: 8pt; color: #000000; border: 1px solid #C0C0C0; background-color: #C0C0C0" value="<? echo "$copyleft"; ?>"></td>
      <td width="44%" height="18"><font face="Courier New" size="2">- Pleas 
      leave this 1, for copyright &nbsp;&nbsp;THE SITE WILL DIE IF YOU PUT IT 0 &nbsp;&nbsp;OR ANY OTHER NUMBER</font></td>
    </tr>
    <tr>
      <td width="29%" height="14" valign="top"><font face="Courier New">
      <font size="2" color="#800000">* </font><font size="2">Notify:</font></font></td>
      <td width="29%" height="14" valign="top">
      <input type="text" name="notify" size="1" style="font-family: Verdana (serif); font-size: 8pt; color: #000000; border: 1px solid #C0C0C0; background-color: #C0C0C0" value="<? echo "$notify"; ?>"></td>
      <td width="44%" height="14"><font face="Courier New" size="2">- 1 = Notify 
      mails sent<br>
&nbsp; 0 = Do not notify when mails are <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sent</font></td>
    </tr>
    <tr>
      <td width="29%" height="18" valign="top"><font face="Courier New">
      <font size="2" color="#800000">* </font><font size="2">Log login:</font></font></td>
      <td width="29%" height="18" valign="top">
      <input type="text" name="loglogin" size="1" style="font-family: Verdana (serif); font-size: 8pt; color: #000000; border: 1px solid #C0C0C0; background-color: #C0C0C0" value="<? echo "$loglogin"; ?>"></td>

      <td width="44%" height="18"><font face="Courier New" size="2">- 1 = log 
      any logins in the admin area<br>
&nbsp; 2 = Do not log any logins in admin<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; area</font></td>
    </tr>
    <tr>
      <td width="29%" height="18" valign="top"><font face="Courier New">
      <font size="2" color="#800000">*</font><font size="2"> Log file:</font></font></td>
      <td width="29%" height="18" valign="top">
      <input type="text" name="logfile" size="42" style="font-family: Verdana (serif); font-size: 8pt; color: #000000; border: 1px solid #C0C0C0; background-color: #C0C0C0" value="<? echo "$logfile"; ?>"></td>
      <td width="44%" height="18"><font face="Courier New" size="2">- The 
      default file is LOG.PHP, LEAVE<br>
&nbsp; THIS AS IT IS!</font></td>
    </tr>
    <tr>
      <td width="29%" height="17"></td>
      <td width="29%" height="17"></td>
      <td width="44%" height="17"></td>
    </tr>
    <tr>
      <td width="29%" height="18" valign="top"><font face="Courier New" size="2">&nbsp; 
      Default HTML message:</font></td>
      <td width="29%" height="18" valign="top">
      <input type="text" name="message" size="42" style="font-family: Verdana (serif); font-size: 8pt; color: #000000; border: 1px solid #C0C0C0; background-color: #C0C0C0" value="<? echo "$message"; ?>"></td>
      <td width="44%" height="18"><font face="Courier New" size="2">- The 
      default message to be sent by all <br>
&nbsp; emails, in HTML TEXT FORMAT</font></td>
    </tr>
    <tr>
      <td width="29%" height="16" valign="top"><font size="2" face="Courier New">&nbsp; 
      Default PLAIN message:</font></td>
      <td width="29%" height="16" valign="top">
      <input type="text" name="pmessage" size="42" style="font-family: Verdana (serif); font-size: 8pt; color: #000000; border: 1px solid #C0C0C0; background-color: #C0C0C0" value="<? echo "$pmessage"; ?>"></td>
      <td width="44%" height="16"><font face="Courier New" size="2">- The 
      default message to be sent by all <br>
&nbsp; emails, in PLAIN TEXT FORMAT</font></td>
    </tr>
    <tr>
      <td width="29%" height="18"></td>
      <td width="29%" height="18"></td>
      <td width="44%" height="18"></td>
    </tr>
    <tr>
      <td width="29%" height="16" valign="top"><font face="Courier New">
      <font size="2" color="#800000">* </font><font size="2">URL to AMAILER:</font></font></td>
      <td width="29%" height="16" valign="top">
      <input type="text" name="urls" size="42" style="font-family: Verdana (serif); font-size: 8pt; color: #000000; border: 1px solid #C0C0C0; background-color: #C0C0C0" value="<? echo "$urls"; ?>"></td>
      <td width="44%" height="16"><font face="Courier New" size="2">- The URL to 
      your amailer,<br>
&nbsp; <font color="#800000">Note: </font>include the / at the end!<br>
&nbsp; i.e. http://here.com/amailer/</font></td>
    </tr>
    <tr>
      <td width="29%" height="15" valign="top"><font face="Courier New">
      <font size="2" color="#800000">*</font><font size="2"> Path to AMAILER:</font></font></td>
      <td width="29%" height="15" valign="top">
      <input type="text" name="pathmailer" size="42" style="font-family: Verdana (serif); font-size: 8pt; color: #000000; border: 1px solid #C0C0C0; background-color: #C0C0C0" value="<? echo "$pathmailer"; ?>"></td>
      <td width="44%" height="15"><font face="Courier New" size="2">- The path 
      to your amailer<br>
&nbsp; <font color="#800000">Note: </font>Make all back slashes Foward!<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NOT BACK SLASHES! AND NO / at<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the end!<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i.e. c:/whatever/amailer</font></td>
    </tr>
    <tr>
      <td width="102%" height="18" colspan="3"><hr>
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
        <tr>
          <td width="29%">&nbsp;</td>
          <td width="71%">
      <input type="submit" value="Submit" name="B1" style="font-family: Courier New; font-size: 8pt; border: 1px solid #FFFFFF; background-color: #C0C0C0">
      <input type="reset" value="Reset" name="B2" style="font-family: Courier New; font-size: 8pt; border: 1px solid #FFFFFF; background-color: #C0C0C0"></td>
        </tr>
      </table>
      </td>
    </tr>
  </table>
</form>
<?
}

//ahh yes the real real functuon of site prefs :) first one = form only :)
function site_prefs() {
global $result, $PHP_SELF;
global $webmaster, $notify, $adminusername, $adminpassword, $copyright, $loglogin;
global $logfile, $message, $pmessage, $urls, $version, $pathmailer, $time, $date, $hour;

if($message == "" && $pmessage == "") {
$pmessage = "\r\n\r\n\r\n _-~*^ Amailer $version ^*~-_";
$message = "<br><br><b>_-~*^ Amailer $version ^*~-_</b>";
}

  if ($webmaster) {
  $result = mysql_query("UPDATE admin " . "SET webmaster='$webmaster', admin_username='$adminusername' , admin_password = '$adminpassword', logfile='$logfile', message='$message', pmessage='$pmessage', copyleft='$copyright', notify='$notify', log_login='$loglogin', log_file='$logfile', urls='$urls', pathmailer='$pathmailer'" . "WHERE id=1");
   
if($copyright != 1) {
$result = mysql_query("UPDATE admin ". "SET date='$date', time='$time'");
echo "<hr>over your gone your dead";
}
 echo "<hr><br>Prefrences have successfully been updated";
 } //end of if statement
} //end of function


function welcome() {
echo "Welcome admin<br>";
echo "If you would like to chnage your amailers prfs, simply click in the below menu: <b>Site prefs";
}

if(isset($site)) {
switch($site) {
case "site_prefs_form":
site_prefs_form();
break;
case "site_prefs":
site_prefs();
break;
case "layout":
layout();
break;
default:
site_prefs_form();
break;
 } //end of isset
} //end of switch
?>

Return current item: Amailer