Jump to content

Recommended Posts

Ok its basically well this is what I think is that the variables when the form is being submited are not begin changed heres code really aplogise for the shear size of it

 

<?php


$error1 = '1';
$error2 = '0';
$error3 = '0';
$error4 = '0';
$error5 = '0';
$error6 = '0';
$displayform = '1';

if($_POST['submit']){
session_start();
function securepost($post_type){
$secureposting = $post_type;

$secureposting = stripslashes($post_type);
$secureposting = addslashes($secureposting);
$secureposting = strip_tags($secureposting);

return $secureposting;
}

function isBlank($post_type){if(preg_match('[a-zA-Z]',$post_type)){return true;}else{return false;}}

function check_email_address($email) {  
// First, we check that there's one @ symbol, and that the lengths are right  
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) 
{    // Email invalid because wrong number of characters in one section, or wrong number of @ symbols.    
return false;  }  
// Split it into sections to make life easier  
$email_array = explode("@", $email);  
$local_array = explode(".", $email_array[0]);  
for ($i = 0; $i < sizeof($local_array); $i++) {     
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) 
{      return false;    }  }    
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name    
$domain_array = explode(".", $email_array[1]);    if (sizeof($domain_array) < 2) {        return false; // Not enough parts to domain    
}    
for ($i = 0; $i < sizeof($domain_array); $i++) {      
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {        return false;      }    }  }  return true;}

$name = securepost($_POST['name']);
$emailaddy = securepost($_POST['email']);
$emailconfirm = securepost($_POST['emailretype']);
$subject = securepost($_POST['subject']);
$message = securepost($_POST['message']);
$security = securepost($_POST['securitycode']);


if(isBlank($name)){$error1 = '1';}
if(! check_email_address($emailaddy)){$error2 = '1';}
if($emailaddy != $emailconfirm){$error3 = '1';}
if(isBlank($subject)){$error4 = '1';}
if(isBlank($message)){$error5 = '1';}
if(($_SESSION['security_code'] == $security) && (!empty($_SESSION['security_code']))){
$error6 = '0';
unset($_SESSION['security_code']);
}
else{
$error6 = '1';
}

if(error1 == '0' && error2 == '0' && error3 == '0' && error4 == '0' && error5 == '0' && error6 == '0'){

$remoteIP = $_SERVER['REMOTE_ADDR'];
if (strstr($remoteIP, ', ')) {
   $ips = explode(', ', $remoteIP);
   $remoteIP = $ips[0];
} 


$Tto = $emailaddy;
$Tsubject = "Cathering.co.uk - Contacted";
$Tmessage = "Hello! you used the contact me form on cathering.co.uk I will email you as soon as I can!
Thanks, Cathering_";
$Tfrom = "noreply@cathering.co.uk";
$Theaders = "From: $form";

mail($Tto,$Tsubject,$Tmessage,$Theaders);

$to = $emailaddy;
$subject = $subject;
$message = "A User has tried to contact you

IP: ".$remoteIP."
Name: ".$name."
Email: ".$emailaddy."
Subject: ".$subject."
Message: ".$message;
$from = $emailaddy;
$headers = "From: $form";

mail($Tto,$Tsubject,$Tmessage,$Theaders);

$displayform = '0';

}


}



?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Cathering, The SRL Scripts Website ~ Contact Me</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex,nofollow" />
<link rel="stylesheet" type="text/css" href="css.css" />
<?php if($displayform == '1'){echo '<script type="text/javascript" src="valid.js"></script>';} ?>
</head>
<body>
<div id="container">

<!-- HEADER -->
<div id="header"><div class="headtitle"><a href="http://www.cathering.co.uk/index.html"><img style="border:none;" src="images/logo.gif" alt="The Cathering Website" /></a></div></div>
<!-- END HEADER -->

<!-- MENU -->
<div id="menu">
	<ul>
		<li><a onmouseover="window.status=this.innerHTML+' - '+this.title;return true" onmouseout="window.status='';return true;" href="http://www.cathering.co.uk/index.html" title="Visit The Website Home.">Home</a></li>
		<li><a onmouseover="window.status=this.innerHTML+' - '+this.title;return true" onmouseout="window.status='';return true;" href="http://www.cathering.co.uk/aboutme.html" title="Get To Know More About Me.">About Me</a></li>
		<li><a onmouseover="window.status=this.innerHTML+' - '+this.title;return true" onmouseout="window.status='';return true;" style="text-decoration:underline;" href="http://www.cathering.co.uk/contact.php" title="Leave A Message.">Contact Me</a></li>
		<li><a onmouseover="window.status=this.innerHTML+' - '+this.title;return true" onmouseout="window.status='';return true;" href="http://www.cathering.co.uk/works.html" title="What Do I Do In My Spare Time?">My Works</a></li>
		<li><a onmouseover="window.status='SRL Scripts & Downloads - '+this.title;return true" onmouseout="window.status='';return true;" href="http://www.cathering.co.uk/scripts.html" title="View The SRL Scripts I Have Made In The Past.">SRL Scripts & Downloads</a></li>
		<li><a onmouseover="window.status=this.innerHTML+' - '+this.title;return true" onmouseout="window.status='';return true;" href="http://www.cathering.co.uk/tutorial.html" title="Learn How To Script In Scar With This Tutorial.">SRL Tutorial</a></li>
	</ul>
</div>
<!-- END MENU -->

<!-- ROUNDED SHAPE BELOW HEADER -->
<div id="roundedheader"> </div>

<!-- START CONTENT -->
<div id="content">

	<!-- LEFT DIV -->
	<div id="insidecontent">

		<h1>contact me</h1>
		<h2>contact me</h2>
<?php if($displayform == '0') echo '<h3>Message Sent</h3>'; ?>
<?php if($displayform == '0') echo '<p><span style="color:#006600;">Your message has been sent I will contact you as soon as I can!</span></p>'; ?>
<?php if($displayform == '0') echo '<span style="display:none;">'; ?>			
		<h3>Leave a message</h3>
	<p>Please fill in the form below<br /></p>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" onsubmit="this.submit.disabled=true;" id="contact_form">
<p>
<label for="a1">Your Name:<br /></label>
<input type="text" onblur="validate('blank1',this,document.getElementById('error1'));" onkeyup="validate('blank1',this,document.getElementById('error1'));" style="color:#66CC00;text-transform:capitalize;" name="name" id="a1" size="40" value="<?php echo $_POST['name']; ?>" maxlength="200" /><br />
<span id="error1"><?php if($error1 == '1'){ echo '<span style="color:FF0000;">Invalid Input</span>';} else{ echo ' '; } ?></span>
<br /><br />
<label for="a2">Your Email:<br /></label>
<input type="text" style="color:#66CC00;text-transform:lowercase;" onblur="validate('email',this,document.getElementById('error2'));" onkeyup="validate('email',this,document.getElementById('error2'));validate('confirmemail',document.getElementById('contact_form').emailretype,document.getElementById('error3'));"  name="email" id="a2" size="40" value="<?php echo $_POST['email']; ?>" maxlength="500" /><br />
<span id="error2"><?php if($error2 == '1'){ echo '<span style="color:FF0000;">Invalid Input</span>';} else{ echo ' '; } ?></span>
<br /><br />
<label for="a3">Confirm Email:<br /></label>
<input type="text" style="color:#66CC00;text-transform:lowercase;" onblur="validate('confirmemail',this,document.getElementById('error3'));" onkeyup="validate('confirmemail',this,document.getElementById('error3'));" name="emailretype" id="a3" size="40" value="<?php echo $_POST['emailretype']; ?>" maxlength="500" /><br />
<span id="error3"><?php if($error3 == '1'){ echo '<span style="color:FF0000;">Invalid Input</span>';} else{ echo ' '; } ?></span>
<br /><br />
<label for="a4">Subject:<br /></label>
<input type="text" onblur="validate('blank2',this,document.getElementById('error4'));" onkeyup="validate('blank2',this,document.getElementById('error4'));" style="color:#66CC00;text-transform:capitalize;" name="subject" id="a4" size="40" value="<?php echo $_POST['subject']; ?>" maxlength="250" /><br />
<span id="error4"><?php if($error4 == '1'){ echo '<span style="color:FF0000;">Invalid Input</span>';} else{ echo ' '; } ?></span>
<br /><br />
<label for="a5">Message:<br /></label>
<textarea name="message" onblur="validate('blank3',this,document.getElementById('error5'));" onkeyup="validate('blank3',this,document.getElementById('error5'));" style="color:#66CC00;text-transform:capitalize;"  id="a5" rows="10" cols="40"><?php echo $_POST['message']; ?></textarea><br />
<span id="error5"><?php if($error5 == '1'){ echo '<span style="color:FF0000;">Invalid Input</span>';} else{ echo ' '; } ?></span>
<br /><br />
<i>Please enter the text you see in the image below.</i>
<br />
<img src="cap/CaptchaSecurityImages.php" style="border:1px solid #000;" alt="You MUST enable images to contact me" title="Enter The Text You See" />
<br /><br />
<label for="a6">Code:<br /></label>
<input type="text" style="color:#66CC00;text-transform:uppercase;" onblur="validate('securitycode',this,document.getElementById('error6'));" onkeyup="validate('securitycode',this,document.getElementById('error6'));" id="a6" size="28" maxlength="28" name="securitycode" />
<br /><span id="error6"><?php if($error6 == '1'){ echo '<span style="color:FF0000;">Invalid Security Code</span>';} else{ echo ' '; } ?></span>
<br /><br />
<input type="submit" value="Send" name="submit" />
<?php if($displayform == '1'){ echo'
<script type="text/javascript">
<!--
document.getElementById("contact_form").submit.disabled=true;
-->
</script>';} ?>
</p>
</form>
<?php if($displayform == '0') echo '</span>'; ?>
</div>	<!-- END LEFT DIV -->

	<!-- SIDEBAR -->
	<div id="sidebar">

		<h1>download</h1>
		<h2>download scar</h2>

		<h3>Download Scar Divi</h3><p>
		Getting angry because you can't find the link? Then <a href="http://www.freddy1990.com/scar.php">click here</a>!
		</p>

	</div>
	<!-- END SIDEBAR -->


	<div style="clear: both;"></div>
	<!-- END FLOAT CLEANER -->

</div>
<!-- END CONTENT -->

<!-- ROUNDED SHAPE ABOVE FOOTER -->
<div id="roundedfooter"> </div>

<!-- FOOTER -->
<div id="footer">
	<span>XHTML 1.1 STRICT | CSS 2 | Layout By Yamazaki</span>
</div>
<!--END FOOTER -->

</div>
<?php if($displayform == '1'){ echo '
<script type="text/javascript">
<!--
setTimeout(\'checksubmitbutton()\',1);
-->
</script>'; } ?>
</body>
</html>

 

URL to webpage: http://www.cathering.co.uk/contactme.php

 

If you try to submit it , it will just been as if you refreshed only apart from fact that  the values has been set using POST im really confused

Link to comment
https://forums.phpfreaks.com/topic/62762-help-on-form-submission/
Share on other sites

Ok if you go to the link and fill in everything (validately) and click on send it will just look as if you just refreshed the page what it ment to do was put a <span style="display:none;"> and end it as soon as the form ends it self and then display Message recived text but its not , so thats telling me that somehow the variables where not changed

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.