Location: PHPKode > scripts > Amailer > amailer/function.php
<?
//including the main file
include "confi.php";
include "ver.php";
include "login.php";

//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!!");


//the copy right function
function copyright() {
global $copyleft, $rec, $result;
global $time, $dates, $hour;

//Now lets display the information stored in the database.
$result = mysql_query("SELECT * FROM admin");
while($rec = mysql_fetch_array($result)) {
$copyleft = $rec['copyleft'];
}
copyrightsystem();
if($copyleft != 1) {
die("<center>$time<br>$dates<br><hr></center><br><br><b><br><br><center><h1><u>YOU REMOVED THE COPYRIGHT</U></h1></center>");
 }
}

function copyrightsystem() {
global $result, $copyleft, $result, $date, $PHP_SELF;

$result = mysql_query("SELECT * FROM admin");
while($rec = mysql_fetch_array($result)) {
$copyleft = $rec['copyleft'];
$datee = $rec['date'];
}
if($date != $datee) {
$result = mysql_query("UPDATE admin ". "SET copyleft='1', date=' '" . "WHERE id='1'");
}

if ($date == "Sunday") {
$day = "Monday";
} 
elseif ($date == "Monday") {
$day = "Tuesday";
} 
elseif ($date == "Tuesday") {
$day = "Wednesday";
} 
elseif ($date == "Wednesday") {
$day = "Thursday";
} 
elseif ($date == "Thursday") {
$day = "Friday";
} 
elseif ($date == "Firday") {
$day = "Saturday";
} 
elseif ($date == "Saturday") {
$day = "Sunday"; 
}


if($copyleft != 1) {
echo "<center><b>Copyright system is on, your site will be back up tomorrow '<i>$day</i>',<br>Thank you</b><center><br>";
 }
}


function copyleft() {
global $copyleft, $rec, $result, $year;

//hmm, this is to display the copyright no clue why i put it in 2 diffrent places :(
$result = mysql_query("SELECT * FROM admin");
while($rec = mysql_fetch_array($result)) {
$copyleft = $rec['copyleft'];
}
if($copyleft != 0){echo"<center><tr><td colspan=\"2\" bgcolor=\"#dfdfdf\" align=\"center\">\n<a href=\"http://termix-zero.ath.cx\"><font size=\"-1\" color=\"blue\">Termix - Anonymous Mailer Copyright 2002 - $year. All rights researved.</font></a></td></tr></center>";
} else {
copyright();
 }
}

//ok, just made another header here, just the same as the header .php
function headers() {
global $version;

//The Copyright must STAY! DO NOT REMOVE!
copyright();
echo "<center><h1><u>Anonymous Mailers: Logger _-+ $version +-_</u></h1></center>";
copyleft();


echo "<br><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"100%\">";
echo "<tr>";
echo "<td width=\"20%\" align=\"center\">";
echo "    <p align=\"center\">";
echo "    <a href=\"log.php\" style=\"text-decoration: none\"><font color=\#071378\">Return to log</a>";
echo "    <td width=\"20%\" align=\"center\"><a href=\"function.php?action=search_form\" style=\"text-decoration: none\"><font color=\#071378\">Search a log</a></td>";
echo "    <td width=\"20%\" align=\"center\"><font color=\#071378\"><a href=\"function.php?action=delete_form\" style=\"text-decoration: none\"><font color=\#071378\">Delete a log</a></td>";
echo "    <td width=\"20%\" align=\"center\"><a href=\"login.php?module=logout&check=yes\" style=\"text-decoration: none\"><font color=\#071378\">Log out</a></td>";
echo "    <td width=\"20%\" align=\"center\">";
echo "    <a href=\"admin.php?site=layout\" style=\"text-decoration: none\"><font color=\#071378\">Admin area</a></td>";
echo "  </tr>";
echo "</table>";
} // end of function

//err layout function for amdin area :) peace
function layout() {
?>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
  <tr>
    <td width="100%"><b><u>Admin area&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </u></b></td>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="17">
  <tr>
    <td width="20%" valign="top" height="17"><font size="2" color="#000080">
    <a href="<? echo "admin.php?site=layout=site_prefs_form" ?>" style="text-decoration: none">
    <font color="#000080">Site prefs</font></a><br>
    User login<br>
&nbsp;</font></td>
    <td width="80%" valign="top" height="17"><font size="2">welcome darn it,</font><p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</td>
  </tr>
</table>
<?
exit;
} // enf of function

