Javascript form validation with php help

wxdqz

New Member
ok guys i get this error:
line:19
char: 1
error:Object doesnt support this property or method
Code:0
url:http://localhost/linux/contact.php?

heres the source for the pages:
:::mailval.js:::
<!--
function TheFormCheck() {
if (document.emailf.from.value=="" && document.emailf.name.value=="")
{
alert("Yeah...you kinda need to include your name and return email if you want me to write back.");
document.emailf.from.focus(); return false
}

if (document.emailf.from.value!="")
{
if (document.emailf.from.value.indexOf("@")==-1 || document.emailf.from.value.indexOf(".")==-1 || document.emailf.from.value.indexOf(" ")!=-1 || document.emailf.from.value.length<6)
{
alert("Sorry, your email address is invalid. Try using a real one");
document.emailf.from.focus(); return false
}
}

if (document.emailf.name.indexOf("://")!=-1 || document.emailf.name.indexOf(" ")!=-1)
{
alert("Please type in your name.");
document.emailf.name.focus(); return false
}

if (document.emailf.subject.indexOf("://")!=-1)
{
alert("The string :// is not allowed in the subject textbox.");
document.emailf.subject.focus(); return false
}


if (document.emailf.Message.indexOf(" ")!=-1 || document.emailf.Message.indexOf("%20")!=-1 || document.emailf.Message.indexOf("<")!=-1 || document.emailf.Message.indexOf(">")!=-1 || document.emailf.Message.indexOf("&gt")!=-1 || document.emailf.Message.indexOf("&lt")!=-1 || document.emailf.Message.indexOf("<script")!=-1 || document.emailf.Message.indexOf("img src")!=-1 || document.emailf.Message.indexOf("a href")!=-1 || document.emailf.Message.indexOf("<frame")!=-1)
{
alert("Your message contains dissalowed characters. Please do not use javascript or html of any sort, these languages will keep your email from being sent.");
document.emailf.Message.focus(); return false
}
}

//-->

:::contact.php:::
<?PHP
ob_start();
?>
<html>
<head>
<title>--==Email Me==--</title>
<script language="JavaScript" src=http://www.webdeveloper.com/forum/archive/index.php/"../javascripts/mailval.js">
</script>
</head>
<link rel="stylesheet" type="text/css" href="../stylesheets/rpg.css">
<body bgcolor=black text=white>

<?php
$phpbb_root_path ='../forum/';

//
//
//

#$phpbb_root_path = 'forum/';

define ('IN_PHPBB', true);

if (!file_exists($phpbb_root_path . 'extension.inc'))
{
die ('<tt><b>Watashi-noAnimeRPG:</b>
$phpbb_root_path is wrong and does not point to your forum.</tt>');
}

//
// phpBB related files
//

include_once ($phpbb_root_path . 'extension.inc');
include_once ($phpbb_root_path . 'common.' . $phpEx);
include_once ($phpbb_root_path . 'includes/bbcode.' . $phpEx);

//
// Fetch All related files - we do need all these because the portal is a
// huge example
//
include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/common.' . $phpEx);
include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/users.' . $phpEx);

//
// start session management
//

$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata);
phpbb_disconnect();

if ( $userdata['session_logged_in'] )
{
include_once ('pages/llinks.php');
?>

<form action="<? echo $lmenuvar[C_MAIL]; ?>" method="POST" onSubmit="return TheFormCheck()" name="emailf">
You can send me messages with the following form.<br>
<font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<strong>Email:</strong>
<br>
<input type="text" name="from">
<br>
<strong>Name:</strong>
<br>
<input type="text" name="name">
<br>
<strong>Subject:</strong>
<br>
<input type="text" name="subject">
<br>
<strong>Message:</strong>
<br>
<textarea name="Message" Rows=8 COLS=65></textarea>
<br>
<input name="submit" class="loginbutton" type="submit" value=http://www.webdeveloper.com/forum/archive/index.php/"Submit">
</form>
<? }
else if ( !$userdata['session_logged_in'] )
{ ?>
You do not have access rights to view/use this file. Please login to be able to view/use this file
<? }
ob_end_flush();
?>


:::mail.php:::
<?
function qp_encoding($Message) {

/* Build (most polpular) Extended ASCII Char/Hex MAP (characters >127 & <255) */
for ($i=0; $i<127; $i++) {
$CharList[$i] = "/".chr($i+128)."/";
$HexList[$i] = "=".strtoupper(bin2hex(chr($i+128)));
}

/* Encode equal sign & 8-bit characters as equal signs followed by their hexadecimal values */
$Message = str_replace("=", "=3D", $Message);
$Message = preg_replace($CharList, $HexList, $Message);

/* Lines longer than 76 characters (size limit for quoted-printable Content-Transfer-Encoding)
will be cut after character 75 and an equals sign is appended to these lines. */
$MessageLines = split("\n", $Message);
$Message_qp = "";
while(list(, $Line) = each($MessageLines)) {
if (strlen($Line) > 75) {
$Pointer = 0;
while ($Pointer <= strlen($Line)) {
$Offset = 0;
if (preg_match("/^=(3D|([8-9A-F]{1}[0-9A-F]{1}))$/", substr($Line, ($Pointer+73), 3))) $Offset=-2;
if (preg_match("/^=(3D|([8-9A-F]{1}[0-9A-F]{1}))$/", substr($Line, ($Pointer+74), 3))) $Offset=-1;
$Message_qp.= substr($Line, $Pointer, (75+$Offset))."=\n";
if ((strlen($Line) - ($Pointer+75)) <= 75) {
$Message_qp.= substr($Line, ($Pointer+75+$Offset))."\n";
break 1;
}
$Pointer+= 75+$Offset;
}
} else {
$Message_qp.= $Line."\n";
}
}
return $Message_qp;
}
mail("[email protected]", $subject, $Message_qp, $from)
?>
<html>
<head><title>--==Email Me==--</title></head>
<link rel="stylesheet" type="text/css" href=http://www.webdeveloper.com/forum/archive/index.php/"../stylesheets/rpg.css">
<body bgcolor=black>
<font class=smoke>Thanks for your email, i will respond as soon as i can.</font><br>
</html>



any help would be greatly appreciated, thanx guys
Spyke01
 
Back
Top