post Geplaatst: 21 september 2009 Geplaatst: 21 september 2009 hallo zou iemand mij kunnen uitleggen hoe je een contact pagina maakt ik werk in dreamweaver al vast bedankt groet andre
post Geplaatst: 21 september 2009 Auteur Geplaatst: 21 september 2009 hallo het is gelukt groet andre
alx Geplaatst: 21 september 2009 Geplaatst: 21 september 2009 Fijn voor je. Ik ben allergisch voor pollen en mensen die regels uitvaardigen, maar er zichzelf niet aan houden. Amstrad650D2Mac>>TF5000PVR>>etc.>>/DB7025+/TF5300KPN,VU+Duo Moteqc2100a-schotel 1mtr-X-Cam/Aston 1.05.
Puch Geplaatst: 21 september 2009 Geplaatst: 21 september 2009 Met controle van correct invul of vliegt alles erdoor? iMac 27" macOS SierraiPhone 5s iOS 10
EL PIÑO Geplaatst: 26 september 2009 Geplaatst: 26 september 2009 Zo te zien vliegt alles erdoor en kunnen spammers dit scriptje in ieder geval gebruiken om hem nogal wat rotzooi te bezorgen bovendien. Dat is het risico als je standaardscripts gebruikt en (no offense) niet al te veel kennis hebt. Als je de bron hier even wegzet kunnen we je misschien helpen. Na jaren zonder, ben ik toch weer van plan een schotel aan te schaffen.
post Geplaatst: 26 september 2009 Auteur Geplaatst: 26 september 2009 Origineel bericht van: EL PIÑO Zo te zien vliegt alles erdoor en kunnen spammers dit scriptje in ieder geval gebruiken om hem nogal wat rotzooi te bezorgen bovendien. Dat is het risico als je standaardscripts gebruikt en (no offense) niet al te veel kennis hebt. Als je de bron hier even wegzet kunnen we je misschien helpen. dit is wat ik gebruikt heb<form method="post" action="distribution/phorm.php"> <input type="hidden" name="PHORM_CONFIG" value="quickconfig.php"> Naam: <br /> <input type="text" name="name" size=50 maxlength=50><br /><br /> E-mailadres:<br /> <input type="text" name="email" size=50 maxlength=50><br /><br /> Bericht:<br /> <textarea rows="5" cols="38" name="bericht"></textarea><br /><br /> <input type="submit""info@vhaastrecht.nl" value=" Verstuur "> met vriendelijke groet andre
Duwgati Geplaatst: 26 september 2009 Geplaatst: 26 september 2009 Ja dat is het formulier zelf. Maar de controle en verzending moet in phorm.php gebeuren. Dat is de code waar Pino naar vraagt.
EL PIÑO Geplaatst: 26 september 2009 Geplaatst: 26 september 2009 Ik werd een beetje getriggerd door dat mailadres achter de submit. Als je daar aan moet geven waar de mail naartoe moet dan kun je dus ieder adres gebruiken. En spammers weten dat ook. Na jaren zonder, ben ik toch weer van plan een schotel aan te schaffen.
post Geplaatst: 26 september 2009 Auteur Geplaatst: 26 september 2009 <?php /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Phorm v3.5.2 * * Copyright © 1998-2005 Holotech Enterprises (support@phorm.com) * * You may freely distribute this program as-is, without modifications, * and with all accompanying example files, modules and documentation in * the original distribution. If you are not sure whether you have a * valid distribution, you can obtain one from http://www.phorm.com/. * You may use this program freely, and modify it for your own purposes. * There is no charge for this program, but if you register it, you will: * * 1) Encourage me to continue developing it * 2) Automatically receive future releases * 3) Have free technical support for Phorm * 4) Earn my eternal gratitude * * Also, if you register, you will receive the file upload and file * attachment modules. Register at http://www.phorm.com/register/, * or include at least your name and email address, and send US$10 to: * * Alan Little * Holotech Enterprises * 775 Wagner Dr. #11 * Battle Creek, Michigan 49017 USA * * Please make checks and money orders payable to Alan Little. * * I hope you find this program useful. Aloha. * Alan Little * July 2005 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ // Return a message with simple variable substitution. function ph_Message($MessageKey) { global $ph_Messages; $Message = $ph_Messages[$MessageKey]; while (ereg("\\{\\{([^}]*)\\}\\}", $Message, $regs)) { $var = $regs[1]; global $$var; $Message = str_replace($regs[0], $$var, $Message); } return $Message; } /* Just to be sure */ $HTTP_REFERER = getenv("HTTP_REFERER"); $REMOTE_ADDR = getenv("REMOTE_ADDR"); $HTTP_HOST = getenv("HTTP_HOST"); if ($HTTP_HOST != "www.phorm.loc") error_reporting(E_ERROR | E_WARNING | E_PARSE); // Prevent global arrays from being included in each other // Necessary because Phorm is simulating register_globals = on $ph_globals = array( 'HTTP_SERVER_VARS', 'HTTP_ENV_VARS', 'HTTP_COOKIE_VARS', 'HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_POST_FILES', 'HTTP_SESSION_VARS', '_SERVER', '_ENV', '_COOKIE', '_GET', '_POST', '_POST_FILES', '_SESSION' ); $ph_globals2 = $ph_globals; while (list(,$ph_outer) = each($ph_globals)) { while (list(,$ph_inner) = each($ph_globals2)) { unset(${$ph_outer}[$ph_inner]); } reset($ph_globals2); } // Extract POST, GET, COOKIE, FILE and SERVER arrays in case register_globals is off if (is_array($_COOKIE)) $HTTP_COOKIE_VARS = $_COOKIE; if (is_array($_GET)) $HTTP_GET_VARS = $_GET; if (is_array($_POST)) $HTTP_POST_VARS = $_POST; if (is_array($_SERVER)) $HTTP_SERVER_VARS = $_SERVER; if (is_array($_FILES)) $HTTP_POST_FILES = $_FILES; if (is_array($HTTP_COOKIE_VARS)) extract($HTTP_COOKIE_VARS); if (is_array($HTTP_GET_VARS)) extract($HTTP_GET_VARS); if (is_array($HTTP_POST_VARS)) extract($HTTP_POST_VARS); if (is_array($HTTP_SERVER_VARS)) extract($HTTP_SERVER_VARS); if (is_array($HTTP_POST_FILES)) { while (list($ph_var, $ph_val) = each($HTTP_POST_FILES)) $$ph_var = $ph_val['tmp_name']; reset($HTTP_POST_FILES); } /* Unset any ph_ variables to prevent anyone from trying to sneak something in (such as ph_debug variables!) */ $ph_section = "unset ph"; while (list($ph_var, $ph_val) = each($GLOBALS)) { if (ereg("^ph_", $ph_var)) { unset($$ph_var); unset($ph_var); } } reset($GLOBALS); if (!isset($ph_ForceDec)) $ph_ForceDec = true; /* Process PHORM_ variables passed in, and set up the UpFiles array. If ForceDec is set, record and unset PHORM_ variables */ $ph_section = "unset phorm_"; while (list($ph_var, $ph_val) = each($GLOBALS)) { if (ereg("^PHORM_", $ph_var)) { if (ereg("^PHORM_FILE([0-9]{2})$", $ph_var, $ph_regs)) { $ph_UpFiles[$ph_regs[1]] = $ph_var; } if ($ph_ForceDec) { $ph_varHold[$ph_var] = $ph_val; unset($$ph_var); } } } reset($GLOBALS); $ph_Vers = "Phorm v3.5.2"; $ph_PHMVers = str_replace("Phorm v", "", $ph_Vers); $ph_FILVers = "3.5.2"; $ph_PHPMinVers = "3.0.9"; // Set up paths $ph_root = getenv("PHORM_ROOT"); if (strlen($ph_root) && (!is_dir($ph_root) || !is_dir("$ph_root/lib"))) { $ph_Alerts['999'] = "%%% - Invalid directory $ph_root in environment variable PHORM_ROOT."; unset($ph_root); } if (!$ph_root) $ph_root = "."; $ph_root = ereg_replace("[/\\\]$", "", $ph_root); $ph_cwd = $ph_root; $ph_tpd = $ph_cwd; $ph_atd = $ph_cwd; $ph_upd = $ph_cwd; if (is_dir("$ph_cwd/templates")) $ph_tpd.= "/templates"; if (is_dir("$ph_cwd/attachments")) $ph_atd.= "/attachments"; if (is_dir("$ph_cwd/uploads")) $ph_upd.= "/uploads"; if (file_exists("debugz.php")) include("debugz.php"); // Load the alert and error messages if (is_readable("$ph_root/lib/messages.txt")) { $ph_msgfile = file("$ph_root/lib/messages.txt"); while (list(,$ph_mline) = each($ph_msgfile)) { $ph_mline = trim($ph_mline); if (!$ph_mline || ereg("^#", $ph_mline)) continue; // split() instead of explode() for the limit parm in PHP3 list($ph_mkey, $ph_msg) = split(" ", $ph_mline, 2); $ph_Messages[$ph_mkey] = $ph_msg; } unset($ph_msgfile); } else { $ph_Alerts['00M'] = "%%% - Critical Alert: unable to access alert & error messages file."; } // Load the plugins registry. if (is_readable("$ph_root/plugins/registry.php") && !$ph_Abort) { if ($ph_debug3) echo "<B>NS:</B> Registry Load<BR>"; $ph_registry = file("$ph_root/plugins/registry.php"); while (list(, $ph_regline) = each($ph_registry)) { $ph_regline = trim($ph_regline); if (!$ph_regline || !ereg("^< |^> ", $ph_regline)) continue; list($ph_beaf, $ph_stage, $ph_plfile) = explode(" ", trim($ph_regline)); $ph_plfile = basename($ph_plfile); $ph_plugbase = str_replace(strrchr($ph_plfile, "."), "", $ph_plfile); if (file_exists("$ph_root/plugins/$ph_plugbase/$ph_plfile")) $ph_plfile = "$ph_plugbase/$ph_plfile"; if ($ph_debug32) echo "<B>Plugin:</B> $ph_beaf|$ph_stage|$ph_plfile<BR>"; $ph_stage = $ph_beaf.$ph_stage; $ph_plfile = "$ph_root/plugins/$ph_plfile"; $ph_Plugins[$ph_stage].= "$ph_plfile|"; } unset($ph_registry); } // Load the function library and MIME types $ph_section = "setup"; $ph_LibLoad = false; if (!$ph_Abort) { if ($ph_debug3) echo "<B>NS:</B> Library Load..."; if (is_readable("$ph_root/lib/functions.php")) { include("$ph_root/lib/functions.php"); if ($ph_debug3) echo "done<BR>"; if ($ph_LibVersion != $ph_Vers) { $ph_Errs['001'] = ph_Message("E001"); $ph_Abort = true; } } else { if ($ph_debug3) echo "failed<BR>"; $ph_Errs['000'] = ph_Message("E000"); $ph_Abort = true; } // A missing MIME types file is only a problem if the fileattach module is present. if (is_readable("$ph_root/lib/mimetypes.php")) { include("$ph_root/lib/mimetypes.php"); } else { if (is_readable("$ph_root/lib/fileattach.php")) { $ph_Errs['002'] = ph_Message("E002"); $ph_Abort = true; } } } // Check the PHP version if (!$ph_Abort) { if (!ph_CheckVers($ph_PHPMinVers)) { $ph_Errs['003'] = ph_Message('E003'); $ph_Abort = true; } } if (isset($CONTENT_TYPE)) { // Check file_uploads if user is uploading. if (ereg('^multipart/form-data', $CONTENT_TYPE) && ph_CheckVers('4.0.0') && !ini_get('file_uploads')) { $ph_Alerts['009'] = ph_Message('A009'); $ph_Errs['009'] = ph_Message('E009'); $ph_Abort = true; } } if ($ph_debug2) echo '<B>JS:</B> Setup 1<BR>'; define('ph_OVERWRITE', 1); define('ph_MAKEUNIQUE', 2); define('ph_MAKEUNIQUESAVED', 3); define('ph_DISCARD', 4); define('ph_DECLARE', '::FORM::'); define('ph_GENERIC', '::generic::'); $ph_extns = array('php', 'php3', 'php4', 'inc', 'txt'); $ph_UpLoads = is_readable("$ph_root/lib/fileupload.php"); $ph_vRegs[0] = '\\{\\{([^}]*)\\}\\}'; $ph_vRegs[1] = '\{\{([^}]*)\}\}'; $ph_vRegs[2] = '{{([^}]*)}}'; $ph_vRegs[3] = '{{2}([^}]*)}{2}'; $ph_vRegs[4] = '\{{2}([^}]*)\}{2}'; $ph_vRegs[5] = '[{]{2}([^}]*)[}]{2}'; $ph_vRegs[6] = '<<([^>]*)>>'; $ph_vRegs[7] = '\\{\\{([A-Za-z0-9_]*)\\}\\}'; $ph_vRegs[8] = '\{\{([A-Za-z0-9_]*)\}\}'; $ph_vRegs[9] = '{{([A-Za-z0-9_]*)}}'; $ph_vRegs[10] = '{{2}([A-Za-z0-9_]*)}{2}'; $ph_vRegs[11] = '\{{2}([A-Za-z0-9_]*)\}{2}'; $ph_vRegs[12] = '[{]{2}([A-Za-z0-9_]*)[}]{2}'; $ph_vRegs[13] = '<<([A-Za-z0-9_]*)>>'; $ph_dbLogged = false; $ph_txLogged = false; $ph_eMailed = false; $ph_ErrLevel = 0; srand((double)microtime()*1000000); $ph_HTLink = "<BR><BR><CENTER><FONT SIZE=1>". "<A HREF=\"http://www.phorm.com/\">$ph_Vers</A>". "</FONT></CENTER>"; $ph_HTTag = "\n\n\n\n-- \n$ph_Vers by Holotech Enterprises http://www.holotech.net/"; $ph_config_delim = "\t"; $ph_MaxTMPL = 25; $ph_GotData = false; $ph_Acked = false; $ph_Cards['mastercard'] = 'mcd'; $ph_Cards['visa'] = 'vis'; $ph_Cards['american express'] = 'amx'; $ph_Cards['discover'] = 'dsc'; $ph_Cards['diners club'] = 'dnc'; $ph_Cards['delta'] = 'dlt'; $ph_Cards['switch'] = 'swi'; $ph_Cards['mcd'] = 'Mastercard'; $ph_Cards['vis'] = 'Visa'; $ph_Cards['amx'] = 'American Express'; $ph_Cards['dsc'] = 'Discover'; $ph_Cards['dnc'] = 'Diners Club'; $ph_Cards['dlt'] = 'Delta'; $ph_Cards['swi'] = 'Switch'; $ph_Cards['jcb'] = 'JCB'; $ph_UploadDir = get_cfg_var('upload_tmp_dir'); $ph_MultiArgs = array ('ONEOF', 'FLDLEN', 'RANGE', 'UNIQUE', 'EXISTS', 'FILEEXT'); // Process plugins $ph_stage = ">setu1"; if ($ph_debug34) echo "<B>Stage: </B>".str_replace("<", "<", $ph_stage)."<BR>"; $ph_PlugList = explode("|", $ph_Plugins[$ph_stage]); while (list(, $ph_plfile) = each($ph_PlugList)) { if (!$ph_plfile) continue; if ($ph_debug33) echo "Plugin <B>$ph_plfile</B> at ".str_replace("<", "<", $ph_stage)."<BR>"; if (is_readable($ph_plfile)) { include ($ph_plfile); if ($ph_LibLoad) ph_PlugStat("", "Store"); } else { $ph_Alerts['000'] = ph_Message("A000"); } } $ph_stage = "<gcnfg"; if ($ph_debug34) echo "<B>Stage: </B>".str_replace("<", "<", $ph_stage)."<BR>"; $ph_PlugList = explode("|", $ph_Plugins[$ph_stage]); while (list(, $ph_plfile) = each($ph_PlugList)) { if (!$ph_plfile) continue; if ($ph_debug33) echo "Plugin <B>$ph_plfile</B> at ".str_replace("<", "<", $ph_stage)."<BR>"; if (is_readable($ph_plfile)) { include ($ph_plfile); if ($ph_LibLoad) ph_PlugStat("", "Store"); } else { $ph_Alerts['000'] = ph_Message("A000"); } } // Restore $PHORM_NAME and $PHORM_BASE for phormbase operation $PHORM_NAME = $ph_varHold["PHORM_NAME"]; $PHORM_BASE = $ph_varHold["PHORM_BASE"]; ph_oveuh(); /* Process phormbase */ $ph_section = "phormbase"; if ($PHORM_NAME && !$PHORM_BASE) $PHORM_BASE = $PHORM_NAME; if ($PHORM_BASE && !$PHORM_NAME) $PHORM_NAME = $PHORM_BASE; if ($PHORM_NAME && !$ph_Abort) { while (list(,$ph_extn) = each($ph_extns)) { $ph_phormbase = "$ph_root/phormbase.$ph_extn"; if (file_exists($ph_phormbase)) break; } reset($ph_extns); if ($ph_debug3) echo "<B>NS:</B> $ph_phormbase<BR>"; if (!$ph_BaseFile = @file($ph_phormbase)) { $ph_Errs['010'] = ph_Message("E010"); if ($php_errormsg) $ph_Errs['010P'] = "%%%: $php_errormsg"; $ph_Abort = true; } else { if ($ph_debug3) echo "<B>NS:</B> Phormbase ($PHORM_NAME: "; $ph_linenum = 1; while (list(,$ph_bline) = each($ph_BaseFile)) { $ph_bline = trim($ph_bline); list($ph_form, $ph_path) = split("[ \t]*:[ \t]*|$ph_config_delim", $ph_bline); $ph_path = trim($ph_path); if ($ph_bline && !$ph_path) $ph_Alerts['020'] = ph_Message("A020"); if ($ph_form == $PHORM_NAME) { if (!ereg("^[/\\\]", $ph_path)) $ph_path = "$ph_root/$ph_path"; if ($ph_debug3) echo "$ph_path)<BR>"; $ph_basedir = $ph_path; } $ph_linenum++; } if ($ph_debug3 && !strlen($ph_basedir)) echo "No match)<BR>"; } } unset($PHORM_BASE); /* Check for the phormconfig file and process it */ $ph_section = "phormconfig"; while (list(,$ph_extn) = each($ph_extns)) { $ph_phormconfig = "$ph_root/phormconfig.$ph_extn"; if (file_exists($ph_phormconfig)) break; } reset($ph_extns); if (file_exists($ph_phormconfig)) { if ($ph_debug3) echo "<B>NS:</B> $ph_phormconfig<BR>"; if (!is_readable($ph_phormconfig)) { $ph_Errs['020'] = ph_Message("E020"); $ph_Abort = true; } else { include ("$ph_phormconfig"); } } $ph_nl = ($PHORM_EMCRLF)? "\r\n" : "\n"; /* Check the Referer */ $ph_section = "referer"; if ($PHORM_REFERER && !$ph_Abort) { if ($ph_debug3) echo "<B>NS:</B> Referer<BR>"; ereg("https?://([^/]*)/([^?]*)", $HTTP_REFERER, $ph_regs); $ph_RefHost = $ph_regs[1]; $ph_RefPath = $ph_regs[2]; if (!ereg("\|$ph_RefHost\|", $PHORM_REFERER) && !ereg("\|$ph_RefHost/$ph_RefPath\|", $PHORM_REFERER)) { $ph_Errs['080'] = ph_Message("E080"); $ph_Abort = true; } } // Set the regex to use for variable substitution. $ph_section = "regex"; if ($ph_Regex) $PHORM_REGEX = $ph_Regex; if ($ph_RegEx) $PHORM_REGEX = $ph_RegEx; if (!$PHORM_REGEX) $PHORM_REGEX = 0; if ($PHORM_REGEX > 13) $PHORM_REGEX = 13; $ph_vReg = $ph_vRegs[$PHORM_REGEX]; if ($ph_debug31) echo "<B>REGEX:</B> ".ereg_replace("<", "<", $ph_vReg)."<BR>\n"; // Process plugins $ph_stage = ">gcnfg"; if ($ph_debug34) echo "<B>Stage: </B>".str_replace("<", "<", $ph_stage)."<BR>"; $ph_PlugList = explode("|", $ph_Plugins[$ph_stage]); while (list(, $ph_plfile) = each($ph_PlugList)) { if (!$ph_plfile) continue; if ($ph_debug33) echo "Plugin <B>$ph_plfile</B> at ".str_replace("<", "<", $ph_stage)."<BR>"; if (is_readable($ph_plfile)) { include ($ph_plfile); if ($ph_LibLoad) ph_PlugStat("", "Store"); } else { $ph_Alerts['000'] = ph_Message("A000"); } } $ph_stage = "<lcnfg"; if ($ph_debug34) echo "<B>Stage: </B>".str_replace("<", "<", $ph_stage)."<BR>"; $ph_PlugList = explode("|", $ph_Plugins[$ph_stage]); while (list(, $ph_plfile) = each($ph_PlugList)) { if (!$ph_plfile) continue; if ($ph_debug33) echo "Plugin <B>$ph_plfile</B> at ".str_replace("<", "<", $ph_stage)."<BR>"; if (is_readable($ph_plfile)) { include ($ph_plfile); if ($ph_LibLoad) ph_PlugStat("", "Store"); } else { $ph_Alerts['000'] = ph_Message("A000"); } } /* Restore the value of PHORM_CONFIG */ $PHORM_CONFIG = $ph_varHold["PHORM_CONFIG"]; /* Check $PHORM_RCONFIG */ $ph_section = "phorm_rconfig"; $PHORM_RCONFIG = (!isset($PHORM_RCONFIG) || ($PHORM_RCONFIG != false && $PHORM_RCONFIG != "N")); if (($PHORM_RCONFIG && !$PHORM_CONFIG) || (!count($HTTP_POST_VARS) && !count($HTTP_GET_VARS))) { $ph_Abort = true; if ($PHORM_URL) $ph_Redirect = $PHORM_URL; else $ph_Errs['040'] = ph_Message("E040"); } /* If there was a match in the phormbase file, change $ph_cwd to the specified dir */ $ph_section = "chdir 1"; if ($ph_basedir && !$ph_Abort) { if ($ph_debug3) echo "<B>NS:</B> cwd $ph_basedir<BR>"; if (!is_dir($ph_basedir)) { $ph_Errs['030'] = ph_Message("E030"); $ph_Abort = true; } else { $ph_cwd = $ph_basedir; $ph_tpd = $ph_cwd; $ph_atd = $ph_cwd; $ph_upd = $ph_cwd; if (is_dir("$ph_cwd/templates")) $ph_tpd.= "/templates"; if (is_dir("$ph_cwd/attachments")) $ph_atd.= "/attachments"; if (is_dir("$ph_cwd/uploads")) $ph_upd.= "/uploads"; } } /* Process the form-specific configuration file, if any */ $ph_section = "phorm_config"; if ($PHORM_CONFIG && !$ph_Abort) { if ($ph_debug3) echo "<B>NS:</B> PHORM_CONFIG ($ph_cwd/$PHORM_CONFIG)<BR>"; // Strip any path info $PHORM_CONFIG = basename($PHORM_CONFIG); // If it's there and readable, include it; else generate an error. if (is_readable("$ph_cwd/$PHORM_CONFIG")) { include("$ph_cwd/$PHORM_CONFIG"); } else { $ph_Errs['050'] = ph_Message("E050"); $ph_Abort = true; } } /* If $PHORM_BASE was set in the config file, change to the specified dir */ $ph_section = "chdir 2"; if ($PHORM_BASE && !$ph_Abort) { if ($ph_debug3) echo "<B>NS:</B> $PHORM_CONFIG: $PHORM_BASE<BR>"; if (!ereg("^[/\\\]", $PHORM_BASE)) $PHORM_BASE = "$ph_root/$PHORM_BASE"; if (!is_dir($PHORM_BASE)) { $ph_Errs['060'] = ph_Message("E060"); $ph_Abort = true; } else { $ph_cwd = $PHORM_BASE; $ph_tpd = $ph_cwd; $ph_atd = $ph_cwd; $ph_upd = $ph_cwd; if (is_dir("$ph_cwd/templates")) $ph_tpd.= "/templates"; if (is_dir("$ph_cwd/attachments")) $ph_atd.= "/attachments"; if (is_dir("$ph_cwd/uploads")) $ph_upd.= "/uploads"; } } /* Restore only the declared configuration variables from the form */ $ph_section = "restore phorm_"; if ($ph_ForceDec && is_array($ph_varHold) && !$ph_Abort) { while (list($ph_var, $ph_val) = each($ph_varHold)) { if ($$ph_var == ph_DECLARE) { $$ph_var = $ph_varHold[$ph_var]; if (ereg("^PHORM_FILE([0-9]{2})$", $ph_var, $ph_regs)) { $ph_fvar = $ph_var."_name"; $$ph_fvar = $ph_varHold[$ph_fvar]; $ph_fvar = $ph_var."_size"; $$ph_fvar = $ph_varHold[$ph_fvar]; $ph_fvar = $ph_var."_type"; $$ph_fvar = $ph_varHold[$ph_fvar]; } } } } $ph_ParseCode = ($ph_LibLoad && ph_CheckVers("4.0.0") && $PHORM_PARSPHP); if (!$PHORM_LINEBRK) $PHORM_LINEBRK = str_replace(" ", "", " "); $PHORM_LINEBRK = str_replace("CR", "\r", $PHORM_LINEBRK); $PHORM_LINEBRK = str_replace("LF", "\n", $PHORM_LINEBRK); // You can't use $PHORM_ACK and $PHORM_RDIRECT together. if (strlen($PHORM_ACK) && strlen($PHORM_RDIRECT)) { unset($PHORM_RDIRECT); $ph_Alerts['100'] = ph_Message("A100"); } // If $PHORM_ACK, $PHORM_RDIRECT and $PHORM_POSTINC are not set, use the generic // ack template. if (!strlen($PHORM_ACK) && !strlen($PHORM_RDIRECT) && !strlen($PHORM_POSTINC)) { $PHORM_ACK = ph_GENERIC; } if (strlen($PHORM_RDIRECT)) $ph_Redirect = $PHORM_RDIRECT; // Process plugins $ph_stage = ">lcnfg"; if ($ph_debug34) echo "<B>Stage: </B>".str_replace("<", "<", $ph_stage)."<BR>"; $ph_PlugList = explode("|", $ph_Plugins[$ph_stage]); while (list(, $ph_plfile) = each($ph_PlugList)) { if (!$ph_plfile) continue; if ($ph_debug33) echo "Plugin <B>$ph_plfile</B> at ".str_replace("<", "<", $ph_stage)."<BR>"; if (is_readable($ph_plfile)) { include ($ph_plfile); if ($ph_LibLoad) ph_PlugStat("", "Store"); } else { $ph_Alerts['000'] = ph_Message("A000"); } } $ph_section = "setup 2"; $ph_TextLog = (isset($PHORM_LOG) && isset($PHORM_LOGVAR)); // Try to be smart about a few $PHORM_ variables (hope I'm not MSing) if (strlen($PHORM_TO) && !strlen($PHORM_ALERTTO)) $PHORM_ALERTTO = $PHORM_TO; if (!strlen($PHORM_TMPL)) $PHORM_TMPL = ph_GENERIC; if (!strlen($PHORM_SUBJECT)) $PHORM_SUBJECT = "Phorm Data"; if (!isset($PHORM_FROM)) { if (isset($Email)) $PHORM_FROM = $Email; elseif (isset($EMail)) $PHORM_FROM = $EMail; elseif (isset($email)) $PHORM_FROM = $email; elseif (isset($PHORM_TO)) $PHORM_FROM = $PHORM_TO; else $PHORM_FROM = $PHORM_ALERTTO; } // Convert "array-able" variables to arrays if they aren't. if (isset($PHORM_LOG)) { settype($PHORM_LOG, "array"); list($ph_TextLogFirstKey) = each($PHORM_LOG); reset($PHORM_LOG); } if (isset($PHORM_LOGVAR)) settype($PHORM_LOGVAR, "array"); if (isset($PHORM_TMPL)) settype($PHORM_TMPL, "array"); if (isset($PHORM_TO)) settype($PHORM_TO, "array"); if (isset($PHORM_EFROM)) settype($PHORM_EFROM, "array"); if (isset($PHORM_SUBJECT)) settype($PHORM_SUBJECT, "array"); if (isset($PHORM_HEADERS)) settype($PHORM_HEADERS, "array"); $aPHORM_MYTABLE = is_array($PHORM_MYTABLE); if (isset($PHORM_MYTABLE)) settype($PHORM_MYTABLE, "array"); if (isset($PHORM_MYVARS)) settype($PHORM_MYVARS, "array"); // Set the text log delimiter if it isn't settype($PHORM_LDELIM, "array"); if (!isset($PHORM_LDELIM[0])) $PHORM_LDELIM[0] = "\t"; // Set the text log quote character if it isn't settype($PHORM_LOGQUOT, "array"); if (!isset($PHORM_LOGQUOT[0])) $PHORM_LOGQUOT[0] = "'"; // Include the database variables file. $ph_section = "dbv"; if ($PHORM_MYDBV && !$ph_Abort) { if ($ph_debug3) echo "<B>NS:</B> Read database variables from $ph_tpd/$PHORM_MYDBV<BR>"; if (is_readable("$ph_tpd/$PHORM_MYDBV")) { include("$ph_tpd/$PHORM_MYDBV"); } else { $ph_Alerts['007'] = ph_Message("A007"); } } // Check file attachment module version if (is_readable("$ph_root/lib/fileattach.php")) { $ph_fmode = "CheckVers"; include "$ph_root/lib/fileattach.php"; if ($ph_FATVers != $ph_FILVers) $ph_Alerts['163'] = ph_message("A163"); } // Process plugins $ph_stage = ">setu2"; if ($ph_debug34) echo "<B>Stage: </B>".str_replace("<", "<", $ph_stage)."<BR>"; $ph_PlugList = explode("|", $ph_Plugins[$ph_stage]); while (list(, $ph_plfile) = each($ph_PlugList)) { if (!$ph_plfile) continue; if ($ph_debug33) echo "Plugin <B>$ph_plfile</B> at ".str_replace("<", "<", $ph_stage)."<BR>"; if (is_readable($ph_plfile)) { include ($ph_plfile); if ($ph_LibLoad) ph_PlugStat("", "Store"); } else { $ph_Alerts['000'] = ph_Message("A000"); } } $ph_stage = "<filup"; if ($ph_debug34) echo "<B>Stage: </B>".str_replace("<", "<", $ph_stage)."<BR>"; $ph_PlugList = explode("|", $ph_Plugins[$ph_stage]); while (list(, $ph_plfile) = each($ph_PlugList)) { if (!$ph_plfile) continue; if ($ph_debug33) echo "Plugin <B>$ph_plfile</B> at ".str_replace("<", "<", $ph_stage)."<BR>"; if (is_readable($ph_plfile)) { include ($ph_plfile); if ($ph_LibLoad) ph_PlugStat("", "Store"); } else { $ph_Alerts['000'] = ph_Message("A000"); } } /* Process file uploads */ if ($ph_UpFiles && !$ph_Abort) { if (!$ph_UpLoads) { $ph_Alerts['011'] = ph_Message("A011"); } else { $ph_fmode = "CheckVers"; include "$ph_root/lib/fileupload.php"; if ($ph_FUPVers == $ph_FILVers) { include "$ph_root/lib/fileupload.php"; } else { $ph_Alerts['153'] = ph_message("A153"); } } } // Process plugins $ph_stage = ">filup"; if ($ph_debug34) echo "<B>Stage: </B>".str_replace("<", "<", $ph_stage)."<BR>"; $ph_PlugList = explode("|", $ph_Plugins[$ph_stage]); while (list(, $ph_plfile) = each($ph_PlugList)) { if (!$ph_plfile) continue; if ($ph_debug33) echo "Plugin <B>$ph_plfile</B> at ".str_replace("<", "<", $ph_stage)."<BR>"; if (is_readable($ph_plfile)) { include ($ph_plfile); if ($ph_LibLoad) ph_PlugStat("", "Store"); } else { $ph_Alerts['000'] = ph_Message("A000"); } } $ph_stage = "<dbopn"; if ($ph_debug34) echo "<B>Stage: </B>".str_replace("<", "<", $ph_stage)."<BR>"; $ph_PlugList = explode("|", $ph_Plugins[$ph_stage]); while (list(, $ph_plfile) = each($ph_PlugList)) { if (!$ph_plfile) continue; if ($ph_debug33) echo "Plugin <B>$ph_plfile</B> at ".str_replace("<", "<", $ph_stage)."<BR>"; if (is_readable($ph_plfile)) { include ($ph_plfile); if ($ph_LibLoad) ph_PlugStat("", "Store"); } else { $ph_Alerts['000'] = ph_Message("A000"); } } /* Open the database */ $ph_section = "open db"; if ($ph_debug71) echo "<B>Host:</B> $DHost <B>User:</B> $DUser <B>Pass:</B> $DPass <B>Base:</B> $DBase<BR>"; if (isset($DHost) && isset($DUser) && isset($DPass) && isset($DBase) && !$ph_Abort) { if ($ph_debug3) echo "<B>NS:</B> Open Database<BR>"; $ph_ID = @mysql_connect($DHost, $DUser, $DPass); if (!$ph_ID) { $ph_Alerts['030'] = ph_Message("A030"); if ($php_errormsg) $ph_Alerts['030P'] = "%%%: $php_errormsg"; } else { $ph_selected = @mysql_select_db($DBase, $ph_ID); if (!$ph_selected) { $ph_Alerts['031'] = ph_Message("A031"); if ($php_errormsg) $ph_Alerts['031P'] = "%%%: $php_errormsg"; } } $ph_dbOpen = ($ph_ID && $ph_selected); } // Process plugins $ph_stage = ">dbopn"; if ($ph_debug34) echo "<B>Stage: </B>".str_replace("<", "<", $ph_stage)."<BR>"; $ph_PlugList = explode("|", $ph_Plugins[$ph_stage]); while (list(, $ph_plfile) = each($ph_PlugList)) { if (!$ph_plfile) continue; if ($ph_debug33) echo "Plugin <B>$ph_plfile</B> at ".str_replace("<", "<", $ph_stage)."<BR>"; if (is_readable($ph_plfile)) { include ($ph_plfile); if ($ph_LibLoad) ph_PlugStat("", "Store"); } else { $ph_Alerts['000'] = ph_Message("A000"); } } // Load and parse the rules file. if ($PHORM_VALDEFS && !$ph_Abort) { $PHORM_VALDEFS = basename($PHORM_VALDEFS); if ($ph_debug2) echo "<B><B>JS:</B></B> ValDefs ($ph_tpd/$PHORM_VALDEFS)<BR>"; if (!$ph_RuleFile = @file("$ph_tpd/$PHORM_VALDEFS")) { $ph_Alerts['008'] = ph_Message("A008"); if ($php_errormsg) $ph_Alerts['008P'] = "%%%: $php_errormsg"; } else { if ($PHORM_OLDVAL && is_readable("$ph_root/lib/oldval.php")) { include ("$ph_root/lib/oldval.php"); } else { $ph_Files = array(""); $ph_RuleFile = ereg_replace("\r\n?", "\n", implode('', $ph_RuleFile)); $ph_RuleFile = split("\n *###[\n ]*", $ph_RuleFile); $ph_RuleNum = 0; while (list($ph_key, $ph_Rule) = each($ph_RuleFile)) { $ph_Rule = explode("\n", $ph_Rule); if (count($ph_Rule) < 2) continue; $ph_RuleNum++; unset ($ph_RULE); unset ($ph_CRIT); unset ($ph_FFLD); unset ($ph_ARGS); unset ($ph_COND); unset ($ph_LEVL); unset ($ph_CMNT); unset ($ph_MESG); unset ($ph_mode); while (list(,$ph_element) = each($ph_Rule)) { $ph_element = trim($ph_element); list($ph_token, $ph_tknval) = split(' *: *', $ph_element, 2); $ph_token = strtoupper($ph_token); switch ($ph_token) { case 'FILES' : $ph_RuleNum--; $ph_mode = 'FILE'; break; case 'RULE' : $ph_RULE = $ph_tknval; break; case 'CRIT' : case 'CRITERION' : $ph_CRIT = $ph_tknval; break; case 'ARGS' : case 'ARGUMENTS' : case 'ARGUMENT' : $ph_ARGS = $ph_tknval; ph_VarSub($ph_ARGS); break; case 'COND' : case 'CONDITION' : $ph_COND = $ph_tknval; break; case 'FFLD' : case 'FIELD' : case 'FORM FIELD' : case 'FORMFIELD' : $ph_FFLD = $ph_tknval; break; case 'LEVL' : case 'LEVEL' : $ph_LEVL = $ph_tknval; break; case 'CMNT' : case 'COMMENT' : case 'COMMENTS' : $ph_CMNT = $ph_tknval; break; case 'MESG' : case 'MESSAGE' : $ph_MESG = $ph_tknval; $ph_mode = 'MESG'; break; default : if ($ph_mode == "FILE") $ph_Files[] = $ph_element; if ($ph_mode == "MESG") $ph_MESG.= "$ph_element "; break; } } if ($ph_mode != "FILE") { $ph_RuleIdx = (isset($ph_RULE))? $ph_RULE : $ph_RuleNum; // Split arguments for multi-argument criteria if (in_array($ph_CRIT, $ph_MultiArgs)) { $ph_ARGS = str_replace('\ ', "\3", $ph_ARGS); $ph_ARGS = split(' +', $ph_ARGS); while (list($ph_ix, $ph_arg) = each($ph_ARGS)) { $ph_ARGS[$ph_ix] = str_replace("\3", ' ', $ph_arg); } } else settype($ph_ARGS, 'array'); $ph_Rules[$ph_RuleIdx] = array ( "CRIT" => $ph_CRIT, "FFLD" => $ph_FFLD, "ARGS" => $ph_ARGS, "COND" => $ph_COND, "LEVL" => $ph_LEVL, "CMNT" => $ph_CMNT, "MESG" => $ph_MESG ); } } } } } // Load plugin criteria if (!$ph_Abort) { $ph_vdir = opendir("$ph_root/plugins/validation/"); while ($ph_entry = readdir($ph_vdir)) { if (ereg("(.*)\.crit$", $ph_entry, $ph_regs)) { $ph_CRIT = strtoupper($ph_regs[1]); $ph_critfile = implode('', file("$ph_root/plugins/validation/$ph_entry")); if (ereg('\[CRIT:([A-Za-z]*)\]', $ph_critfile, $ph_regs)) { $ph_CRIT = strtoupper($ph_regs[1]); } $ph_ExtCrits[$ph_CRIT] = "$ph_root/plugins/validation/$ph_entry"; } } } $ph_stage = "<valid"; if ($ph_debug34) echo "<B>Stage: </B>".str_replace("<", "<", $ph_stage)."<BR>"; $ph_PlugList = explode("|", $ph_Plugins[$ph_stage]); while (list(, $ph_plfile) = each($ph_PlugList)) { if (!$ph_plfile) continue; if ($ph_debug33) echo "Plugin <B>$ph_plfile</B> at ".str_replace("<", "<", $ph_stage)."<BR>"; if (is_readable($ph_plfile)) { include ($ph_plfile); if ($ph_LibLoad) ph_PlugStat("", "Store"); } else { $ph_Alerts['000'] = ph_Message("A000"); } } /* Perform data validation */ $ph_section = "validation"; if ($PHORM_VALDEFS && is_array($ph_Rules) && !$ph_Abort) { while (list($ph_RuleNum, $ph_Rule) = each($ph_Rules)) { unset ($ph_CRIT); unset ($ph_FFLD); unset ($ph_ARGS); unset ($ph_COND); unset ($ph_LEVL); unset ($ph_CMNT); unset ($ph_MESG); extract($ph_Rule, EXTR_PREFIX_ALL, "ph"); if (!$ph_CRIT || !$ph_FFLD || !$ph_MESG) { if (!$ph_CRIT) $ph_Alerts['071'] = ph_Message("A071"); if (!$ph_FFLD) $ph_Alerts['072'] = ph_Message("A072"); if (!$ph_MESG) $ph_Alerts['073'] = ph_Message("A073"); continue; } if (!isset($ph_LEVL)) $ph_LEVL = 1; if ($ph_debug42) echo " <B>vd:</B>$ph_CRIT ($ph_COND)|$ph_FFLD|$ph_LEVL|$ph_CMNT<BR>"; $ph_ValErr = false; $ph_ValCondition = true; $ph_FFLD = ereg_replace("^\$", "", $ph_FFLD); $ph_ffld = $ph_FFLD; if (!strlen($ph_COND)) $ph_COND = "true"; ph_VarSub($ph_COND); if (!ereg('^\((.*)\)$', $ph_COND)) $ph_COND = "($ph_COND)"; if ($ph_debug36) echo "<B>Phorm@".(__LINE__ + 1)."</B> \$ph_ValCondition = $ph_COND ? true : false;<BR>"; eval("\$ph_ValCondition = $ph_COND ? true : false;"); if (is_int(strpos($ph_CRIT, "FILE"))) { $ph_FILEID = $ph_FFLD; $ph_FFLD = "PHORM_FILE$ph_FFLD"; } $ph_FFLD = str_replace(".", ".$", $ph_FFLD); if ($ph_debug36) echo "<B>Phorm@".(__LINE__ + 1)."</B> \$ph_Val = \$$ph_FFLD;<BR>"; eval("\$ph_Val = \$$ph_FFLD;"); $ph_skipped = ($ph_ValCondition)? "" : "<FONT COLOR=CRIMSON>(skipped)</FONT><BR>"; if ($ph_debug421) echo " <B>vd:</B>#$ph_RuleNum $ph_CRIT [$ph_ffld:$ph_Val] $ph_skipped"; if (!$ph_ValCondition) continue; switch ($ph_CRIT) { case "REQ" : if (!strlen(trim($ph_Val))) $ph_ValErr = true; break; case "EMAIL" : if (!strlen(trim($ph_Val))) break; $ph_EmLevel = $ph_ARGS[0]; if (!$ph_EmLevel) $ph_EmLevel = 2; if (trim($ph_Val) && ph_MailChek($ph_Val, $ph_EmLevel)) $ph_ValErr = true; break; case "CCARD" : if (!$ph_ARGS[0]) $ph_Alerts['051'] = ph_Message("A051"); if (!strlen(trim($ph_Val))) break; $ph_Valh = $ph_Val; // Strip any non-digits out of the card number $ph_CType = $$ph_ARGS[0]; $ph_CType = strtolower($ph_CType); if (strlen($ph_CType) > 3) $ph_CType = $ph_Cards[$ph_CType]; $ph_Val = ereg_replace("[^0-9]", "", $ph_Val); if (strlen($ph_Val) < 12) $ph_CType = ""; $ph_CVal = false; switch ($ph_CType) { case "mcd" : $ph_CVal = (ereg("^5[1-5].{14}$", $ph_Val) && ph_luhn($ph_Val)); break; case "vis" : $ph_CVal = (ereg("^4.{15}$|^4.{12}$", $ph_Val) && ph_luhn($ph_Val)); break; case "amx" : $ph_CVal = (ereg("^3[47].{13}$", $ph_Val) && ph_luhn($ph_Val)); break; case "dsc" : $ph_CVal = (ereg("^6011.{12}$", $ph_Val) && ph_luhn($ph_Val)); break; case "dnc" : $ph_CVal = (ereg("^30[0-5].{11}$|^3[68].{12}$", $ph_Val) && ph_luhn($ph_Val)); break; case "jcb" : $ph_CVal = (ereg("^3.{15}$|^2131|1800.{11}$", $ph_Val) && ph_luhn($ph_Val)); break; case "dlt" : $ph_CVal = (ereg("^4.{15}$", $ph_Val) && ph_luhn($ph_Val)); break; case "swi" : $ph_CVal = (ereg("^[456].{15}$|^[456].{17,18}$", $ph_Val) && ph_luhn($ph_Val)); break; case "enr" : $ph_CVal = (ereg("^2014|.{11}$|^2149.{11}$", $ph_Val) && ph_luhn($ph_Val)); break; } // switch ($ph_CType) if ($ph_Valh && !$ph_CVal) $ph_ValErr = true; break; case "FILEREQ" : if ($ph_FileTable[$ph_FILEID]['stat'] == 1) $ph_ValErr = true; break; case "NOFILE" : if ($ph_FileTable[$ph_FILEID]['stat'] == 2) $ph_ValErr = true; break; case "FILEDSC" : if ($ph_FileTable[$ph_FILEID]['stat'] == 6) $ph_ValErr = true; break; case "FILEEXT" : if (!isset($ph_ARGS[0])) $ph_Alerts['066'] = ph_Message("A066"); $ph_FileExtn = strtolower($ph_FileTable[$ph_FILEID]['extn']); $ph_aidx = 0; $ph_Match = false; while ($ph_ARGS[$ph_aidx]) if (strtolower($ph_ARGS[$ph_aidx++]) == $ph_FileExtn) $ph_Match = true; if ($ph_FileExtn && !$ph_Match) { $ph_ValErr = true; if (!ereg('[1236]', $ph_FileTable[$ph_FILEID]['stat'])) @unlink("$ph_upd/".$ph_FileTable[$ph_FILEID]['full']); } break; case "FILESIZ" : if (!isset($ph_ARGS[0])) $ph_Alerts['067'] = ph_Message("A067"); if ($ph_FileTable[$ph_FILEID]['size'] > $ph_ARGS[0]) { $ph_ValErr = true; if ($ph_FileTable[$ph_FILEID]['stat'] != 6) @unlink("$ph_upd/".$ph_FileTable[$ph_FILEID]['full']); } break; case "FILERR" : if ($ph_FileTable[$ph_FILEID]['stat'] == 3) { $ph_FileName = $ph_FileTable[$ph_FILEID]['full']; $ph_ValErr = true; } break; case "REGEX" : if (!isset($ph_ARGS[0])) $ph_Alerts['050'] = ph_Message("A050"); if (!strlen(trim($ph_Val))) break; if (!ereg($ph_ARGS[0], $ph_Val)) $ph_ValErr = true; break; case "UNIQUE" : if (!isset($ph_ARGS[1])) $ph_Alerts['060'] = ph_Message("A060"); if (!$ph_dbOpen) $ph_Alerts['061'] = ph_Message("A061"); if (!strlen(trim($ph_Val))) break; if ($ph_dbOpen) { $ph_uCol = $ph_ARGS[0]; if (ereg("\+", $ph_uCol)) { $ph_uCols = explode("+", $ph_uCol); $ph_uCol = "concat("; while (list(,$ph_val) = each($ph_uCols)) { if ($ph_uCol > "concat(") $ph_uCol.= ","; $ph_uCol.= $ph_val; } $ph_uCol.= ")"; } // First check for a $PHORM_MYTABLE index, for backward compatibility if (is_numeric($ph_ARGS[1])) { if (is_array($PHORM_MYTABLE)) $ph_uTable = $PHORM_MYTABLE[$ph_ARGS[1]]; else $ph_uTable = $PHORM_MYTABLE; } else $ph_uTable = $ph_ARGS[1]; $ph_UNQQString = "select * from $ph_uTable where $ph_uCol='$ph_Val'"; if ($ph_debug72) echo "<B>UNIQUE:</B> $ph_UNQQString<BR>"; $ph_Result = MySQL_Query($ph_UNQQString, $ph_ID); if (!$ph_Result || MySQL_Error()) { $ph_UNQMyErr = ereg_replace("[^A-Za-z0-9'., ]","",MySQL_Error()); $ph_Alerts['062'] = ph_Message("A062"); } else { if (MySQL_Num_Rows($ph_Result) > 0) $ph_ValErr = true; } } break; case "EXISTS" : if (!isset($ph_ARGS[1])) $ph_Alerts['063'] = ph_Message("A063"); if (!$ph_dbOpen) $ph_Alerts['064'] = ph_Message("A064"); if (!strlen(trim($ph_Val))) break; if ($ph_dbOpen) { $ph_uCol = $ph_ARGS[0]; if (ereg("\+", $ph_uCol)) { $ph_uCols = explode("+", $ph_uCol); $ph_uCol = "concat("; while (list(,$ph_val) = each($ph_uCols)) { if ($ph_uCol > "concat(") $ph_uCol.= ","; $ph_uCol.= $ph_val; } $ph_uCol.= ")"; } // First check for a $PHORM_MYTABLE index, for backward compatibility if (is_numeric($ph_ARGS[1])) { if (is_array($PHORM_MYTABLE)) $ph_uTable = $PHORM_MYTABLE[$ph_ARGS[1]]; else $ph_uTable = $PHORM_MYTABLE; } else $ph_uTable = $ph_ARGS[1]; $ph_EXSQString = "select * from $ph_uTable where $ph_uCol='$ph_Val'"; if ($ph_debug72) echo "<B>EXISTS:</B> $ph_EXSQString<BR>"; $ph_Result = MySQL_Query($ph_EXSQString, $ph_ID); if (!$ph_Result || MySQL_Error()) { $ph_EXSMyErr = ereg_replace("[^A-Za-z0-9'., ]","",MySQL_Error()); $ph_Alerts['065'] = ph_Message("A065"); } else { if (MySQL_Num_Rows($ph_Result) == 0) $ph_ValErr = true; } } break; case "PHONE" : if (!strlen(trim($ph_Val))) break; $ph_Match = ereg("^(\(?[0-9]{3}\)?[ -])?[0-9]{3}[ -][0-9]{4}$", $ph_Val); if ($ph_Val && !$ph_Match) $ph_ValErr = true; break; case "PHONEC" : if (!strlen(trim($ph_Val))) break; if (!ereg("^[0-9() +-]*$", $ph_Val)) $ph_ValErr = true; break; case "RANGE" : if (!isset($ph_ARGS[1])) $ph_Alerts['052'] = ph_Message("A052"); if (!strlen(trim($ph_Val))) break; if ($ph_Val < $ph_ARGS[0] || $ph_Val > $ph_ARGS[1]) $ph_ValErr = true; break; case "ONEOF" : if (!isset($ph_ARGS[0])) $ph_Alerts['053'] = ph_Message("A053"); if (!strlen(trim($ph_Val))) break; $ph_Match = false; while (list(,$ph_ARG) = each($ph_ARGS)) if ($ph_ARG == $ph_Val) $ph_Match = true; if (!$ph_Match) $ph_ValErr = true; break; case "DATECMP": if (!isset($ph_ARGS[0])) $ph_Alerts['068'] = ph_Message("A068"); if (!strlen(trim($ph_Val))) break; $ph_nowDate = date("Ymd"); list($ph_fldMo, $ph_fldDa, $ph_fldYr) = explode("/", $ph_Val); if (strlen($ph_fldMo) < 2) $ph_fldMo = "0$ph_fldMo"; if (strlen($ph_fldDa) < 2) $ph_fldDa = "0$ph_fldDa"; if (strlen($ph_fldYr) == 2) $ph_fldYr = "20$ph_fldYr"; $ph_fldDate = $ph_fldYr.$ph_fldMo.$ph_fldDa; if ($ph_ARGS[1]) list($ph_maxMo, $ph_maxDa, $ph_maxYr) = explode("/", $ph_ARGS[1]); else list($ph_maxMo, $ph_maxDa, $ph_maxYr) = explode("/", "99/99/9999"); if (strlen($ph_maxMo) < 2) $ph_maxMo = "0$ph_maxMo"; if (strlen($ph_maxDa) < 2) $ph_maxDa = "0$ph_maxDa"; if (strlen($ph_maxYr) < 4) $ph_maxYr = "20$ph_maxYr"; $ph_maxDate = $ph_maxYr.$ph_maxMo.$ph_maxDa; if (ereg("[!<>=]", $ph_ARGS[0])) { $ph_cmpDate = ($ph_ARGS[1])? $ph_maxDate : $ph_nowDate; switch ($ph_ARGS[0]) { case "=" : if ($ph_fldDate != $ph_cmpDate) $ph_ValErr = true; break; case ">" : if ($ph_fldDate <= $ph_cmpDate) $ph_ValErr = true; break; case "<" : if ($ph_fldDate >= $ph_cmpDate) $ph_ValErr = true; break; case "<=" : if ($ph_fldDate > $ph_cmpDate) $ph_ValErr = true; break; case ">=" : if ($ph_fldDate < $ph_cmpDate) $ph_ValErr = true; break; case "!=" : if ($ph_fldDate == $ph_cmpDate) $ph_ValErr = true; break; } } else { list($ph_minMo, $ph_minDa, $ph_minYr) = explode("/", $ph_ARGS[0]); if (strlen($ph_minMo) < 2) $ph_minMo = "0$ph_minMo"; if (strlen($ph_minDa) < 2) $ph_minDa = "0$ph_minDa"; if (strlen($ph_minYr) < 4) $ph_minYr = "20$ph_minYr"; $ph_minDate = $ph_minYr.$ph_minMo.$ph_minDa; if ($ph_fldDate < $ph_minDate || $ph_fldDate > $ph_maxDate) $ph_ValErr = true; } break; case "ALPHA" : if (!strlen(trim($ph_Val))) break; if (!ereg("^[A-Za-z]*$", $ph_Val)) $ph_ValErr = true; break; case "NUMERIC" : if (!strlen(trim($ph_Val))) break; if (!ereg("^[-+]?[,0-9]*\.?[0-9]*$", $ph_Val)) $ph_ValErr = true; break; case "FLDLEN": if (!isset($ph_ARGS[2])) $ph_Alerts['069'] = ph_Message("A069"); if ($ph_ARGS[2] == "=" && $ph_ARGS[1] > 0) $$ph_FFLD = substr($$ph_FFLD, 0, $ph_ARGS[1]); else { if (strlen($ph_Val) < $ph_ARGS[0] || ($ph_ARGS[1] > 0 && strlen($ph_Val) > $ph_ARGS[1])) $ph_ValErr = true; } break; case "GT" : if (!isset($ph_ARGS[0])) $ph_Alerts['054'] = ph_Message("A054"); if (!strlen(trim($ph_Val))) break; if ($ph_Val <= $ph_ARGS[0]) $ph_ValErr = true; break; case "LT" : if (!isset($ph_ARGS[0])) $ph_Alerts['055'] = ph_Message("A055"); if (!strlen(trim($ph_Val))) break; if ($ph_Val >= $ph_ARGS[0]) $ph_ValErr = true; break; case "EQ" : if (!isset($ph_ARGS[0])) $ph_Alerts['056'] = ph_Message("A056"); if (!strlen(trim($ph_Val))) break; if ($ph_Val != $ph_ARGS[0]) $ph_ValErr = true; break; case "GE" : if (!isset($ph_ARGS[0])) $ph_Alerts['057'] = ph_Message("A057"); if (!strlen(trim($ph_Val))) break; if ($ph_Val < $ph_ARGS[0]) $ph_ValErr = true; break; case "LE" : if (!isset($ph_ARGS[0])) $ph_Alerts['058'] = ph_Message("A058"); if (!strlen(trim($ph_Val))) break; if ($ph_Val > $ph_ARGS[0]) $ph_ValErr = true; break; case "NE" : if (!isset($ph_ARGS[0])) $ph_Alerts['059'] = ph_Message("A059"); if (!strlen(trim($ph_Val))) break; if ($ph_Val == $ph_ARGS[0]) $ph_ValErr = true; break; default: if (isset($ph_ExtCrits[$ph_CRIT])) { include $ph_ExtCrits[$ph_CRIT]; } else { if (!is_int(strpos($ph_Crits, $ph_CRIT."|"))) { $ph_BadCrit = $ph_CRIT; $ph_Alerts['070'] = ph_Message("A070"); } } break; } // switch ($ph_CRIT) if ($ph_debug421 && $ph_ValErr) echo " - <FONT COLOR=CRIMSON>[<B>Fail</B>]</FONT><BR>"; if ($ph_debug421 && !$ph_ValErr) echo " - <FONT COLOR=TEAL>[<B>Pass</B>]</FONT><BR>"; if ($ph_ValErr) { $ph_ValidErr = true; $ph_ErrLevel = max($ph_ErrLevel, $ph_LEVL); if ($ph_Invals) $ph_Invals.= ","; $ph_Invals.= $ph_RuleNum; $ph_ErrMsgs[$ph_RuleNum] = $ph_MESG; if ($ph_ErrMsgs[$ph_FFLD]) $ph_ErrMsgs[$ph_FFLD].= "<BR>\n"; $ph_ErrMsgs[$ph_FFLD].= $ph_MESG; if ($ph_ValMsg[$ph_LEVL]) $ph_ValMsg[$ph_LEVL] .= "<BR>\n"; $ph_ValMsg[$ph_LEVL] .= $ph_MESG; } } // Process rules if ($ph_ErrLevel) { $ph_MaxLevel = sizeof($ph_Files) - 1; $ph_errfile = $ph_ErrLevel; if ($ph_errfile > $ph_MaxLevel) $ph_errfile = $ph_MaxLevel; $ph_ErrFileName = $ph_Files[$ph_errfile]; if (ereg('^\$[/\\]', $ph_ErrFileName)) { if (isset($DOCUMENT_ROOT)) { $ph_ErrFileName = ereg_replace('[/\\]$', '', $DOCUMENT_ROOT).substr($ph_ErrFileName, 1); } else { $ph_Alerts['012'] = ph_Message("A012"); $ph_ErrFileName = $ph_tpd.'/'.basename($ph_ErrFileName); } } else { if (!ereg("^[./]|^[A-Za-z]:", $ph_ErrFileName)) $ph_ErrFileName = "$ph_tpd/$ph_ErrFileName"; } // Parse the message for variable replacements. $ph_ValMessage = $ph_ValMsg[$ph_ErrLevel]; ph_VarSub($ph_ValMessage); // If we can't open the error template file... if (!strlen($ph_ErrFileName) || !is_readable($ph_ErrFileName) || !is_file($ph_ErrFileName)) { if (!is_readable($ph_ErrFileName)) $ph_Alerts['001'] = ph_Message("A001"); // ...try the generic error template, or use a hard-coded template if (!$ph_ErrFile = @implode("", @file("$ph_root/files/valid_err.html"))) $ph_ErrFile = " <HTML> <HEAD> <TITLE>Data Validation Error</TITLE> </HEAD> <BODY BGCOLOR=#FFC0C0 TEXT=#800000> <CENTER><H3>Data Validation Error</H3></CENTER> {{ph_ValMessage}} <BR><BR> Use your browser's BACK button to return to the form. {{ph_HTLink}} </BODY> </HTML>"; ph_VarSub($ph_ErrFile); } // Otherwise, read and parse the error template else { $ph_ErrFile = implode("", file($ph_ErrFileName)); // Add our tag at the end of the file. if (eregi("</BODY>", $ph_ErrFile)) $ph_ErrFile = eregi_replace("</BODY>", "$ph_HTLink\n<!-- Generated by Phorm -->\n</BODY>", $ph_ErrFile); else $ph_ErrFile.= "$ph_HTLink<!-- Generated by Phorm -->"; // Insert the error message(s) in the appropriate place(s) while (is_int($ph_tagstart = strpos($ph_ErrFile, "<!-- Phorm Messages"))) { $ph_tagend = strpos($ph_ErrFile, "-->", $ph_tagstart); $ph_taglen = $ph_tagend - $ph_tagstart + 3; $ph_datalen = max(0, $ph_taglen - 23); $ph_tag = substr($ph_ErrFile, $ph_tagstart, $ph_taglen); $ph_dat = trim(substr($ph_ErrFile, $ph_tagstart + 20, $ph_datalen)); list($ph_idx, $ph_HTML) = split(" ", $ph_dat, 2); if ($ph_idx == "%%%") { if ($ph_ValMsg[$ph_ErrLevel]) $ph_HTML = str_replace("###", $ph_ValMsg[$ph_ErrLevel], $ph_HTML); else $ph_HTML = ""; } elseif (!$ph_idx) { if ($ph_ValMsg[$ph_ErrLevel]) $ph_HTML = $ph_ValMsg[$ph_ErrLevel]; else $ph_HTML = ""; } elseif ($ph_idx && !$ph_HTML) { if ($ph_ErrMsgs[$ph_idx]) $ph_HTML = $ph_ErrMsgs[$ph_idx]; else $ph_HTML = ""; } else { if ($ph_ErrMsgs[$ph_idx]) $ph_HTML = str_replace("###", $ph_ErrMsgs[$ph_idx], $ph_HTML); else $ph_HTML = ""; } $ph_ErrFile = str_replace($ph_tag, $ph_HTML, $ph_ErrFile); } if (ereg("\.php[34]?$", $ph_ErrFileName) && $ph_ParseCode) { ob_start(); eval("?>$ph_ErrFile<?"); $ph_ErrFile = ob_get_contents(); ob_end_clean(); } // Parse the file for variable replacements. ph_VarSub($ph_ErrFile); // Parse the file for form fields for data recycling $ph_ErrFileUC = strtoupper($ph_ErrFile); $ph_TagTable = ph_ParseHTML($ph_ErrFile, 'INPUT, SELECT, TEXTAREA', true); if (is_array($ph_TagTable)) { if ($ph_debug422) echo '<B>Fields are displayed in reverse order.</B><BR>'; while (list($ph_TagStart, $ph_tTag) = each($ph_TagTable)) { $ph_Tag = $ph_tTag['tag']; $ph_TagLen = $ph_tTag['len']; $ph_Atts = ph_ParseTag($ph_Tag); $ph_Atts = $ph_Atts[0]; $ph_TAG = $ph_Atts['TAG']; $ph_TYPE = $ph_Atts['TYPE']; $ph_VALUE = $ph_Atts['VALUE']; $ph_NAME = $ph_Atts['NAME']; $ph_Variable = $ph_NAME; if (ereg('([^\[]+)\[.*\]', $ph_Variable, $ph_regs)) { $ph_Variable = $ph_regs[1]; } unset($ph_Atts['tag']); unset($ph_Atts['len']); unset($ph_Atts['TAG']); unset($ph_FldVal); unset($ph_FldArray); // Determine the value for this field if (is_array($$ph_Variable)) { // Array value if ($ph_debug36) echo "<B>Phorm@".(__LINE__ + 2). "</B> \$ph_FldArray = \$$ph_Variable;<BR>"; eval("\$ph_FldArray = \$$ph_Variable;"); if (ereg('(.+)\[\]$', $ph_NAME, $ph_regs)) { // An empty index $ph_ArrayName = $ph_regs[1]; if (!$ph_ArrayFldVals[$ph_ArrayName]) { $ph_ArrayItem = str_replace('[', "['", $ph_ArrayName); $ph_ArrayItem = str_replace(']', "']", $ph_ArrayItem); if ($ph_debug36) echo "<B>Phorm@".(__LINE__ + 2). "</B> \$ph_ArrayFldVals['$ph_ArrayName'] = \$$ph_ArrayItem;<BR>"; eval("\$ph_ArrayFldVals['$ph_ArrayName'] = \$$ph_ArrayItem;"); $ph_ArrayFldVals[$ph_ArrayName] = array_reverse($ph_ArrayFldVals[$ph_ArrayName]); } list(,$ph_FldVal) = each($ph_ArrayFldVals[$ph_ArrayName]); }
Puch Geplaatst: 28 september 2009 Geplaatst: 28 september 2009 Wat een code zeg hier een zeer eenvoudig script met enkele opties: naam, emailadres en bericht verplicht in te vullen behoud van reeds ingevulde velden bij fouten controle als het emailadres de juiste format heeft Php Code: <?phpsession_start();if (isset($_POST['Submit'])){$name = $_POST['name'];$_SESSION['name'] = $name;$email = $_POST['email'];$_SESSION['email'] = $email;$bericht = $_POST['bericht'];$_SESSION['bericht'] = $bericht;/*Hieronder het emailadres naar waar het formulier moet verzonden worden invullen*/ $email_bestemmeling = "naam@provider.nl"; $patroon = "^([a-zA-Z0-9][a-zA-Z0-9\\._-]{0,254}[a-zA-Z0-9])@([a-zA-Z0-9][a-zA-Z0-9\\._-]{0,253}[a-zA-Z0-9])\\.([A-Za-z]{2,10})$";if (trim($name) == ""){ $fout = " - Uw naam opgeven aub !"; }else if (trim($email) == ""){ $fout .= " - Vul uw email adres in aub !"; }else if(!ereg($patroon, $email)){ $fout .= " - Je hebt een foutief email adres opgegeven !"; }else if (empty($bericht)){ $fout .= " - Schrijf een bericht aub."; }else{ $headers = "FROM: $name<$email> \n";$headers .= "MIME-Version: 1.0\n";$headers .= "Content-type: text/html; charset=UTF-8\n";$bericht = nl2br($bericht);$opsomming = <<<eodEr is een vraag via uw contact formulier.<br /><br />Naam: $name<br />Email: $email<br />Bericht:<br />$berichteod;$verzenden = mail ($email_bestemmeling, "Vraag via uw contactpagina", $opsomming, $headers); }if($verzenden){ unset($fout, $_SESSION['name'], $_SESSION['email'], $_SESSION['bericht']); echo 'Bericht verzonden'; }else { echo 'Bericht niet verzonden' . $fout; } }?><html><body><form method="post" action="<?php print $_SERVER['PHP_SELF']; ?>">Naam: <br /> <input type="text" name="name" size=50 value="<?php if (isset($_SESSION['name'])){ print $_SESSION['name']; } ?>" /><br /><br />E-mailadres:<br /> <input type="text" name="email" size=50 value="<?php if (isset($_SESSION['email'])){ print $_SESSION['email']; } ?>" /><br /><br />Bericht:<br /> <textarea rows="5" cols="38" name="bericht"><?php if (isset($_SESSION['bericht'])){ print $_SESSION['bericht']; } ?></textarea><br /><br /><input type="submit" name="Submit" value="Verzenden"></form></body></html> iMac 27" macOS SierraiPhone 5s iOS 10
Aanbevolen berichten
Maak een account aan of log in om te reageren
Je moet een lid zijn om een reactie te kunnen achterlaten
Account aanmaken
Registreer voor een nieuwe account in onze community. Het is erg gemakkelijk!
Registreer een nieuwe accountInloggen
Heb je reeds een account? Log hier in.
Nu inloggen