//ahh just ignore this :)
if(isset($action)) {

//This is the delete form function
function delete_form() {
global $result, $rec, $default_dbname, $link_id, $PHP_SELF;
headers();
?>
<title>Amailer - Delete</title>
<img border="0" src="./Images/h1.gif" width="100%" height="1"><br>
<form method="POST" action="<? echo "$PHP_SELF?action=delete" ?>">
<p align="center">
Enter The ID:
<input type="text" name="di" size="20">
<input type="submit" value="Submit" name="submit"></p>
<p align="center"></p>
</form>

<?
//Now lets display the information stored in the database.
$result = mysql_query("SELECT * FROM maillog");
while($rec = mysql_fetch_array($result)) {
    
    echo "<img border=\"0\" src=\"./Images/h1.gif\" width=\"100%\" height=\"1\"><br>";
    echo "<br><b><u>Id number:</b>" . $rec['id']         . "<br>" ;
    echo "<b>Date:</b> "            . $rec['today']      . "<br>" ;
    echo "<b>Hosts ip:</b> "        . $rec['host']       . "<br>" ;
    echo "<b>Mailers Real Ip:</b> " . $rec['realip']     . "<br><br></u>" ;
    echo "<b>Mailers Name:</b> "    . $rec['name']       . "<br>" ;
    echo "<b>Mailers E-mail:</b> "  . $rec['email']      . "<br>" ;
    echo "<b>Friends Name:</b> "    . $rec['name1']      . "<br>" ;
    echo "<b>Friends E-mail:</b>"   . $rec['email1']     . "<br>" ;
    echo "<b>Subject:</b> "         . $rec['sub']        . "<br>" ;
    echo "<b>Message:</b> "         . $rec['xmessage']   . "<br><br>" ;
 } // end of while
} // end of function

//next is da, delete function, ya
function delete() {
global $result, $rec, $num_rows, $link_id, $di;
global $PHP_SELF, $id;
headers();
 ?>
<html>
<head>
</head>
<body>
<form method="POST" action="<? echo "$PHP_SELF?action=delete"; ?>">
<p align="center">
<input type="text" name="di" size="20"><br>
<input type="submit" value="Submit" name="submit"></p>
<p align="center"></p>
</form>
</body>
</html>
<?
if ($di) {
$result = mysql_query("DELETE FROM maillog WHERE id=$di");
 if(!$result) die("<center><font color=\"#CC3300\"><b>" . sql_error() . "</b></font><br></center>");                         
}

$num_rows = mysql_affected_rows ($link_id);
if($num_rows != 1) { 
die("<center><font color=\"#CC3300\"><b>No log was deleated. Log was not found</b></font><br></center>");
}
if($di == "") {
die("<center><b><font color=\"#CC3300\">Please enter a log ID!</font></b></center>");
}
if($result) {
die("<center><b><font color=\"#CC3300\">Log number: $di<br> has successfully been deleleated</font></b></center>");
}
$result = mysql_query("SELECT * FROM maillog");
while($rec = mysql_fetch_array($result)) {

    echo "<img border=\"0\" src=\"./Images/h1.gif\" width=\"100%\" height=\"1\"><br>";
    echo "<br><b><u>Id number:</b>" . $rec['id']         . "<br>" ;
    echo "<b>Date:</b> "            . $rec['today']      . "<br>" ;
    echo "<b>Hosts ip:</b> "        . $rec['host']       . "<br>" ;
    echo "<b>Mailers Real Ip:</b> " . $rec['realip']     . "<br><br></u>" ;
    echo "<b>Mailers Name:</b> "    . $rec['name']       . "<br>" ;
    echo "<b>Mailers E-mail:</b> "  . $rec['email']      . "<br>" ;
    echo "<b>Friends Name:</b> "    . $rec['name1']      . "<br>" ;
    echo "<b>Friends E-mail:</b>"   . $rec['email1']     . "<br>" ;
    echo "<b>Subject:</b> "         . $rec['sub']        . "<br>" ;
    echo "<b>Message:</b> "         . $rec['xmessage']   . "<br><br>" ;
 } // end of while
} // end of function

//ah, yes the search function ;) well..search form function :)
function search_form() {
global $PHP_SELF;
headers();
echo "<img border=\"0\" src=\"./Images/h1.gif\" width=\"100%\" height=\"1\"><br>";
?>


<form action="<? echo "$PHP_SELF?action=search"; ?>" method="post">
<input type="hidden" name="form" value"1">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="1">
  <tr>
    <td width="33%" height="22"><b><font size="2" face="Courier New">Please 
    enter your KEYWORD:</font></b></td>
    <td width="67%" height="22"> 
    <input type="text" name="results" size="33" style="font-family: DicotMedium; font-size: 8pt; border: 1px solid #FFFFFF; background-color: #C0C0C0"></td>
  </tr>
  <tr>
    <td width="33%" height="1"></td>
    <td width="67%" height="1">
<input type="hidden" name="form" value="1">
<input type="submit" value="Search" style="font-family: DicotMedium; font-size: 8pt; border: 1px solid #FFFFFF; background-color: #C0C0C0"></td>
  </tr>
</table>
</form>
<?
} //end of function


//so that was easy, this is to, the search function 'real one' eheh
function search() {
global $result, $results;
headers();

$result = mysql_query("SELECT * FROM `maillog` WHERE `today` LIKE '%".$results."%' OR `host` LIKE '%".$results."%' OR `realip` LIKE '%".$results."%' OR `name` LIKE '%".$results."%' OR `email` LIKE '%".$results."%' OR `name1` LIKE '%".$results."%' OR `email1` LIKE '%".$results."%' OR `sub` LIKE '%".$results."%' OR `xmessage` LIKE '%".$results."%'");

echo "<HTML>\n<HEAD>\n<TITLE>Amailer - Search Results</TITLE>\n</HEAD>\n\n<BODY>\n";

if (mysql_num_rows($result) == 0) {
    echo "Sorry, but no results were found.  Please change your search terms and try again.\n";
    echo "</BODY></HTML>\n";
    exit();
}

while ($rec = mysql_fetch_array($result)) {

    echo "<img border=\"0\" src=\"./Images/h1.gif\" width=\"100%\" height=\"1\"><br>";
    echo "<br><b><u>Id number:</b>" . $rec['id']         . "<br>" ;
    echo "<b>Date:</b> "            . $rec['today']      . "<br>" ;
    echo "<b>Hosts ip:</b> "        . $rec['host']       . "<br>" ;
    echo "<b>Mailers Real Ip:</b> " . $rec['realip']     . "<br><br></u>" ;
    echo "<b>Mailers Name:</b> "    . $rec['name']       . "<br>" ;
    echo "<b>Mailers E-mail:</b> "  . $rec['email']      . "<br>" ;
    echo "<b>Friends Name:</b> "    . $rec['name1']      . "<br>" ;
    echo "<b>Friends E-mail:</b>"   . $rec['email1']     . "<br>" ;
    echo "<b>Subject:</b> "         . $rec['sub']        . "<br>" ;
    echo "<b>Message:</b> "         . $rec['xmessage']   . "<br><br>" ;
 } // end of while
} // end of function


//This is the html coder form function
function htmlcoder_form() {
global $PHP_SELF;
?>
<form method="POST" action="<? echo "$PHP_SELF?action=html_coade"; ?>">
   <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
    <tr>
      <td width="100%"><font size="2">Please enter your email address:</font></td>
    </tr>
  </table>
  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
    <tr>
      <td width="100%">
      <input type="text" name="email" size="55" style="font-family: Courier New; font-size: 8pt; border: 1px solid #FFFFFF; background-color: #C0C0C0"><br>
      <input type="submit" value="Submit" name="B1" style="font-family: Verdana; font-size: 8pt; border: 1px solid #FFFFFF; background-color: #C0C0C0">
      <input type="reset" value="Reset" name="B2" style="font-family: Verdana; font-size: 8pt; border: 1px solid #FFFFFF; background-color: #C0C0C0"></td>
    </tr>
  </table>
</form>
<?
}

//this is the html coder function
//that executes a perl script
//to learn more about what this is used for please
//read the howtouse.html
function html_coade() {
global $email, $result;

$result = exec("C:/Perl/bin/perl.exe ./vbcode.pl $email");
echo "<b>Your html coded email is:<br></b>";
echo "$result";

mail("$email", "Your coded HTML EMAIL!", "Your email:<br>$email = <br>$result");
}


switch($action) {
case "delete_form":
delete_form();
break;
case "delete":
delete();
break;
case "search_form":
search_form();
break;
case "search":
search();
break;
case "htmlcoder_form":
htmlcoder_form();
break;
case "html_coade":
html_coade();
break;
 } // end of switch
} // end of if isset statement
?>
Return current item: Amailer