3 Replies - 3620 Views - Last Post: 21 June 2011 - 06:43 AM Rate Topic: -----

#1 iheartbreakz  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 196
  • Joined: 27-April 11

contact form with image error

Posted 20 June 2011 - 10:59 PM

i keep getting errors like <?php echo $_GET['subject'];?> on my contact page even though i don't think i did anything wrong... it started happening ever since i switched my host to godaddy.. on my other host it was working fine and no godaddy people are not helping me with this

my html coding... layout coding not given just the contact form coding part

form action="mailer.php" method="post" name="form1" id="form1" style="margin:0px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px; width:300px;" onsubmit="MM_validateForm('from','','RisEmail','subject','','R','verif_box','','R','message','','R');return document.MM_returnValue">

Your e-mail:<br />
<input name="from" type="text" id="from" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:14px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;" value="<?php echo $_GET['from'];?>"/>
<br />
<br />

Subject:<br />
<input name="subject" type="text" id="subject" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:14px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;" value="<?php echo $_GET['subject'];?>"/>
<br />
<br />

Type verification image:<br />
<input name="verif_box" type="text" id="verif_box" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:14px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;"/>
<img src="verificationimage.php?<?php echo rand(0,9999);?>" alt="verification image, type it in the box" width="50" height="24" align="absbottom" /><br />
<br />

<!-- if the variable "wrong_code" is sent from previous page then display the error field -->
<?php if(isset($_GET['wrong_code'])){?>
<div style="border:1px solid #990000; background-color:#D70000; color:#FFFFFF; padding:4px; padding-left:6px;width:295px;">Wrong verification code</div><br /> 
<?php ;}?>

Message:<br />
<textarea name="message" cols="6" rows="5" id="message" style="padding:2px; border:1px solid #CCCCCC; width:300px; height:100px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;"><?php echo $_GET['message'];?></textarea>
<noscript><a href="http://www.thewebhelp.com" style="display:none;">contact form by thewebhelp</a></noscript>
<input name="Submit" type="submit" style="margin-top:10px; display:block; border:1px solid #000000; width:100px; height:20px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; padding-left:2px; padding-right:2px; padding-top:0px; padding-bottom:2px; line-height:14px; background-color:#EFEFEF;" value="Send Message"/>


// ----------------------------------------- 
//  The Web Help .com
// ----------------------------------------- 
// remember to replace [email protected] with your own email address lower in this code.

// load the variables form address bar
$name = $_REQUEST["name"];
$subject = $_REQUEST["subject"];
$message = $_REQUEST["message"];
$from = $_REQUEST["from"];
$verif_box = $_REQUEST["verif_box"];

// remove the backslashes that normally appears when entering " or '
$name = stripslashes($name); 
$message = stripslashes($message); 
$subject = stripslashes($subject); 
$from = stripslashes($from); 

// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
	// if verification code was correct send the message and show this page
	$message = "Name: ".$name."\n".$message;
	$message = "From: ".$from."\n".$message;
	mail("[email protected]", 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$message, "From: $from");
	// delete the cookie so it cannot sent again by refreshing this page
} else {
	// if verification code was incorrect then return to contact page and show error

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PHP Contact Form Redirect</title>


download code at http://www.dreamweav...ontact-form.zip

my website contact page: http://technosupport.info/contact.htm

This post has been edited by Dormilich: 20 June 2011 - 11:55 PM
Reason for edit:: un-bolding

Is This A Good Question/Topic? 0
  • +

Replies To: contact form with image error

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4184
  • View blog
  • Posts: 13,226
  • Joined: 08-June 10

Re: contact form with image error

Posted 20 June 2011 - 11:57 PM

PHP files should have the .php extension, not the .html/.htm extension as the PHP interpreter is only called for those files (by default). making PHP also parse .html files is possible, but undesirable.

This post has been edited by Dormilich: 20 June 2011 - 11:58 PM

Was This Post Helpful? 1
  • +
  • -

#3 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3777
  • View blog
  • Posts: 13,680
  • Joined: 08-August 08

Re: contact form with image error

Posted 21 June 2011 - 06:43 AM

Do you have the PHP interpreter running on your web server?
Was This Post Helpful? 0
  • +
  • -

#4 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 963
  • View blog
  • Posts: 2,382
  • Joined: 15-February 11

Re: contact form with image error

Posted 21 June 2011 - 06:43 AM

For future reference:
You need to consider fully sanitizing user input to prevent mail header injections. You've stripped the slashes which is a start but you also need to remember that a user can enter %0A into message and it will be treated as a newline character.

This post has been edited by codeprada: 21 June 2011 - 06:44 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1