PHP - Moved: Can't Get Securimage Captcha To Work Outside Securimage Folder
This topic has been moved to Third Party PHP Scripts.
http://www.phpfreaks.com/forums/index.php?topic=357935.0 Similar TutorialsI have a form with a captcha at the end of it (using securimage.php - http://www.phpcaptcha.org/documentation/quickstart/). But no matter what I enter into the field, it always gives me the error message: Quote: Quote The code you entered was incorrect. Go back and try again. If echo out $securimage->check($_POST['captcha_code']) Then I am given '1', which shows that the date entered does in fact match the text that is displayed within the captcha image. But it just seems to be ignoring this in the if statement! I've even tried simplifying the if statement like so: if (!$securimage->check($_POST['captcha_code'])) { But that STILL gives me the error message even when I've been sure to enter something into the name field. It's as if there is something about the if statement that the script just doesn't seem to like?! If anybody has any ideas what might be wrong that would be great Here's my code (please excuse the ugly HTML, it's not mine!) Code: [Select] <!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"> <head> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1" /> --></style> <script type="text/javascript" src="script/jquery-1.4.2.min.js"></script> <link href="script/jquery-datepicker/datePicker.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="script/jquery-datepicker/date.js"></script> <script type="text/javascript" src="script/jquery-datepicker/jquery.datePicker.js"></script> <script type="text/javascript" src="script/jquery-datepicker/call.js"></script> <script type="text/javascript" src="script/jquery-datepicker/call-2.js"></script> <csscriptdict import="import"> <script type="text/javascript" src="GeneratedItems/CSScriptLib.js"></script> </csscriptdict> <csactiondict> <script type="text/javascript"><!-- var preloadFlag = false; function preloadImages() { if (document.images) { pre_head1_up = newImage('images/head1_up.jpg'); pre_head8_up = newImage('images/head8_up.jpg'); pre_head8_down = newImage('images/head8_down.jpg'); pre_head7_up = newImage('images/head7_up.jpg'); pre_head3_up = newImage('images/head3_up.jpg'); pre_head6_up = newImage('images/head6_up.jpg'); pre_head4_up = newImage('images/head4_up.jpg'); pre_head5_up = newImage('images/head5_up.jpg'); preloadFlag = true; } } // --></script> </csactiondict> </head> <body onload="preloadImages();" bgcolor="#FFFFFF" text="#000000"> <div align="center"> <table width="750" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="00" rowspan="5" valign="top" width="79"> <div align="center"> <h4 class="00"><a onmouseover="changeImages('Curriculum','images/head1_up.jpg');MM_swapImage('Curriculum','','Images/head1_up.jpg',1);return true" onmouseout="changeImages('Curriculum','images/head1_down.jpg');MM_swapImgRestore();return true" href="curriculum.html" target="_self"><img src="images/head1_down.jpg" alt="Curriculum Button" name="Curriculum" height="45" width="47" border="0"/></a><br/> <b><font size="2" color="#0000CC" face="Comic Sans MS">Curriculum</font></b></h4> </div> </td> <td width="79" height="11"></td> <td width="79"></td> <td width="79"></td> <td rowspan="8" valign="bottom" width="119"><a href="index.html"><img src="images/sml_logo.jpg" alt="Tinks Logo Home Button" height="108" width="119" border="0"/></a></td> <td width="77"></td> <td width="79"></td> <td width="79"></td> <td class="00" rowspan="5" valign="top" width="79"> <div align="center"> <h4 class="00"><a onmouseover="changeImages('Contact_Us','images/head8_up.jpg');return true" onmouseout="changeImages('Contact_Us','images/head8_down.jpg');return true" href="contact.html" target="_self"><img src="images/head8_down.jpg" alt="Contact Us Buttons" name="Contact_Us" height="45" width="47" border="0"/></a><br/> <b><font size="2" color="#0000CC" face="Comic Sans MS"><span>Contact Us</span></font></b></h4> </div> </td> <td width="1"></td> </tr> <tr> <td class="00" rowspan="5" valign="top"> <div align="center"> <h4 class="00"><img src="images/head2_down.jpg" alt="Register Button" name="Register" height="45" width="47" border="0"/><br/> <b><font size="2" color="#0000CC" face="Comic Sans MS">Register</font></b></h4> </div> </td> <td height="10"></td> <td></td> <td></td> <td></td> <td class="00" rowspan="5" valign="top" width="79"> <div align="center"> <h4 class="00"><a onmouseover="changeImages('Parents','images/head7_up.jpg');MM_swapImage('Parents','','Images/head7_up.jpg',1);return true" onmouseout="changeImages('Parents','images/head7_down.jpg');MM_swapImgRestore();return true" href="parents.html" target="_self"><img src="images/head7_down.jpg" alt="Parents Testimonials Button" name="Parents" height="45" width="47" border="0"/></a><br/> <font color="#0000CC"><b><font size="2" face="Comic Sans MS">Parent<br/> Testimonials</font></b></font></h4> </div> </td> <td></td> </tr> <tr> <td class="00" rowspan="5" valign="top"> <div align="center"> <h4 class="00"><a onmouseover="changeImages('Health&Safety','images/head3_up.jpg');MM_swapImage('Health&Safety','','Images/head3_up.jpg',1);return true" onmouseout="changeImages('Health&Safety','images/head3_down.jpg');MM_swapImgRestore();return true" href="health_safety.html" target="_self"><img src="images/head3_down.jpg" alt="Health & Safety Button" name="Health&Safety" height="45" width="47" border="0"/></a><br/> <b><font size="2" color="#0000CC" face="Comic Sans MS">Health & Safety</font></b></h4> </div> </td> <td height="12"></td> <td></td> <td class="00" rowspan="5" align="center" valign="top"> <div align="center"> <a onmouseover="MM_swapImage('Events','','Images/head6_up.jpg',1)" onmouseout="MM_swapImgRestore()" href="../../web/htdocs/events.htm"><font size="2" face="Comic Sans MS"><b></b></font></a> <h4 class="00"><a onmouseover="changeImages('Events','images/head6_up.jpg');return true" onmouseout="changeImages('Events','images/head6_down.jpg');return true" href="events.html"><img id="Events" src="images/head6_down.jpg" alt="Events Button" name="Events" height="45" width="47" border="0"/></a><font color="#0000CC"><b><font size="2" face="Comic Sans MS"><br/> Events</font></b></font></h4> </div> </td> <td></td> </tr> <tr> <td class="00" rowspan="5" valign="top"> <div align="center"> <h4 class="00"><a onmouseover="changeImages('Team','images/head4_up.jpg');MM_swapImage('Team','','Images/head4_up.jpg',1);return true" onmouseout="changeImages('Team','images/head4_down.jpg');MM_swapImgRestore();return true" href="team.html" target="_self"><img src="images/head4_down.jpg" alt="Team Button" name="Team" height="45" width="47" border="0"/></a><br/> <b><font size="2" color="#0000CC" face="Comic Sans MS">The Team</font></b></h4> </div> </td> <td height="8"></td> <td></td> </tr> <tr> <td class="00" rowspan="4" align="center" valign="top"> <h4 class="00"><a onmouseover="changeImages('Fees','images/head5_up.jpg');MM_swapImage('Fees','','Images/head5_up.jpg',1);return true" onmouseout="changeImages('Fees','images/head5_down.jpg');MM_swapImgRestore();return true" href="fees.html" target="_self"><img src="images/head5_down.jpg" alt="Fees Button" name="Fees" height="45" width="47" border="0"/></a><br/> <font color="#0000CC"><b><font size="2" face="Comic Sans MS">Fees</font></b></font></h4> </td> <td height="34"></td> </tr> <tr> <td height="19"></td> <td></td> <td></td> </tr> <tr> <td height="10"></td> <td></td> <td width="79"></td> <td></td> <td></td> </tr> <tr> <td height="12"></td> <td></td> <td></td> <td></td> <td width="79"></td> <td></td> <td></td> </tr> </table> <table width="742" border="0" cellpadding="0" cellspacing="0" height="300 " align="center"> <tr> <td height="72" valign="top" colspan="8"> <div align="center"> <h1 align="center"><font face="Comic Sans MS" size="6" color="#A94BD3"><b>Register</b></font></h1> </div> </script><div style="color:red;font-weight:bold;"></div> <form method="post" action="script/enquiry.php"> <input type="hidden" name="thankspage" value="register-thanks.php" /> <div><label>Child's Full Name <span class="highlight">*</span></label><input type="text" name="ChildsFullName" id="ChildsFullName" class="required" /></div> <div> <label for="DateDD">Date <span class="highlight">*</span></label> <select id="DateDD" name="DateDD"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select id="DateMM" name="DateMM"> <option value="1">Jan</option> <option value="2">Feb</option> <option value="3">Mar</option> <option value="4">Apr</option> <option value="5">May</option> <option value="6">Jun</option> <option value="7">Jul</option> <option value="8">Aug</option> <option value="9">Sep</option> <option value="10">Oct</option> <option value="11">Nov</option> <option value="12">Dec</option> </select> <select id="DateYYYY" name="DateYYYY"> <option value="2010">2010</option> <option value="2011">2011</option> <option value="2012">2012</option> <option value="2013">2013</option> <option value="2014">2014</option> <option value="2015">2015</option> <option value="2016">2016</option> <option value="2017">2017</option> <option value="2018">2018</option> <option value="2019">2019</option> <option value="2020">2020</option> </select> <a id="date-pick" href="#" class="dp-applied"><img src="script/jquery-datepicker/image/frm-date.gif" /></a> </div> <div><label>Name of Parent/Guardian <span class="highlight">*</span></label><input type="text" name="ParentGuardian" id="ParentGuardian" /></div> <div> <div class="left"> <label>Address <span class="highlight">*</span></label> </div> <div class="right"> <div><label>Street Address</label><input type="text" name="StreetAddress" id="1234" /></div> <div><label>Address Line 2</label><input type="text" name="AddressLine2" id="1234" /></div> <div><label>City</label><input type="text" name="City" id="1234" /></div> <div><label>Post Code</label><input type="text" name="PostCode" id="1234" /></div> <div><label>State/Province/Region</label><input type="text" name="StateProvinceRegion" id="1234" /></div> <div><label>Country</label> <select name="Country" id="Country"><option value=""></option><optgroup label="North America"><option value="Antigua and Barbuda">Antigua and Barbuda</option><option value="Aruba,Bahamas">Aruba,Bahamas</option><option value="Barbados">Barbados</option><option value="Belize">Belize</option><option value="Canada">Canada</option><option value="Cook Islands">Cook Islands</option><option value="Costa Rica">Costa Rica</option><option value="Cuba">Cuba</option><option value="Dominica">Dominica</option><option value="Dominican Republic">Dominican Republic</option><option value="El Salvador">El Salvador</option><option value="Grenada">Grenada</option><option value="Guatemala">Guatemala</option><option value="Haiti">Haiti</option><option value="Honduras">Honduras</option><option value="Jamaica">Jamaica</option><option value="Mexico">Mexico</option><option value="Netherlands Antilles">Netherlands Antilles</option><option value="Nicaragua">Nicaragua</option><option value="Panama ">Panama </option><option value="Puerto Rico ">Puerto Rico </option><option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option><option value="Saint Lucia">Saint Lucia</option><option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option><option value="Trinidad and Tobago">Trinidad and Tobago</option><option value="United States">United States</option></optgroup><optgroup label="South America"><option value="Argentina">Argentina</option><option value="Bolivia">Bolivia</option><option value="Brazil">Brazil</option><option value="Chile">Chile</option><option value="Colombia">Colombia</option><option value="Ecuador">Ecuador</option><option value="Guyana">Guyana</option><option value="Paraguay">Paraguay</option><option value="Peru">Peru</option><option value="Suriname">Suriname</option><option value="Uruguay">Uruguay</option><option value="Venezuela">Venezuela</option></optgroup><optgroup label="Europe"><option value="Albania">Albania</option><option value="Andorra">Andorra</option><option value="Armenia">Armenia</option><option value="Austria">Austria</option><option value="Azerbaijan">Azerbaijan</option><option value="Belarus">Belarus</option><option value="Belgium">Belgium</option><option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option><option value="Bulgaria">Bulgaria</option><option value="Croatia">Croatia</option><option value="Cyprus">Cyprus</option><option value="Czech Republic">Czech Republic</option><option value="Denmark">Denmark</option><option value="Estonia">Estonia</option><option value="Faroe Islands">Faroe Islands</option><option value="Finland">Finland</option><option value="France">France</option><option value="Georgia">Georgia</option><option value="Germany">Germany</option><option value="Greece">Greece</option><option value="Hungary">Hungary</option><option value="Iceland">Iceland</option><option value="Ireland">Ireland</option><option value="Italy">Italy</option><option value="Latvia">Latvia</option><option value="Liechtenstein">Liechtenstein</option><option value="Lithuania">Lithuania</option><option value="Luxembourg">Luxembourg</option><option value="Macedonia">Macedonia</option><option value="Malta">Malta</option><option value="Moldova">Moldova</option><option value="Monaco">Monaco</option><option value="Montenegro">Montenegro</option><option value="Netherlands">Netherlands</option><option value="Norway">Norway</option><option value="Poland">Poland</option><option value="Portugal">Portugal</option><option value="Romania">Romania</option><option value="San Marino">San Marino</option><option value="Serbia">Serbia</option><option value="Slovakia">Slovakia</option><option value="Slovenia">Slovenia</option><option value="Spain">Spain</option><option value="Sweden">Sweden</option><option value="Switzerland">Switzerland</option><option value="Ukraine">Ukraine</option><option selected="selected" value="United Kingdom">United Kingdom</option><option value="Vatican City">Vatican City</option></optgroup><optgroup label="Asia"><option value="Afghanistan">Afghanistan</option><option value="Bahrain">Bahrain</option><option value="Bangladesh">Bangladesh</option><option value="Bhutan">Bhutan</option><option value="Brunei Darussalam">Brunei Darussalam</option><option value="Myanmar">Myanmar</option><option value="Cambodia">Cambodia</option><option value="China">China</option><option value="East Timor">East Timor</option><option value="Hong Kong">Hong Kong</option><option value="India">India</option><option value="Indonesia">Indonesia</option><option value="Iran">Iran</option><option value="Iraq">Iraq</option><option value="Israel">Israel</option><option value="Japan">Japan</option><option value="Jordan">Jordan</option><option value="Kazakhstan">Kazakhstan</option><option value="North Korea">North Korea</option><option value="South Korea">South Korea</option><option value="Kuwait">Kuwait</option><option value="Kyrgyzstan">Kyrgyzstan</option><option value="Laos">Laos</option><option value="Lebanon">Lebanon</option><option value="Malaysia">Malaysia</option><option value="Maldives">Maldives</option><option value="Mongolia">Mongolia</option><option value="Nepal">Nepal</option><option value="Oman">Oman</option><option value="Pakistan">Pakistan</option><option value="Palestine">Palestine</option><option value="Philippines">Philippines</option><option value="Qatar">Qatar</option><option value="Russia">Russia</option><option value="Saudi Arabia">Saudi Arabia</option><option value="Singapore">Singapore</option><option value="Sri Lanka">Sri Lanka</option><option value="Syria">Syria</option><option value="Taiwan">Taiwan</option><option value="Tajikistan">Tajikistan</option><option value="Thailand">Thailand</option><option value="Turkey">Turkey</option><option value="Turkmenistan">Turkmenistan</option><option value="United Arab Emirates">United Arab Emirates</option><option value="Uzbekistan">Uzbekistan</option><option value="Vietnam">Vietnam</option><option value="Yemen">Yemen</option></optgroup><optgroup label="Oceania"><option value="Australia">Australia</option><option value="Fiji">Fiji</option><option value="Kiribati">Kiribati</option><option value="Marshall Islands">Marshall Islands</option><option value="Micronesia">Micronesia</option><option value="Nauru">Nauru</option><option value="New Zealand">New Zealand</option><option value="Palau">Palau</option><option value="Papua New Guinea">Papua New Guinea</option><option value="Samoa">Samoa</option><option value="Solomon Islands">Solomon Islands</option><option value="Tonga">Tonga</option><option value="Tuvalu">Tuvalu</option><option value="Vanuatu">Vanuatu</option></optgroup><optgroup label="Africa"><option value="Algeria">Algeria</option><option value="Angola">Angola</option><option value="Benin">Benin</option><option value="Botswana">Botswana</option><option value="Burkina Faso">Burkina Faso</option><option value="Burundi">Burundi</option><option value="Cameroon">Cameroon</option><option value="Cape Verde">Cape Verde</option><option value="Central African Republic">Central African Republic</option><option value="Chad">Chad</option><option value="Comoros">Comoros</option><option value="Democratic Republic of the Congo">Democratic Republic of the Congo</option><option value="Republic of the Congo">Republic of the Congo</option><option value="Djibouti">Djibouti</option><option value="Egypt">Egypt</option><option value="Equatorial Guinea">Equatorial Guinea</option><option value="Eritrea">Eritrea</option><option value="Ethiopia">Ethiopia</option><option value="Gabon">Gabon</option><option value="Gambia">Gambia</option><option value="Ghana">Ghana</option><option value="Gibraltar">Gibraltar</option><option value="Guinea">Guinea</option><option value="Guinea-Bissau">Guinea-Bissau</option><option value="Cote d'Ivoire">Cote d'Ivoire</option><option value="Kenya">Kenya</option><option value="Lesotho">Lesotho</option><option value="Liberia">Liberia</option><option value="Libya">Libya</option><option value="Madagascar">Madagascar</option><option value="Malawi">Malawi</option><option value="Mali">Mali</option><option value="Mauritania">Mauritania</option><option value="Mauritius">Mauritius</option><option value="Morocco">Morocco</option><option value="Mozambique">Mozambique</option><option value="Namibia">Namibia</option><option value="Niger">Niger</option><option value="Nigeria">Nigeria</option><option value="Rwanda">Rwanda</option><option value="Sao Tome and Principe">Sao Tome and Principe</option><option value="Senegal">Senegal</option><option value="Seychelles">Seychelles</option><option value="Sierra Leone">Sierra Leone</option><option value="Somalia">Somalia</option><option value="South Africa">South Africa</option><option value="Sudan">Sudan</option><option value="Swaziland">Swaziland</option><option value="United Republic of Tanzania">United Republic of Tanzania</option><option value="Togo">Togo</option><option value="Tunisia">Tunisia</option><option value="Uganda">Uganda</option><option value="Zambia">Zambia</option><option value="Zimbabwe">Zimbabwe</option></optgroup></select> </div> </div> </div> <div><label>Phone Number <span class="highlight">*</span></label><input type="text" name="PhoneNumber" id="1234" /></div> <div><label>Place of work</label><input type="text" name="PlaceOfWork" id="1234" /></div> <div> <label>Mornings only</label> <div class="right"> <input type="checkbox" name="MorningsOnly" value="Monday" />Monday <input type="checkbox" name="MorningsOnly" value="Tuesday" />Tuesday <input type="checkbox" name="MorningsOnly" value="Wednesday" />Wednesday <input type="checkbox" name="MorningsOnly" value="Thursday" />Thursday <input type="checkbox" name="MorningsOnly" value="Friday" />Friday <p>Please indicate the sessions you wish your child to attend by ticking the appropriate boxes:</p> </div> </div> <div> <label>Afternoons only</label> <div class="right"> <input type="checkbox" name="AfternoonsOnly" value="Monday" />Monday <input type="checkbox" name="AfternoonsOnly" value="Tuesday" />Tuesday <input type="checkbox" name="AfternoonsOnly" value="Wednesday" />Wednesday <input type="checkbox" name="AfternoonsOnly" value="Thursday" />Thursday <input type="checkbox" name="AfternoonsOnly" value="Friday" />Friday <p>Please indicate the sessions you wish your child to attend by ticking the appropriate boxes:</p> </div> </div> <div> <label>Full days</label> <div class="right"> <input type="checkbox" name="FullDays" value="Monday" />Monday <input type="checkbox" name="FullDays" value="Tuesday" />Tuesday <input type="checkbox" name="FullDays" value="Wednesday" />Wednesday <input type="checkbox" name="FullDays" value="Thursday" />Thursday <input type="checkbox" name="FullDays" value="Friday" />Friday <p>Please indicate the sessions you wish your child to attend by ticking the appropriate boxes:</p> </div> </div> <div><label>Does your child have special requirements?</label><input type="text" name="SpecialRequirements" id="SpecialRequirements" /></div> <div><label>Please provide any other relevant information </label><input type="text" name="RelevantInfo" id="RelevantInfo" /></div> <div> <div> <label for="DateStartDD">Date you wish your child to start</label> <select id="DateStartDD" name="DateStartDD"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select id="DateStartMM" name="DateStartMM"> <option value="1">Jan</option> <option value="2">Feb</option> <option value="3">Mar</option> <option value="4">Apr</option> <option value="5">May</option> <option value="6">Jun</option> <option value="7">Jul</option> <option value="8">Aug</option> <option value="9">Sep</option> <option value="10">Oct</option> <option value="11">Nov</option> <option value="12">Dec</option> </select> <select id="DateStartYYYY" name="DateStartYYYY"> <option value="2010">2010</option> <option value="2011">2011</option> <option value="2012">2012</option> <option value="2013">2013</option> <option value="2014">2014</option> <option value="2015">2015</option> <option value="2016">2016</option> <option value="2017">2017</option> <option value="2018">2018</option> <option value="2019">2019</option> <option value="2020">2020</option> </select> <a id="date-pick-2" href="#" class="dp-applied"><img src="script/jquery-datepicker/image/frm-date.gif" /></a> </div> </div> <div><label>Email <span class="highlight">*</span></label><input type="text" name="submitteremail" id="Email" /></div> <div id="captcha-div"> <label>Please type the text displayed in the image</label> <img id="captcha" src="script/securimage/securimage_show.php" alt="CAPTCHA Image" /> <input type="text" name="captcha_code" size="10" maxlength="6" /> </div> <div><input type="submit" name="submit" value="Submit" /></div> </form> </html> <?php session_start(); include_once 'securimage/securimage.php'; $securimage = new Securimage(); if ($securimage->check($_POST['captcha_code']) == false) { die('The code you entered was incorrect. Go back and try again.'); } ?> <?php *** Rest of PHP script to send email *** Hello all! First post. Wondering if anyone could help me out with a problem I've been having with a form mailer... I had it working at one point in time, but now not so much. I'm using Securimage as a captcha The file is email.php My problem is... When you type in the code wrong, it tells you its wrong. When you type the code right, it redirects to thank.html, which is correct...but never sends the mail! Am I missing something obvious? Here's my code: Code: [Select] <?php session_start(); //include_once $_SERVER['DOCUMENT_ROOT'] . '/coaxicom_email_original/securimage/securimage.php'; include_once('securimage/securimage.php'); $securimage = new Securimage(); if( isset($_POST['submit'])) { if ($securimage->check($_POST['captcha_code']) == false) { // the code was incorrect // you should handle the error so that the form processor doesn't continue // or you can use the following code if there is no validation or you do not know how echo "The security code entered was incorrect.<br /><br />"; echo "<a href='email.php'>Please click this link to back and try again.</a>"; exit; } //Data $contact1 = $_POST['contact1']; $company1 = $_POST['company1']; $email1 = $_POST['email1']; $phone1 = $_POST['phone1']; $country1 = $_Post['country1']; $address1 = $_POST['address1']; $city1 = $_POST['city1']; $state1 = $_POST['state1']; $zip1 = $_POST['zip1']; $contact2 = $_POST['contact2']; $company2 = $_POST['company2']; $email2 = $_POST['email2']; $phone2 = $_POST['phone2']; $country2 = $_Post['country2']; $address2 = $_POST['address2']; $city2 = $_POST['city2']; $state2 = $_POST['state2']; $zip2 = $_POST['zip2']; $contact3 = $_POST['contact3']; $company3 = $_POST['company3']; $email3 = $_POST['email3']; $phone3 = $_POST['phone3']; $country3 = $_Post['country3']; $address3 = $_POST['address3']; $city3 = $_POST['city3']; $state3 = $_POST['state3']; $zip3 = $_POST['zip3']; $contact4 = $_POST['contact4']; $company4 = $_POST['company4']; $email4 = $_POST['email4']; $phone4 = $_POST['phone4']; $country4 = $_Post['country4']; $address4 = $_POST['address4']; $city4 = $_POST['city4']; $state4 = $_POST['state4']; $zip4 = $_POST['zip4']; $contact5 = $_POST['contact5']; $company5 = $_POST['company5']; $email5 = $_POST['email5']; $phone5 = $_POST['phone5']; $country5 = $_Post['country5']; $address5 = $_POST['address5']; $city5 = $_POST['city5']; $state5 = $_POST['state5']; $zip5 = $_POST['zip5']; $contact6 = $_POST['contact6']; $company6 = $_POST['company6']; $email6 = $_POST['email6']; $phone6 = $_POST['phone6']; $country6 = $_Post['country6']; $address6 = $_POST['address6']; $city6 = $_POST['city6']; $state6 = $_POST['state6']; $zip6 = $_POST['zip6']; $contact7 = $_POST['contact7']; $company7 = $_POST['company7']; $email7 = $_POST['email7']; $phone7 = $_POST['phone7']; $country7 = $_Post['country7']; $address7 = $_POST['address7']; $city7 = $_POST['city7']; $state7 = $_POST['state7']; $zip7 = $_POST['zip7']; $contact8 = $_POST['contact8']; $company8 = $_POST['company8']; $email8 = $_POST['email8']; $phone8 = $_POST['phone8']; $country8 = $_Post['country8']; $address8 = $_POST['address8']; $city8 = $_POST['city8']; $state8 = $_POST['state8']; $zip8 = $_POST['zip8']; $body = <<<EOD <br /><hr><br /> Company: $company1 <br /> Contact: $contact1 <br /> Email: $email1 <br /> Phone: $phone1 <br /> Country: $country1 <br /> Address: $address1 <br /> City: $city1 <br /> State: $state1 <br /> Zip: $zip1 <br /> <br /><hr><br /> Company: $company2 <br /> Contact: $contact2 <br /> Email: $email2 <br /> Phone: $phone2 <br /> Country: $country2 <br /> Address: $address2 <br /> City: $city2 <br /> State: $state2 <br /> Zip: $zip2 <br /> <br /><hr><br /> Company: $company3 <br /> Contact: $contact3 <br /> Email: $email3 <br /> Phone: $phone3 <br /> Country: $country3 <br /> Address: $address3 <br /> City: $city3 <br /> State: $state3 <br /> Zip: $zip3 <br /> <br /><hr><br /> Company: $company4 <br /> Contact: $contact4 <br /> Email: $email4 <br /> Phone: $phone4 <br /> Country: $country4 <br /> Address: $address4 <br /> City: $city4 <br /> State: $state4 <br /> Zip: $zip4 <br /> <br /><hr><br /> Company: $company5 <br /> Contact: $contact5 <br /> Email: $email5 <br /> Phone: $phone5 <br /> Country: $country5 <br /> Address: $address5 <br /> City: $city5 <br /> State: $state5 <br /> Zip: $zip5 <br /> <br /><hr><br /> Company: $company6 <br /> Contact: $contact6 <br /> Email: $email6 <br /> Phone: $phone6 <br /> Country: $country6 <br /> Address: $address6 <br /> City: $city6 <br /> State: $state6 <br /> Zip: $zip6 <br /> <br /><hr><br /> Company: $company7 <br /> Contact: $contact7 <br /> Email: $email7 <br /> Phone: $phone7 <br /> Country: $country7 <br /> Address: $address7 <br /> City: $city7 <br /> State: $state7 <br /> Zip: $zip7 <br /> <br /><hr><br /> Company: $company8 <br /> Contact: $contact8 <br /> Email: $email8 <br /> Phone: $phone8 <br /> Country: $country8 <br /> Address: $address8 <br /> City: $city8 <br /> State: $state8 <br /> Zip: $zip8 <br /> <br /><hr><br /> EOD; //Subject and Email $emailSubject = 'This is my subject'; $webMaster = 'example@gmail.com'; $headers = "From: Example\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster,$emailSubject,$body,$headers); header( "Location: thank.html" ); } else { ?> <!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"> <head></head> <body> <div id="wrapper"> <div id="main"> <div id="fContainer"> <form action="email.php" method="post" > <div class="fbox" id="f1"> <div class="fLine"><div class="fLabel">Company Name:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="company1" /></div></div> <br /> <div class="fLine"><div class="fLabel">Contact:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="contact1" /></div></div> <br /> <div class="fLine"><div class="fLabel">E-mail:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="email1" /></div></div> <br /> <div class="fLine"><div class="fLabel">Phone:</div> <div class="fInput"><input type="text" size="15" maxlength="50" name="phone1" /></div></div> <br /> <div class="fLine"><div class="fLabel">Country:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="country1" /></div></div> <br /> <div class="fLine"><div class="fLabel">Address:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="address1" /></div></div> <br /> <div class="fLine"><div class="fLabel">City:</div> <div class="fInput"><input type="text" size="18" maxlength="100" name="city1" /></div></div> <br /> <div class="fLine"><div class="fLabel">State:</div> <div class="fInput"><input type="text" size="10" maxlength="100" name="state1" /></div></div> <br /> <!-- end #f1 --></div> <div class="fbox" id="f2"> <div class="fLine"><div class="fLabel">Company Name:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="company2" /></div></div> <br /> <div class="fLine"><div class="fLabel">Contact:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="contact2" /></div></div> <br /> <div class="fLine"><div class="fLabel">E-mail:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="email2" /></div></div> <br /> <div class="fLine"><div class="fLabel">Phone:</div> <div class="fInput"><input type="text" size="15" maxlength="50" name="phone2" /></div></div> <br /> <div class="fLine"><div class="fLabel">Country:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="country2" /></div></div> <br /> <div class="fLine"><div class="fLabel">Address:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="address2" /></div></div> <br /> <div class="fLine"><div class="fLabel">City:</div> <div class="fInput"><input type="text" size="18" maxlength="100" name="city2" /></div></div> <br /> <div class="fLine"><div class="fLabel">State:</div> <div class="fInput"><input type="text" size="10" maxlength="100" name="state2" /></div></div> <br /> <!-- end #f2 --></div> <div class="fbox" id="f3"> <div class="fLine"><div class="fLabel">Company Name:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="company3" /></div></div> <br /> <div class="fLine"><div class="fLabel">Contact:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="contact3" /></div></div> <br /> <div class="fLine"><div class="fLabel">E-mail:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="email3" /></div></div> <br /> <div class="fLine"><div class="fLabel">Phone:</div> <div class="fInput"><input type="text" size="15" maxlength="50" name="phone3" /></div></div> <br /> <div class="fLine"><div class="fLabel">Country:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="country3" /></div></div> <br /> <div class="fLine"><div class="fLabel">Address:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="address3" /></div></div> <br /> <div class="fLine"><div class="fLabel">City:</div> <div class="fInput"><input type="text" size="18" maxlength="100" name="city3" /></div></div> <br /> <div class="fLine"><div class="fLabel">State:</div> <div class="fInput"><input type="text" size="10" maxlength="100" name="state3" /></div></div> <br /> <!-- end #f3 --></div> <div class="fbox" id="f4"> <div class="fLine"><div class="fLabel">Company Name:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="company4" /></div></div> <br /> <div class="fLine"><div class="fLabel">Contact:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="contact4" /></div></div> <br /> <div class="fLine"><div class="fLabel">E-mail:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="email4" /></div></div> <br /> <div class="fLine"><div class="fLabel">Phone:</div> <div class="fInput"><input type="text" size="15" maxlength="50" name="phone4" /></div></div> <br /> <div class="fLine"><div class="fLabel">Country:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="country4" /></div></div> <br /> <div class="fLine"><div class="fLabel">Address:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="address4" /></div></div> <br /> <div class="fLine"><div class="fLabel">City:</div> <div class="fInput"><input type="text" size="18" maxlength="100" name="city4" /></div></div> <br /> <div class="fLine"><div class="fLabel">State:</div> <div class="fInput"><input type="text" size="10" maxlength="100" name="state4" /></div></div> <br /> <!-- end #f4 --></div> <div class="fbox" id="f5"> <div class="fLine"><div class="fLabel">Company Name:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="company5" /></div></div> <br /> <div class="fLine"><div class="fLabel">Contact:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="contact5" /></div></div> <br /> <div class="fLine"><div class="fLabel">E-mail:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="email5" /></div></div> <br /> <div class="fLine"><div class="fLabel">Phone:</div> <div class="fInput"><input type="text" size="15" maxlength="50" name="phone5" /></div></div> <br /> <div class="fLine"><div class="fLabel">Country:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="country5" /></div></div> <br /> <div class="fLine"><div class="fLabel">Address:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="address5" /></div></div> <br /> <div class="fLine"><div class="fLabel">City:</div> <div class="fInput"><input type="text" size="18" maxlength="100" name="city5" /></div></div> <br /> <div class="fLine"><div class="fLabel">State:</div> <div class="fInput"><input type="text" size="10" maxlength="100" name="state5" /></div></div> <br /> <!-- end #f5 --></div> <div class="fbox" id="f6"> <div class="fLine"><div class="fLabel">Company Name:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="company6" /></div></div> <br /> <div class="fLine"><div class="fLabel">Contact:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="contact6" /></div></div> <br /> <div class="fLine"><div class="fLabel">E-mail:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="email6" /></div></div> <br /> <div class="fLine"><div class="fLabel">Phone:</div> <div class="fInput"><input type="text" size="15" maxlength="50" name="phone6" /></div></div> <br /> <div class="fLine"><div class="fLabel">Country:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="country6" /></div></div> <br /> <div class="fLine"><div class="fLabel">Address:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="address6" /></div></div> <br /> <div class="fLine"><div class="fLabel">City:</div> <div class="fInput"><input type="text" size="18" maxlength="100" name="city6" /></div></div> <br /> <div class="fLine"><div class="fLabel">State:</div> <div class="fInput"><input type="text" size="10" maxlength="100" name="state6" /></div></div> <br /> <!-- end #f6 --></div> <div class="fbox" id="f7"> <div class="fLine"><div class="fLabel">Company Name:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="company7" /></div></div> <br /> <div class="fLine"><div class="fLabel">Contact:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="contact7" /></div></div> <br /> <div class="fLine"><div class="fLabel">E-mail:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="email7" /></div></div> <br /> <div class="fLine"><div class="fLabel">Phone:</div> <div class="fInput"><input type="text" size="15" maxlength="50" name="phone7" /></div></div> <br /> <div class="fLine"><div class="fLabel">Country:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="country7" /></div></div> <br /> <div class="fLine"><div class="fLabel">Address:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="address7" /></div></div> <br /> <div class="fLine"><div class="fLabel">City:</div> <div class="fInput"><input type="text" size="18" maxlength="100" name="city7" /></div></div> <br /> <div class="fLine"><div class="fLabel">State:</div> <div class="fInput"><input type="text" size="10" maxlength="100" name="state7" /></div></div> <br /> <!-- end #f7 --></div> <div class="fbox" id="f8"> <div class="fLine"><div class="fLabel">Company Name:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="company8" /></div></div> <br /> <div class="fLine"><div class="fLabel">Contact:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="contact8" /></div></div> <br /> <div class="fLine"><div class="fLabel">E-mail:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="email8" /></div></div> <br /> <div class="fLine"><div class="fLabel">Phone:</div> <div class="fInput"><input type="text" size="15" maxlength="50" name="phone8" /></div></div> <br /> <div class="fLine"><div class="fLabel">Country:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="country8" /></div></div> <br /> <div class="fLine"><div class="fLabel">Address:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="address8" /></div></div> <br /> <div class="fLine"><div class="fLabel">City:</div> <div class="fInput"><input type="text" size="18" maxlength="100" name="city8" /></div></div> <br /> <div class="fLine"><div class="fLabel">State:</div> <div class="fInput"><input type="text" size="10" maxlength="100" name="state8" /></div></div> <br /> <!-- end #f8 --></div> <div id="fCaptcha"> <div id="codeLabel">Security Code<span class="red">*</span>:</div> <div id="img"><img id="captcha" src="securimage/securimage_show.php" alt="CAPTCHA Image" /></div> <div id="text"> <input type="text" name="captcha_code" size="10" maxlength="6" /></div> <!-- end #fCaptcha --></div> <div id="fCaptchaBox"></div> <div id="fSubmit"><input type="submit" name="submit" value="Email This Form" /></div> </form> <!-- end #fContainer --></div> <!-- end #main --></div> <!-- end #wrapper --></div> </body> </html> <?php } ?> I'm using the example_form from securimage. I have modified the email address in the php script to my email address and uploaded everything to my hosting company's FTP server. I then fill out the form and click the submit message button and the form says "The captcha was correct and the message has been sent!" but I never receive the email. I have other basic php forms that work just fine just for some reason I can't get this one working. Could someone please let me know if I'm missing something here? Thanks Hi guys, I just decided to add an addition question in my site for submitting a form, not gonna say where coz one of you will most proberly try to prove it doesnt work! I have a feeling its easy enough for someone to send my form by getting the two variables and evaluating them. But how would they do that? and how would they know the names of the variables to send...? Is there a way of doing a math captcha that cannot be hacked? This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=319400.0 I have 2 subdomains - one for the main site app and one for administration app. Both of these need to work with the same directory - one to upload images and one to read them. So far I have it like this - the main domain is mounted to www_root. In www_root I created a folder for the admin application. The images folder is also directly in www_root. The problem is, I can't upload files through http. So how else can I access a directory that is above the root directory of the current app ? Or should I rather move the images dir to the admin directory ? This topic has been moved to Apache HTTP Server. http://www.phpfreaks.com/forums/index.php?topic=355947.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=333010.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=308625.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=321807.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=308276.0 This topic has been moved to PHP Installation & Configuration. http://www.phpfreaks.com/forums/index.php?topic=332517.0 I got this script: But it give me error, file_get_contents cannot open stream. I need to add the FTP connection with user/pass paramaters. then look in set http url, to get the file contents(images) and transfer to ftp server location. Can Anyone take alook and tell me if I am going down the right path and how to get there. Please Code: [Select] function postToHost($host, $port, $path, $postdata = array(), $filedata = array()) { $data = ""; $boundary = "---------------------".substr(md5(rand(0,32000)),0,10); $fp = fsockopen($host, $port); fputs($fp, "POST $path HTTP/1.0\n"); fputs($fp, "Host: $host\n"); fputs($fp, "Content-type: multipart/form-data; boundary=".$boundary."\n"); // Ab dieser Stelle sammeln wir erstmal alle Daten in einem String // Sammeln der POST Daten foreach($postdata as $key => $val){ $data .= "--$boundary\n"; $data .= "Content-Disposition: form-data; name=\"".$key."\"\n\n".$val."\n"; } // Sammeln der FILE Daten if($filedata) { $data .= "--$boundary\n"; $data .= "Content-Disposition: form-data; name=\"".$filedata['name']."\"; filename=\"".$filedata['name']."\"\n"; $data .= "Content-Type: ".$filedata['type']."\n"; $data .= "Content-Transfer-Encoding: binary\n\n"; $data .= $filedata['data']."\n"; $data .= "--$boundary--\n"; } // Senden aller Informationen fputs($fp, "Content-length: ".strlen($data)."\n\n"); fputs($fp, $data); // Auslesen der Antwort while(!feof($fp)) { $res .= fread($fp, 1); } fclose($fp); return $res; } $postdata = array('var1'=>'today', 'var2'=>'yesterday'); $filedata = array( 'type' => 'image/png', 'data' => file_get_contents('http://xxx/tdr-images/images/mapping/dynamic/deals/spot_map') ); echo '<pre>'.postToHost ("localhost", 80, "/test3.php", $postdata, $filedata).'</pre>'; This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=327247.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=342142.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=314913.0 This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=331514.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=348530.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=321864.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=356485.0 |