Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP email verification - wrong_code won't call proper action
    primarykey
    data
    text
    <p>I have the following email form:</p> <pre><code> &lt;form action="mailer.php" method="post" name="form1" id="form1" onsubmit="MM_validateForm('from','','RisEmail','name','','R','verif_box','','R','message','','R');return document.MM_returnValue"&gt; &lt;table width="500" border="0" cellpadding="2" cellspacing="0" bgcolor="#000000"&gt;&lt;tr valign="top" align="right"&gt; &lt;td nowrap&gt;&lt;font face="Verdana" size="3" color="#666666" &gt;first name (&lt;span class="R"&gt;*&lt;/span&gt;)&lt;/font&gt;&lt;/td&gt; &lt;td width="500" align="left"&gt;&lt;input type="text" name="name" size="37" border="0" id="name" value="&lt;?php echo $_GET['name'];?&gt;"&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr valign="top" align="right"&gt; &lt;td nowrap&gt;&lt;font face="Verdana" size="3" color="#666666"&gt;last name&lt;/font&gt;&lt;/td&gt; &lt;td align="left"&gt;&lt;input type="text" name="lastname" size="37" border="0" id="lastname" value="&lt;?php echo $_GET['lastname'];?&gt;"&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr valign="top" align="right"&gt; &lt;td nowrap&gt;&lt;font face="Verdana" size="3" color="#666666"&gt;email (&lt;span class="R"&gt;*&lt;/span&gt;)&lt;/font&gt;&lt;/td&gt; &lt;td align="left"&gt;&lt;input type="text" name="from" size="37" border="0" id="from" value="&lt;?php echo $_GET['from'];?&gt;"&gt; &lt;/td&gt; &lt;/tr&gt;&lt;tr valign="top" align="right"&gt; &lt;td nowrap&gt;&lt;font face="Verdana" size="3" color="#666666"&gt;&lt;/font&gt;&lt;/td&gt; &lt;td align="left"&gt;&lt;input type=checkbox name="mailinglist" id="mailinglist" value="&lt;?php echo $_GET['mailinglist'];?&gt;"&gt;&lt;font face="Verdana" size="3" color="#666666"&gt;&lt;/font&gt;&lt;br&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr valign="top" align="right"&gt; &lt;td nowrap&gt;&lt;font face="Verdana" size="3" color="#666666"&gt;comments (&lt;span class="R"&gt;*&lt;/span&gt;)&lt;/font&gt;&lt;/td&gt; &lt;td align="left"&gt;&lt;textarea name="message" cols="35" rows="10" border="0" id="message"&gt;&lt;?php echo $_GET['message'];?&gt;&lt;/textarea&gt;&lt;br&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td colspan="2"&gt;&lt;table cellpadding=5 cellspacing=0 bgcolor="#000000" width="100%"&gt;&lt;tr bgcolor="#000000"&gt; &lt;td class="label" colspan="2"&gt;&lt;font color="#cccccc" face="Verdana" size="2"&gt;&lt;b&gt;Image Verification&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td&gt; &lt;input name="verif_box" type="text" id="verif_box" style="padding:2px; border:1px solid #CCCCCC; width:80px; height:14px;"/&gt;&amp;nbsp;&amp;nbsp;&lt;img src="verificationimage.php?&lt;?php echo rand(0,9999);?&gt;" alt="verification image, type it in the box" width="50" height="24" align="top" /&gt;&lt;br /&gt; &lt;br /&gt; &lt;!-- if the variable "wrong_code" is sent from previous page then display the error field --&gt; &lt;?php if(isset($_GET['wrong_code'])){?&gt; &lt;div style="border:1px solid #990000; background-color:#D70000; color:#FFFFFF; padding:4px; padding-left:6px;width:295px;"&gt;Wrong verification code&lt;/div&gt;&lt;br /&gt; &lt;?php }?&gt; &lt;/td&gt;&lt;td class="field" valign="bottom"&gt; &lt;div&gt;&lt;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"/&gt; &lt;input type="reset" class="btn" value=" clear " name="Clear" border="0" 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-top:0px; padding-bottom:2px; line-height:14px; background-color:#EFEFEF;"&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/form&gt; </code></pre> <p>and the following code in my mailer.php</p> <pre><code> // 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 mail("myemail@gmail.com", 'Online Form: '.$subject, "\n".$message." \n\n".$name."\n\n".$lastname."\n\n".$from."\n\n".$_SERVER['REMOTE_ADDR']."\n\n".'mailinglist: '.$mailinglist, "From: $from"); // delete the cookie so it cannot sent again by refreshing this page setcookie('tntcon',''); } else if(isset($message) and $message!=""){ // if verification code was incorrect then return to contact page and show error header("Location: http://{$_SERVER['HTTP_HOST']}".dirname($_SERVER['PHP_SELF'])."contactform.php?subject=$subject&amp;email=$email&amp;message=".urlencode($message)."&amp;wrong_code=true"); exit; } else { echo "no variables received, this page cannot be accessed directly"; exit; } ?&gt; </code></pre> <p>For some reason I receive emails when the verification code is correct, but the "wrong code warning" will not show up when the wrong verification code is entered. </p> <p>Can someone help me please? I am new to php and it has taken me a long time just to get this to work. When the wrong verification code is entered, all that happens is that a blank mailer.php is called in the browser.</p> <p>**sorry, not sure why the code copied in so many different windows.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload