Code: Select all
<?
#################################################################################
# #
# Mail Manage EX, v3.2 #
# Written by Gregg Kenneth Jewell, Copyright © 2003-2004 #
# #
# All settings can be controlled from the settings file. #
# For all features and instructions refer to the readme file #
# #
# Although security features are implemented in this script, that #
# does not guarantee these features will provide 100% security protection. #
# Use at your own risk. Do not use this script to send sensitive #
# data such as credit card information, social security numbers, etc. #
# #
# #
#################################################################################
#################################################################################
# EDIT AT YOUR OWN RISK #
#################################################################################
#===========================================================
# Register Globals
#===========================================================
$Refresh = $_REQUESTї'Refresh'];
$EMAILї0] = $_REQUESTї'email'];
$EMAILї1] = $_REQUESTї'Email'];
$EMAILї2] = $_REQUESTї'E_mail'];
$EMAILї3] = $_REQUESTї'e_mail'];
$EMAILї4] = $_REQUESTї'email_address'];
$EMAILї5] = $_REQUESTї'Email_Address'];
$EMAILї6] = $_REQUESTї'Email_address'];
#===========================================================
# CHECK SETTINGS & FORM RECIPIENT
#===========================================================
/* Enter the filename of the settings below. Refer to the readme for more instructions. */
require('settings.php');
/*if ($FormRecipient) $Recipient = $FormRecipient;*/
#===========================================================
# RETRIEVE ENVIRONMENTAL VARIABLES
#===========================================================
header("Cache-control: public");
$IPAddress = $_SERVERї'REMOTE_ADDR'];
$MkTime = mktime();
$Time = date('M j, Y @ g:i:s a',mktime(date('H')+$TimeZone));
$Browser = $_SERVERї'HTTP_USER_AGENT'];
#===========================================================
# STYLE AND HTML HEADER/FOOTER
#===========================================================
if (!$FontFamily)
$FontFamily = 'arial'; // Default
if (!$FontSize)
$FontSize = '10pt'; // Default
if (!$FontColor)
$FontColor = '#000000'; // Default
if ($BorderColor and $BgColor)
{
$msgї'style'] = '<div style="margin-left:24px;padding:10,10,10,10;border:solid '.$BorderColor.' 1px;background-color:'.$BgColor.';font-family:'.$FontFamily.';font-size:'.$FontSize.';color:'.$FontColor.';">';
$msgї'tplstyle'] = '<div style="padding:10,10,10,10;border:solid '.$BorderColor.' 1px;background-color:'.$BgColor.';font-family:'.$FontFamily.';font-size:'.$FontSize.';color:'.$FontColor.';">';
}
else
{
$msgї'style'] = '<div style="margin-left:24px;font-family:'.$FontFamily.';font-size:'.$FontSize.';color:'.$FontColor.';">';
$msgї'tplstyle'] = '<div style="font-family:'.$FontFamily.';font-size:'.$FontSize.';color:'.$FontColor.';">';
}
if ($MessageTemplate and file_exists($MessageTemplate))
{
$handle = @fopen($MessageTemplate,'r');
$MsgTPL = @fread($handle,filesize($MessageTemplate));
@fclose($handle);
$MsgTPL = explode("їMMEX]",$MsgTPL);
$msgї'header'] = $MsgTPLї0].$msgї'tplstyle'];
$msgї'footer'] = "</div>" . $MsgTPLї1];
}
else
{
$msgї'header'] = $msgї'style'];
$msgї'footer'] = "</div><br><br>";
}
#===========================================================
# ERROR MESSAGES
#===========================================================
$msgї'banned'] = "<b>Your IP address has been blocked.</b>";
$msgї'nosubmit'] = "<b>Your submission could not be sent. No action has been selected.</b>";
$msgї'recent'] = "<b>Recent entry. New submissions are allowed every $Interval minute(s).</b>";
$msgї'norecipient'] = "<b>This email cannot be sent. No specified recipient.</b>";
$msgї'required'] = "<b>The following field(s) are required to be filled in before submission:</b>";
$msgї'confirmed'] = "<b>The following fields must be the same before submission:</b>";
$msgї'formatted'] = "<b>The following field(s) are required to be filled in with valid format before submission:</b>";
#===========================================================
# CHECK FLOOD CONTROL (PRE-SUBMISSION)
#===========================================================
if ($FloodControl == "1" and file_exists('data/flood.log'))
{
$Seconds = $Interval * 60;
$handle = @fopen('data/flood.log','r');
@flock($handle, LOCK_SH);
$LogData = @fread($handle,filesize('flood.dat'));
$LogData = explode("#",$LogData);
for ($x=0;$x<count($LogData);$x++)
{
$line = explode("|",$LogDataї$x]);
if ($IPAddress == $lineї0])
{
if (($MkTime - $lineї1]) < $Seconds)
exit ($msgї'header'] . $msgї'recent'] . $msgї'footer']);
}
}
@flock($handle,LOCK_UN);
@fclose($handle);
}
#===========================================================
# SAVE INFORMATION TO STATS LOG
#===========================================================
if ($UseStats == "1")
{
$StatInfo = "$FormName|$MkTime|$Time|$IPAddress";
$handle = @fopen('data/stats.log','a');
@flock($handle,LOCK_EX);
@fwrite($handle,$StatInfo."\n");
@flock($handle,LOCK_UN);
@fclose($handle);
}
#===========================================================
# BANNED IP ADDRESSES
#===========================================================
if(stristr($Banned,$IPAddress))
exit ($msgї'header'] . $msgї'banned'] . $msgї'footer']);
#===========================================================
# ADJUST A FEW VARIABLES
#===========================================================
$ID = $num;
for ($x=0;$x<count($EMAIL);$x++){
if ($EMAILї$x]) $SendFrom = $EMAILї$x];}
if (!$SendFrom)
$SendFrom = $Recipient;
$_EMAIL = $_POST;
$_HTML = $_POST;
$_SQL = $_POST;
$_CSV = $_POST;
$_FILE = $_POST;
$_AUTO = $_POST;
$AttachmentField = explode(",",$AttachmentFields);
$x=0;
foreach ($AttachmentField as $ThisAttachment)
{
$ATTACHї$x]ї0] = $_FILESї$ThisAttachment]ї'name'];
$ATTACHї$x]ї1] = $_FILESї$ThisAttachment]ї'tmp_name'];
$x++;
}
if ($SMTPServer)
{
ini_set('SMTP',$SMTPServer);
ini_set('sendfrom_mail',$Recipient);
}
#===========================================================
# CHECK REQUIRED FIELDS
#===========================================================
if ($Require)
{
$Required = explode(",",$Require);
for($i=0;$i<count($Required);$i++)
{
$Field = $Requiredї$i];
if(!$_POSTї$Field])
{
$Field = str_replace("_"," ",$Field);
$Field = ucfirst($Field);
$EmptyFields .= "<li>$Field</li>";
if ($Preview == "1")
$RedFields .= "$Field,";
}
}
if ($EmptyFields)
$Errors = $msgї'required'] . "<ul type="square">" . $EmptyFields . "</ul><br>";
}
#===========================================================
# CHECK FIELDS FOR CONFIRMATION
#===========================================================
if ($Confirm)
{
$Confirmed = explode(",",$Confirm);
for($i=0;$i<count($Confirmed);$i+=2)
{
$Field1 = $Confirmedї$i];
$Field2 = $Confirmedї$i+1];
$FieldA = $_POSTї$Field1];
$FieldB = $_POSTї$Field2];
if ($FieldA != $FieldB)
{
$Field1 = str_replace("_"," ",$Field1);
$Field1 = ucfirst($Field1);
$Field2 = str_replace("_"," ",$Field2);
$Field2 = ucfirst($Field2);
$WrongFields .= "<li><b>$Field1</b> does not match <b>$Field2</b></li>";
if ($Preview == "1")
$RedFields .= "$Field1,$Field2,";
}
}
if ($WrongFields and !$Errors)
$Errors = $msgї'confirmed'] . "<ul type="square">" . $WrongFields . "</ul><br>";
else if ($WrongFields and $Errors)
$Errors .= "<br>" . $msgї'confirmed'] . "<ul type="square">" . $WrongFields . "</ul><br>";
}
#===========================================================
# CHECK FORMATTED FIELDS
#===========================================================
if ($Format)
{
$Formatted = explode(",",$Format);
for ($x=0;$x<count($Formatted);$x++)
{
$Format = substr($Formattedї$x],-1);
$Field = substr($Formattedї$x],0,-1);
if ($Format == "<") // MINIMUM CHAR FORMAT
{
$Length = substr($Field,-2);
$Field = substr($Field,0,-2);
if (substr($Length,0,1) == "0")
$Length = substr($Length,-1);
if ($_POSTї$Field])
{
if(strlen($_POSTї$Field]) < $Length)
{
$Field = str_replace("_"," ",$Field);
$Field = ucfirst($Field);
$IncorrectFields .= "<li><b>$Field</b> requires a minimum of $Length Characters.</li>";
if ($Preview == "1")
$RedFields .= "$Field,";
}
}
}
if ($Format == ">") // MAXIMUM CHAR FORMAT
{
$Length = substr($Field,-2);
$Field = substr($Field,0,-2);
if (substr($Length,0,1) == "0")
$Length = substr($Length,-1);
if ($_POSTї$Field])
{
if(strlen($_POSTї$Field]) > $Length)
{
$Field = str_replace("_"," ",$Field);
$Field = ucfirst($Field);
$IncorrectFields .= "<li><b>$Field</b> exceeds the maximum of $Length Characters.</li>";
if ($Preview == "1")
$RedFields .= "$Field,";
}
}
}
if ($Format == "@" and $_POSTї$Field]) // EMAIL FORMAT
{
if(!eregi('^(ї_a-z0-9-]+)(\.ї_a-z0-9-]+)*@(їa-z0-9-]+)(\.їa-z0-9-]+)*(\.їa-z]{2,4})$',$_POSTї$Field]))
{
$Field = str_replace("_"," ",$Field);
$Field = ucfirst($Field);
$IncorrectFields .= "<li><b>$Field</b> requires the proper email format.</li>";
if ($Preview == "1")
$Redfields .= "$Field,";
}
$Host = explode("@",$_POSTї$Field]);
if (!checkdnsrr($Hostї1].'.', 'MX'))
{
$Field = str_replace("_"," ",$Field);
$Field = ucfirst($Field);
$IncorrectFields .= "<li><b>$Field</b> requires an existing domain name in the email format.</li>";
if ($Preview == "1")
$Redfields .= "$Field,";
}
}
if ($Format == "#" and $_POSTї$Field]) // PHONE NUMBER FORMAT
{
if (!eregi('(ї0-9]{3})-(ї0-9]{3})-(ї0-9]{4})', $_POSTї$Field]) and !eregi('(ї0-9]{3})\.(ї0-9]{3})\.(ї0-9]{4})', $_POSTї$Field]) and !eregi('(ї0-9]{3}) (ї0-9]{3}) (ї0-9]{4})', $_POSTї$Field]) and !eregi('(\(ї0-9]{3}\))-(ї0-9]{3})-(ї0-9]{4})', $_POSTї$Field]) and !eregi('(\(ї0-9]{3}\))\.(ї0-9]{3})\.(ї0-9]{4})', $_POSTї$Field]) and !eregi('(\(ї0-9]{3}\)) (ї0-9]{3}) (ї0-9]{4})', $_POSTї$Field]) and !eregi('(\(ї0-9]{3}\)) (ї0-9]{3})-(ї0-9]{4})', $_POSTї$Field]) and !eregi('(\(ї0-9]{3}\)) (ї0-9]{3})\.(ї0-9]{4})', $_POSTї$Field]))
{
$Field = str_replace("_"," ",$Field);
$Field = ucfirst($Field);
$IncorrectFields .= "<li><b>$Field</b> requires the proper phone format.</li>";
if ($Preview == "1")
$RedFields .= "$Field,";
}
}
if ($Format == "Z" and $_POSTї$Field]) // ZIP CODE FORMAT
{
if (!eregi('(ї0-9]{5})', $_POSTї$Field]))
{
$Field = str_replace("_"," ",$Field);
$Field = ucfirst($Field);
$IncorrectFields .= "<li><b>$Field</b> requires the proper zip code format.</li>";
if ($Preview == "1")
$RedFields .= "$Field,";
}
}
if ($Format == "S" and $_POSTї$Field]) // STATE FORMAT
{
if (!eregi('(їa-zA-Z]{2})', $_POSTї$Field]))
{
$Field = str_replace("_"," ",$Field);
$Field = ucfirst($Field);
$IncorrectFields .= "<li><b>$Field</b> requires the proper state format.</li>";
if ($Preview == "1")
$RedFields .= "$Field,";
}
}
if ($Format == "N" and $_POSTї$Field] > "") // NUMERIC ONLY FORMAT
{
if (eregi('(їa-zA-Z_\-])', $_POSTї$Field]))
{
$Field = str_replace("_"," ",$Field);
$Field = ucfirst($Field);
$IncorrectFields .= "<li><b>$Field</b> requires numeric-only characters.</li>";
if ($Preview == "1")
$RedFields .= "$Field,";
}
}
if ($Format == "A" and $_POSTї$Field]) // ALPHA ONLY FORMAT
{
if (eregi('(ї0-9])', $_POSTї$Field]))
{
$Field = str_replace("_"," ",$Field);
$Field = ucfirst($Field);
$IncorrectFields .= "<li><b>$Field</b> requires aplha-only characters.</li>";
if ($Preview == "1")
$RedFields .= "$Field,";
}
}
}
if ($IncorrectFields and !$Errors)
$Errors = $msgї'formatted'] . "<ul type="square">" . $IncorrectFields . "</ul><br>";
else if ($IncorrectFields and $Errors)
$Errors .= "<br>" . $msgї'formatted'] . "<ul type="square">" . $IncorrectFields . "</ul><br>";
}
#=======================================
# CHECK ATTACHMENT EXTENSION
#=======================================
if ($AllowedExt and ($ATTACHї0]ї0] or $ATTACHї1]ї0] or $ATTACHї2]ї0]))
{
for ($x=0;$x<count($ATTACH);$x++)
{
$MaxSize = $MaxFileSize * 1000;
if (filesize($ATTACHї$x]ї1]) > $MaxSize)
{
$Errors .= "<br><b><i>".$ATTACHї$x]ї0]."</i> has exceeded the allowed file size of $MaxFileSize KB.</b><br>";
}
$i = strrpos($ATTACHї$x]ї0],".");
$l = strlen($ATTACHї$x]ї0]) - $i;
$Ext = substr($ATTACHї$x]ї0],$i+1,$l);
$Ext = strtolower($Ext);
if ($Ext)
{
if (!strstr($AllowedExt,$Ext))
{
$Errors .= "<br><b><i>.$Ext</i> is an invalid extension. The following extensions are allowed:</b><ul type="square">";
$Allowed = explode(",",$AllowedExt);
for($x=0;$x<count($Allowed);$x++)
{
$Errors .= "<li>.".$Allowedї$x]."</li>";
}
$Errors .= "</ul><br>";
}
}
}
}
#===========================================================
# PREVIEW
#===========================================================
if ($Preview == "1" and !$Refresh)
{
$HTMLї'preview'] .= "
<b><u>Submission Preview</u></b><br><br>
<form method="post" action="".$PHP_SELF."">
<input type="hidden" name="Refresh" value="Y">
<input type="hidden" name="Settings" value="".$Settings."">
<table style="font-family:$FontFamily;font-size:$FontSize;" cellspacing=1 cellpadding=2>
";
$RedFields = explode(",",$RedFields);
$flag = 0;
while (list ($key, $val) = each ($_POST))
{
if ($key != "Settings" and $key != "Refresh")
{
$val = stripslashes($val);
$val = str_replace('"','"',$val);
$HTMLї'form'] .= "<input type="hidden" name="".$key."" value="".$val."">";
$key = ucfirst($key);
$key = str_replace("_"," ",$key);
for ($x=0;$x<count($RedFields)-1;$x++)
{
if ($key == $RedFieldsї$x])
{
$HTMLї'form'] .= "<tr><td style="color:red"><b>$key</b>:</td><td>$val</td></tr>";
$Flag = 1;
}
}
if ($Flag != 1)
$HTMLї'form'] .= "<tr><td><b>$key</b>:</td><td>$val</td></tr>";
$Flag = 0;
}
}
$HTMLї'form'] .= "<tr><td height=16 colspan=2></td></tr>";
if (!$Errors)
$HTMLї'form'] .= "<tr><td><input type="submit" value="Submit" style="font-family:$font_family;font-size:$font_size;border: solid #AAAAAA 1px; cursor:hand"></td></tr>";
$HTMLї'form'] .= "</form></table>";
}
if ($Errors and $Preview != "1")
exit ($msgї'header'].$Errors.$msgї'footer']);
else if ($Errors and $Preview == "1" and !$Refresh)
exit ($msgї'header'].$Errors."<br>".$HTMLї'preview'].$HTMLї'form'].$msgї'footer']);
else if ($Preview == "1" and !$Refresh)
exit ($msgї'header'].$HTMLї'preview'].$HTMLї'form'].$msgї'footer']);
#===========================================================
# CHOOSE ACTION
#===========================================================
if (!$Action)
exit($msgї'header'] . $msgї'nosubmit'] . $msgї'footer']);
#########################################################################
# EMAIL FUNCTIONS #
#########################################################################
if ($Action == "E" or $Action == "EC" or $Action == "ED" or $Action == "EF"){
while (list ($key, $val) = each ($_EMAIL))
{
if ($key != "Settings" and $key != "Refresh")
{
$val = stripslashes($val);
$val = str_replace('"','"',$val);
$val = strip_tags($val);
$key = ucfirst($key);
$key = str_replace("_"," ",$key);
$EMAILї'text'] .= "$key: $val\r\n";
$val = nl2br($val);
$EMAILї'form'] .= "<b>$key</b>: $val<br>";
$EMAILї'html'] .= "<tr><td width=120 valign=top><font size="2" face="Verdana, Arial, Helvetica, sans-serif">$key</font></td><td width=380 valign=top><font size="2" face="Verdana, Arial, Helvetica, sans-serif">$val</font></td></tr>";
}
}
if (!$Recipient)
exit ($msgї'header'] . $msgї'norecipient'] . $msgї'footer']);
if (!$Subject)
$Subject = "Web Order - $ID";
#===========================================================
# Email Templates
#===========================================================
$EMAILї'textemail'] = "
***Form Results***\r\n
".$EMAILї'text']."
User's Browser: $Browser\r\n
User's IP Address: $IPAddress\r\n\r\n
- Mail Manage EX Notifier -
";
if ($EmailTemplate)
{
$handle = @fopen($EmailTemplate,'r');
$EMAILї'htmlemail'] = @fread($handle,filesize($EmailTemplate));
@fclose($handle);
if (!strstr($EMAILї'htmlemail'],'їALL]'))
{
while(list($key,$val) = each($_HTML))
{
$insert = "ї".$key."]";
$val = stripslashes($val);
$val = strip_tags($val);
$val = nl2br($val);
$EMAILї'htmlemail'] = str_replace($insert,$val,$EMAILї'htmlemail']);
}
}
else
$EMAILї'htmlemail'] = str_replace('їALL]',$EMAILї'form'],$EMAILї'htmlemail']);
$EMAILї'htmlemail'] = str_replace("їReceived]",$Time,$EMAILї'htmlemail']);
$EMAILї'htmlemail'] = str_replace("їIPAddress]",$IPAddress,$EMAILї'htmlemail']);
$EMAILї'htmlemail'] = str_replace("їBrowser]",$Browser,$EMAILї'htmlemail']);
$EMAILї'htmlemail'] = str_replace("їID]",$ID,$EMAILї'htmlemail']);
$EMAILї'htmlemail'] = str_replace("їAttach1]",$ATTACHї0]ї0],$EMAILї'htmlemail']);
$EMAILї'htmlemail'] = str_replace("їAttach2]",$ATTACHї1]ї0],$EMAILї'htmlemail']);
$EMAILї'htmlemail'] = str_replace("їAttach3]",$ATTACHї2]ї0],$EMAILї'htmlemail']);
}
else
{
$EMAILї'htmlemail'] = '
<html>
<head></head>
<xbody>
<table border="0" cellspacing="0" cellpadding="0" width="600">
<tr>
<font color="#30A11E" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Submission: '.$ID.'</strong></font></td>
</tr>
</table>
<table bgcolor="#F1F1F1" border="0" cellspacing="0" cellpadding="5" width="600">
<tr>
<td align="left" valign="middle">
<strong><font color="#202020" size="1" face="Verdana, Arial, Helvetica, sans-serif">THANK YOU FOR CHOOSING CARTWRIGHT SIGNS - SEEING OUR BUSINESS THROUGH YOUR EYES</font></strong></td>
</tr>
</table><br>
<table bgcolor="#F9F9F9" border="0" cellspacing="0" cellpadding="5" width="600">
<tr>
<td width="380" align="center" valign="middle">
<img src="#" width="250" height="1" border="0"></td>
<td width="220" align="left" valign="top">
<font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif">
<br>
<strong>'.$Time.'<br>
<font color="#30A11E">IP: '.$IPAddress.'</font></font></strong><br>
<font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">'.$Browser.'</font></td>
</tr>
</table>
<table bgcolor="#F9F9F9" border="0" cellspacing="0" cellpadding="5" width="600">
<tr>
<td>
<font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif">
***Form Results***<br><br>
<table bgcolor="#F9F9F9" border="0" cellspacing="1" cellpadding="0" width="500">
'.$EMAILї'html'].'
</table><br><br>
</table><br>
<table bgcolor="#F1F1F1" border="0" cellspacing="0" cellpadding="5" width="600">
<tr>
<td align="left" valign="middle">
<strong><font color="#202020" size="1" face="Verdana, Arial, Helvetica, sans-serif">Copyright © 2001-2004 - HeadStart Web Designs.
</font></strong></td>
</tr>
</table>
</xbody>
</html>';
}
#===========================================================
# Put Header Information in Email
#===========================================================
$rand = md5(time());
$MimeBoundary = "MMEX". $rand;
$Headers = "From: $SendFrom\n";
$Headers .= "Reply-to: $SendFrom\n";
$Headers .= "Return-Path: $SendFrom\n";
if ($CC)
$Headers .= "cc: $CC\n";
$Headers .= "X-Mailer: My PHP Mailer\n";
$Headers .= "MIME-Version: 1.0\n";
if ($AttachmentFields and ($ATTACHї0]ї0] or $ATTACHї1]ї0] or $ATTACHї2]ї0]))
$Headers .= "Content-Type: multipart/mixed; charset="iso-8859-1"; boundary="$MimeBoundary";\n\n";
else
$Headers .= "Content-Type: multipart/alternative; charset="iso-8859-1"; boundary="$MimeBoundary";\n\n";
$Headers .= "This is a multi-part message in MIME format.\n\n";
if ($TextEmails == "1")
{
$Content .= "--$MimeBoundary\n";
$Content .= "Content-Type: text/plain; charset="iso-8859-1"\n";
$Content .= "Content-Transfer-Encoding: 8bit\n\n";
$Content .= $EMAILї'textemail']."\n\n";
}
if ($HtmlEmails == "1")
{
$Content .= "--$MimeBoundary\n";
$Content .= "Content-Type: text/html; charset="iso-8859-1"\n";
$Content .= "Content-Transfer-Encoding: 8bit\n\n";
$Content .= $EMAILї'htmlemail']."\n\n";
}
if ($AttachmentFields)
{
for ($x=0;$x<count($ATTACH);$x++)
{
$TmpFile = "data/".$ATTACHї$x]ї0];
@copy($ATTACHї$x]ї1],"$TmpFile");
$fa = @fopen ($TmpFile,'r');
$FileContent = @fread($fa,filesize($TmpFile));
@fclose($fa);
$FileContent = chunk_split(base64_encode($FileContent));
$Content .= "--$MimeBoundary\n";
$Content .= "Content-Type: application/octetstream;\n name="".$ATTACHї$x]ї0].""\n";
$Content .= "Content-Transfer-Encoding: base64\n";
$Content .= "Content-Disposition: attachment;\n filename="".$ATTACHї$x]ї0].""\n\n";
$Content .= $FileContent."\n";
@unlink($TmpFile);
}
}
$Content .= "--$MimeBoundary--\n\n\n";
#===========================================================
# Send It Off
#===========================================================
mail($Recipient, $Subject, $Content, $Headers);
} // END OF ACTION
#########################################################################
# CSV-FILE FUNCTIONS #
#########################################################################
if ($Action == "C" or $Action == "EC" or $Action == "CD"){
$Time = date('M j Y @ g:i:s a',mktime(date('H')+$TimeZone));
while (list ($key, $val) = each ($_CSV))
{
if ($key != "Settings" and $key != "Refresh")
{
$val = stripslashes($val);
$val = str_replace('"','"',$val);
$val = strip_tags($val);
$val = str_replace(",","¸",$val);
$val = str_replace("\r\n"," ",$val);
$val = str_replace("\n"," ",$val);
$CSVData .= "$val,";
}
}
$CSVData .= "$Time,$IPAddress,$Browser";
$handle = @fopen($CSVFile,'a');
@flock($handle,LOCK_EX);
@fwrite($handle,$CSVData."\n");
@flock($handle,LOCK_UN);
@fclose($handle);
} // END OF ACTION
#########################################################################
# FLAT-FILE FUNCTIONS #
#########################################################################
if ($Action == "F" or $Action == "EF" or $Action == "DF"){
$seqfile = 'ID.txt';
if(!file_exists($seqfile))
$num = 100;
else
$num = intval(file_get_contents($seqfile)) + 1;
$fp = fopen($seqfile, 'w');
fwrite($fp, $num);
fclose($fp);
// send the form's data
$handle = @fopen($FlatFile,'a');
@flock($handle,LOCK_EX);
@fwrite($handle,$FileData);
@flock($handle,LOCK_UN);
@fclose($handle);
} // END OF ACTION
#########################################################################
# DATABASE FUNCTIONS #
#########################################################################
if ($Action == "D" or $Action == "ED" or $Action == "CD" or $Action == "DF"){
$Connect = @mysql_connect("localhost", "$SQL_UserName", "$SQL_Password");
@mysql_select_db("$SQL_Database",$Connect);
while (list ($key, $val) = each ($_SQL))
{
if ($key != "Settings" and $key != "Refresh")
{
$val = stripslashes($val);
$val = str_replace('"','"',$val);
$val = strip_tags($val);
$Columns .= $key . ',';
$Values .= "'" . $val . "',";
}
}
if ($SQL_ENV == "1")
{
$Columns .= "Received,IPAddress,Browser";
$Values .= "'" . $Time . "','" . $IPAddress ."','" . $Browser . "'";
}
else
{
$Columns = substr($Columns,0,-1);
$Values = substr($Values,0,-1);
}
@mysql_query("INSERT INTO $SQL_Table ($Columns) VALUES ($Values)");
@mysql_close($Connect);
} // END OF ACTION
#########################################################################
# POST SUBMIT FUNCTIONS #
#########################################################################
#===========================================================
# SAVE FLOOD CONTROL DATA (POST-SUBMISSION)
#===========================================================
if ($FloodControl == "1")
{
$LogData = $IPAddress . "|" . $MkTime . "#";
$handle = @fopen('data/flood.log','a');
@flock($handle,LOCK_EX);
@fwrite($handle,$LogData);
@flock($handle,LOCK_UN);
@fclose($handle);
}
#===========================================================
# Auto Respond Information
#===========================================================
if ($AutoRespond == "1")
{
if (!$AutoSubject)
$AutoSubject = 'Thank you for your submission';
if ($AutoTemplate and file_exists($AutoTemplate))
{
$handle = @fopen($AutoTemplate,'r');
$AutoContent = @fread($handle,filesize($AutoTemplate));
@fclose($handle);
while(list($key,$val) = each($_AUTO))
{
$insert = "ї".$key."]";
$val = stripslashes($val);
$val = strip_tags($val);
$val = nl2br($val);
$AutoContent = str_replace($insert,$val,$AutoContent);
$AutoContent = str_replace("їReceived]",$Time,$AutoContent);
$AutoContent = str_replace("їID]",$ID,$AutoContent);
$AutoContent = str_replace("їAttach1]",$ATTACHї0]ї0],$AutoContent);
$AutoContent = str_replace("їAttach2]",$ATTACHї1]ї0],$AutoContent);
$AutoContent = str_replace("їAttach3]",$ATTACHї2]ї0],$AutoContent);
}
}
if (!$AutoContent)
$AutoContent = "Cartwright Signs has received your order. Your Submission ID is : їID]$ID";
if ($AutoFromName)
$AutoHeaders = "From: "$AutoFromName" <$Recipient>\n";
else
$AutoHeaders = "From: $Recipient\n";
$AutoHeaders .= "MIME-Version: 1.0\nContent-Type: text/html; charset=ISO-8859-1\nContent-Transfer-Encoding: 8bit\n\n";
@mail($SendFrom,$AutoSubject,$AutoContent,$AutoHeaders);
}
#===========================================================
# REDIRECT OR THANK YOU
#===========================================================
if (!$Redirect)
{
if (!$ThankYou)
$ThankYou = 'Thank you for your submission.';
exit ($msgї'header'] . "$ThankYou". $msgї'footer']);
}
else
echo "<html><head><META http-equiv="refresh" content="0;URL=$Redirect"></head><body></body></html>";
?>
It's the form submission script MMEX...
I've attempted to make the changes I need...with limited success...