[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Captcha inside PHP submission form

Posted on 2009-04-22
33
Medium Priority
?
534 Views
Last Modified: 2013-12-13
Hello experts,
I'm really need your help, i made PHP submission form but i can't implement CAPTCA to it.
I'm not a PHP programmer (Bad to me)

Does anyone can PLEASE help me?
It can be Capthat or any other similar module...

Thank you guys for assistance....

<!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>
 <?php require('includes/meta_tegs.htm'); ?> 
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<table cellpadding="0" cellspacing="0" width="950" align="center" class="tbl_main">
	<tr>
		<td>
			<?php require('includes/menu_top.htm'); ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php require('includes/menu.htm'); ?>
		</td>
	</tr>
	<tr>
		<td height="1"></td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" width="100%" class="top">
				<tr>
					<td class="top_txt" width="500" style="padding-left:20px; padding-bottom:20px" valign="bottom">
						<h1>>A;0BL 70?@>A </h1>
					</td>
					<td width="450"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" width="100%" class="main" style="padding-top:25px">
				<tr>
					<td>
						<table cellpadding="0" cellspacing="0" width="100%">
							<tr>
								<td width="160" style="padding-left:10px" class="menu_left_border" valign="top">
									<?php require('includes/chat.htm'); ?>  
								</td>
								<td width="570" style="padding-right:10px; padding-left:15px" valign="top">
									<table cellpadding="0" cellspacing="0" width="100%" class="downloads">
										<tr>
										  <td style="padding-top:2px">
												<?php
 
  $_DirectoryToUploadInto = "./" ;
 
  $addressToSentTo = "ims@medicaltourismforyou.com" ; 
 
  $addressToSentFrom = "submit-user@med-international.ru" ; 
 
  
 
  
 
function moveUploadedFile($_FILES,$_DirectoryToUploadInto)
 
  {
 
                global $_FILES ;
 
   $uploadfile = $_DirectoryToUploadInto . basename($_FILES['fileName']['name']);
 
  
 
  
 
                  if (move_uploaded_file($_FILES['fileName']['tmp_name'], $uploadfile)) 
 
                                  {
 
                                      echo "\n *\n";
 
                                  } 
 
                  else 
 
                                  {
 
                                      echo "\n0H5 ?8AL<> >B>A;0=> 157 ?@8:@5?;5==>3> D09;0. !?0A81>.!\n";
 
 
 
                                  }
 
        putFileOnFTP(basename($_FILES['fileName']['name']));
 
        
 
  }
 
  
 
function putFileOnFTP($fileName)
 
{
 
$ftp_server = "69.174.48.166" ; 
 
$ftp_user_name = "submit@med-international.ru" ; 
 
$ftp_user_pass = "123" ; 
 
 
 
$file = $fileName; 
 
$remote_file = $fileName; 
 
 
 
 
 
$conn_id = ftp_connect($ftp_server);
 
 
 
 
 
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
 
 
 
 
 
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
 
 echo "$file 03@C65= =0 A5@25@, !?081>\n";
 
 
 
} else {
 
 echo "$file\n";
 
}
 
 
 
ftp_close($conn_id);
 
}  
 
 
 
 function sendMail($postedData) 
 
  {
 
                  global $addressToSentTo, $addressToSentFrom, $_FILES;
 
                  
 
  $to      = $addressToSentTo ;
 
  $subject = "Submit form"; 
 
  
 
  if (!$_FILES['fileName']['name']) 
 
  {
 
                $sendedFile = "D09; =5 1K; 2KA;0=." ;
 
  }
 
  else
 
  {
 
                $sendedFile = "KA;0==K9 D09;: ".$_FILES['fileName']['name'] ;
 
  } 
 
  
 
  $message = "
 
{$postedData['firstName']} 
 
{$postedData['lastName']} 
 
{$postedData['gender']}
 
{$postedData['day']}/{$postedData['month']}/{$postedData['year']}
 
{$postedData['city']} 
 
{$postedData['zip']}
 
{$postedData['country']}
 
{$postedData['fileName']} 
 
{$postedData['homephone']}
 
{$postedData['workphone']}
 
{$postedData['interest']}
 
{$postedData['email']}
 
{$postedData['mobilephone']}
 
{$postedData['diagnosis']}
 
{$postedData['fileName']}
 
{$sendedFile} 
 
{$postedData['msg']} ";
 
  
 
  $headers = 'From: '.$addressToSentFrom."\n" .
 
                     'Reply-To:'.$addressToSentFrom ;
 
  
 
  mail($to, $subject, $message, $headers);
 
  }
 
  
 
  function printForm()
 
  {
 
	  echo <<<HTML
 
  <html>
 
  
 
  <head>
 
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 
  <link rel="stylesheet" type="text/css" href="mailer_style.css">
 
 
 
  <title>Post Form</title>
 
  <style>
 
.text:focus, textarea:focus {
 
  background-color: #FFFACC;
 
    }
 
  .message
 
{
 
    font-weight:bold;
 
    color:Red;
 
    font-size:large;
 
}
 
  
 
</style>
 
  </head>
 
  
 
  <body>
 
HTML;
 
echo <<<HTML
 
  <form enctype="multipart/form-data" action="mailer.php" method="POST">
 
  
 
                  <table border="0" width="500" class="table">
 
                                  <tr>
 
 
 
                                                                                                                                                                                                  <td width="200"><O<span class="must">*</span></td>
 
                                                                                                                                                                                                  
 
                                                  <td><input class="input_1" type="text" name="firstName" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">$0<8;8O<span class="must">*</span></td>
 
                                                  <td><input class="input_1" type="text" name="lastName" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>;<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="gender">
 
				<option></option>
 
				<option>C6G8=0</option>
 
                <option>5=I8=0</option>
 
                                                                  </select>
 
                                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">0B0 @>645=8O (5=L/5AOF/>4)</td>
 
                                                  <td>
 
                                                  <select size="1" class="input_1" name="day">
 
<option>1</option>
 
<option>2</option>
 
<option>3</option>
 
<option>4</option>
 
<option>5</option>
 
<option>6</option>
 
<option>7</option>
 
<option>8</option>
 
<option>9</option>
 
<option>10</option>
 
<option>11</option>
 
<option>12</option>
 
<option>13</option>
 
<option>14</option>
 
<option>15</option>
 
<option>16</option>
 
<option>17</option>
 
<option>18</option>
 
<option>19</option>
 
<option>20</option>
 
<option>21</option>
 
<option>22</option>
 
<option>23</option>
 
<option>24</option>
 
<option>25</option>
 
<option>26</option>
 
<option>27</option>
 
<option>28</option>
 
<option>29</option>
 
<option>30</option>
 
<option>31</option>
 
</select>
 
<select size="1" class="input_1"name="month">
 
<option>/=20@L</option>
 
<option>$52@0;L</option>
 
<option>0@B</option>
 
<option>?@5;L</option>
 
<option>09</option>
 
<option>N=L</option>
 
<option>N;L</option>
 
<option>23CAB</option>
 
<option>!5=BO1@L</option>
 
<option>:BO1@L</option>
 
<option>>O1@L</option>
 
<option>5:01@L</option>
 
</select>
 
<select size="1" class="input_1"name="year">
 
<option>	1930	</option>
 
<option>	1931	</option>
 
<option>	1932	</option>
 
<option>	1933	</option>
 
<option>	1934	</option>
 
<option>	1935	</option>
 
<option>	1936	</option>
 
<option>	1937	</option>
 
<option>	1938	</option>
 
<option>	1939	</option>
 
<option>	1940	</option>
 
<option>	1941	</option>
 
<option>	1942	</option>
 
<option>	1943	</option>
 
<option>	1944	</option>
 
<option>	1945	</option>
 
<option>	1946	</option>
 
<option>	1947	</option>
 
<option>	1948	</option>
 
<option>	1949	</option>
 
<option>	1950	</option>
 
<option>	1951	</option>
 
<option>	1952	</option>
 
<option>	1953	</option>
 
<option>	1954	</option>
 
<option>	1955	</option>
 
<option>	1956	</option>
 
<option>	1957	</option>
 
<option>	1958	</option>
 
<option>	1959	</option>
 
<option>	1960	</option>
 
<option>	1961	</option>
 
<option>	1962	</option>
 
<option>	1963	</option>
 
<option>	1964	</option>
 
<option>	1965	</option>
 
<option>	1966	</option>
 
<option>	1967	</option>
 
<option>	1968	</option>
 
<option>	1969	</option>
 
<option>	1970	</option>
 
<option>	1971	</option>
 
<option>	1972	</option>
 
<option>	1973	</option>
 
<option>	1974	</option>
 
<option>	1975	</option>
 
<option>	1976	</option>
 
<option>	1977	</option>
 
<option>	1978	</option>
 
<option>	1979	</option>
 
<option>	1980	</option>
 
<option>	1981	</option>
 
<option>	1982	</option>
 
<option>	1983	</option>
 
<option>	1984	</option>
 
<option>	1985	</option>
 
<option>	1986	</option>
 
<option>	1987	</option>
 
<option>	1988	</option>
 
<option>	1989	</option>
 
<option>	1990	</option>
 
<option>	1991	</option>
 
<option>	1992	</option>
 
<option>	1993	</option>
 
<option>	1994	</option>
 
<option>	1995	</option>
 
<option>	1996	</option>
 
<option>	1997	</option>
 
<option>	1998	</option>
 
<option>	1999	</option>
 
<option>	2000	</option>
 
<option>	2001	</option>
 
<option>	2002	</option>
 
<option>	2003	</option>
 
<option>	2004	</option>
 
<option>	2005	</option>
 
<option>	2006	</option>
 
<option>	2007	</option>
 
<option>	2008	</option>
 
<option>	2009	</option>
 
<option>	2010	</option>
 
<option>	2011	</option>
 
<option>	2012	</option>
 
<option>	2013	</option>
 
<option>	2014	</option>
 
<option>	2015	</option>
 
<option>	2016	</option>
 
<option>	2017	</option>
 
<option>	2018	</option>
 
<option>	2019	</option>
 
<option>	2020	</option>
 
<option>	2021	</option>
 
<option>	2022	</option>
 
<option>	2023	</option>
 
<option>	2024	</option>
 
<option>	2025	</option>
 
<option>	2026	</option>
 
<option>	2027	</option>
 
<option>	2028	</option>
 
<option>	2029	</option>
 
<option>	2030	</option>
 
 
 
</select>
 
                             </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>@>4</td>
 
                                                  <td><input class="input_1" type="text" name="city" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>GB>2K9 8=45:A</td>
 
                                                  <td><input class="input_1" type="text" name="zip" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">!B@0=0 ?@>6820=8O<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="country">
 
  <option></option>
 
  <option> >AA8O</option>
 
  <option>@<5=8O</option>
 
  <option>75@10;L460=</option>
 
  <option>5;0@CAL</option>
 
  <option>@C78O</option>
 
  <option>-AB>=8O</option>
 
  <option>070EAB0=</option>
 
  <option>0B28O</option>
 
  <option>8B20</option>
 
  <option>>;4028O</option>
 
  <option>#:@08=0</option>
 
  <option>#715:8AB0=</option>    
 
<option></option>
 
<option>	2AB@8O	</option>
<option>	;10=8O	</option>
<option>	=4>@@0	</option>
<option>	5;L38O	</option>
<option>	>;30@8O	</option>
<option>	>A=8O 8 5@F53>28=0	</option>
<option>	0B8:0=	</option>
<option>	5;8:>1@8B0=8O	</option>
<option>	5=3@8O	</option>
<option>	5@<0=8O	</option>
<option>	@5F8O	</option>
<option>	0=8O	</option>
<option>	@;0=48O	</option>
<option>	A;0=48O	</option>
<option>	A?0=8O	</option>
<option>	B0;8O	</option>
<option>	8?@	</option>
<option>	8EB5=HB59=	</option>
<option>	N:A5<1C@3	</option>
<option>	0:54>=8O	</option>
<option>	0;LB0	</option>
<option>	>=0:>	</option>
<option>	845@;0=4K	</option>
<option>	>@2538O	</option>
<option>	>;LH0	</option>
<option>	>@BC30;8O	</option>
<option>	 C<K=8O	</option>
<option>	!0=-0@8=>	</option>
<option>	!5@18O	</option>
<option>	!;>20:8O	</option>
<option>	!;>25=8O	</option>
<option>	"C@F8O	</option>
<option>	$8=;O=48O	</option>
<option>	$@0=F8O	</option>
<option>	%>@20B8O	</option>
<option>	'5@=>3>@8O	</option>
<option>	'5E8O	</option>
<option>	(259F0@8O	</option>
<option>	(25F8O	</option>
  
 
</select>
 
                                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200">><0H=89 B5;5D>=<span class="must">*</span></td>
 
                                   <td><input class="input_1"type="text" name="homephone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200"> 01>G89 B5;5D>=</td>
 
                                   <td><input class="input_1"type="text" name="workphone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200">>18;L=K9 B5;5D>=</td>
 
                                   <td><input class="input_1"type="text" name="mobilephone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
								  <tr>
 
                                   <td width="200">E-mail<span class="must">*</span></td>
 
                                   <td><input class="input_1"type="text" name="email" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">0H5 A>>1I5=85</td>
 
                                                  <td>
 
                                                                  <textarea rows="6" class="input_1" name="msg" cols="63"></textarea></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200"> G5< 2K 708=B5@5A>20=K?<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="interest">
 
				<option></option>
 
				<option>>?>;=8B5;L=>5 <=5=85</option>
 
                <option>5G5=85</option>
 
                                                                  </select>
 
                                                                  </td>
 
                                                                  </tr>
 
                                                                  <tr>
 
                                                  <td width="200">0:>2 20H 4803=>7?<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <textarea rows="6" class="input_1" name="diagnosis" cols="63"></textarea></td>
 
                                  </tr>
 
                                  
 
                                  <tr>
 
                                                  <td width="313" valign="top" style="padding-top:6px">@8:@5?8BL D09;:</td>
 
                                                  <td>
 
                <input type="hidden" name="MAX_FILE_SIZE" value="10485761" />
 
                <input type="file"  name="fileName" size="20" class="input_1">
 
                  <p><input type="submit" value="B>A;0BL" name="SendButton" class="btn_send"></p>
 
                                  </tr>
 
                  </table>
 
  </form>
 
HTML;
 
  
 
  echo "</body></html>" ;
 
 }
 
  
 
  if ($_POST)  
 
  {  
 
  if ( (!$_POST['firstName']) or 
 
                                (!$_POST['lastName']) or 
 
                                (!$_POST['country']) or 
 
                                (!$_POST['gender']) or 
 
                                (!$_POST['interest']) or 
 
                                (!$_POST['diagnosis']) or 
 
                                (!$_POST['email']) or 
 
                                (!$_POST['homephone']) )
 
  { 
 
                  echo "5>1E>48<> 70?>;=8BL 2A5 ?>;O!!!" ;
 
 
 
                  printForm() ;
 
  }
 
  else 
 
  {
 
                  sendMail($_POST) ; 
 
                  moveUploadedFile($_FILES,$_DirectoryToUploadInto) ; 
 
 
 
  }
 
  }
 
  else 
 
  {
 
                  printForm() ;
 
  }
 
  
 
  ?>
 
  
 
 
										  </td>
										</tr>
										
									</table>
								</td>
								<td width="170" style="padding-right:10px; padding-left:10px" class="menu_right_border" valign="top">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tr>
											<td class="menu_right">&nbsp;
												 
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
					
				<tr>
					<td height="25"></td>
				</tr>
				<tr>
					<td>
						<?php require('includes/footer.htm'); ?>
					</td>
				</tr>
				<tr>
					<td height="15"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
 
<script type="text/javascript">
 
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
 
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
 
</script>
 
<script type="text/javascript">
 
try {
 
var pageTracker = _gat._getTracker("UA-7814761-1");
 
pageTracker._trackPageview();
 
} catch(err) {}</script>
 
</body>
 
</html>

Open in new window

0
Comment
Question by:DanSmir
  • 19
  • 13
33 Comments
 
LVL 27

Expert Comment

by:Cornelia Yoder
ID: 24203567
Here is a very excellent little tutorial that will teach you how to create your own captcha very easily.

http://www.codewalkers.com/c/a/Miscellaneous/Creating-a-CAPTCHA-with-PHP/
0
 

Author Comment

by:DanSmir
ID: 24203651
Hello yodercm,
I tried that already no success...
May bee my code is wrong, But i couldn't implement any captcha code inside  it...

Can any one please watch the code ?


Thank you...
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:DanSmir
ID: 24203705
shobinsun,

I tried but i just stocked with my code.
Any explanation that i seen before not worked for me...
I pasted my submit code, may bee something wrong there??

10x
0
 
LVL 14

Expert Comment

by:shobinsun
ID: 24203953
Hi,

Use this code to your code:

      <tr>
            <td>
                  <table cellpadding="0" cellspacing="0" width="100%" class="top">
                        <tr>
                              <td class="top_txt" width="500" style="padding-left:20px; padding-bottom:20px" valign="bottom">
                                    <h1><img id="imgCaptcha" src="create_image.php" /> </h1>
                              </td>
                              <td width="450"></td>
                        </tr>
                  </table>
            </td>
      </tr>



instead of :


      <tr>
            <td>
                  <table cellpadding="0" cellspacing="0" width="100%" class="top">
                        <tr>
                              <td class="top_txt" width="500" style="padding-left:20px; padding-bottom:20px" valign="bottom">
                                    <h1>>A;0BL 70?@>A </h1>
                              </td>
                              <td width="450"></td>
                        </tr>
                  </table>
            </td>
      </tr>


and use the following code also:

and use php session to test that:

<?php
session_start();
if($_POST["txtCaptcha"] == $_SESSION["security_code"])
{
echo "Success";
}
else
{

echo "Not success";
}
//echo $_SESSION["security_code"];
 
?>



create_image.php:



<?php
//Start the session so we can store what the security code actually is
session_start();
 
//Send a generated image to the browser
create_image();
exit();
 
function create_image()
{
    //Let's generate a totally random string using md5
    $md5_hash = md5(rand(0,999)); 
    //We don't need a 32 character long string so we trim it down to 5 
    $security_code = substr($md5_hash, 15, 5); 
 
    //Set the session to store the security code
    $_SESSION["security_code"] = $security_code;
 
    //Set the image width and height
    $width = 100;
    $height = 20; 
 
    //Create the image resource 
    $image = ImageCreate($width, $height);  
 
    //We are making three colors, white, black and gray
    $white = ImageColorAllocate($image, 255, 255, 255);
    $black = ImageColorAllocate($image, 0, 0, 0);
    $grey = ImageColorAllocate($image, 204, 204, 204);
 
    //Make the background black 
    ImageFill($image, 0, 0, $black); 
 
    //Add randomly generated string in white to the image
    ImageString($image, 3, 30, 3, $security_code, $white); 
 
    //Throw in some lines to make it a little bit harder for any bots to break 
    ImageRectangle($image,0,0,$width-1,$height-1,$grey); 
    imageline($image, 0, $height/2, $width, $height/2, $grey); 
    imageline($image, $width/2, 0, $width/2, $height, $grey); 
 
    //Tell the browser what kind of file is come in 
    header("Content-Type: image/jpeg"); 
 
    //Output the newly created image in jpeg format 
    ImageJpeg($image);
   
    //Free up resources
    ImageDestroy($image);
}
?>

Open in new window

0
 
LVL 14

Expert Comment

by:shobinsun
ID: 24203992
Hi,

$_POST["txtCaptcha"] is the data from the html input page

and   $_SESSION["security_code"]  is the value in the  session
0
 

Author Comment

by:DanSmir
ID: 24204006
Shobinsun,
Thank you, i'm going to check it...
Will reply in 30 minutes.

Dan...;
0
 

Author Comment

by:DanSmir
ID: 24204069
shobinsun:
Here what i receive
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/imsg/public_html/mailer.php:5) in /home/imsg/public_html/mailer.php on line 917
Not success
	
 

Open in new window

0
 
LVL 14

Expert Comment

by:shobinsun
ID: 24204136
hi,

Then avoid the "session_start()".

and try.

also make sure that you are entering the corect captcha in the input box.

Regards
0
 

Author Comment

by:DanSmir
ID: 24204150
Shobinsun:
http://www.med-international.ru/mailer.php

No captcha box at all...
0
 

Author Comment

by:DanSmir
ID: 24204207
Shobinsun:
1. there is no captcha insert filed on screen
2. When i'm clicking submit (without entering captcha) receiving sucsess

I'm attaching current code..
10000000000 times Thank you :)

Here is page...
http://www.med-international.ru/mailer.php
<!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>
 <?php require('includes/meta_tegs.htm'); ?> 
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<table cellpadding="0" cellspacing="0" width="950" align="center" class="tbl_main">
	<tr>
		<td>
			<?php require('includes/menu_top.htm'); ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php require('includes/menu.htm'); ?>
		</td>
	</tr>
	<tr>
		<td height="1"></td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" width="100%" class="top">
				<tr>
					<td class="top_txt" width="500" style="padding-left:20px; padding-bottom:20px" valign="bottom">
						<h1>>A;0BL 70?@>A </h1>
					</td>
					<td width="450"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" width="100%" class="main" style="padding-top:25px">
				<tr>
					<td>
						<table cellpadding="0" cellspacing="0" width="100%">
							<tr>
								<td width="160" style="padding-left:10px" class="menu_left_border" valign="top">
									<?php require('includes/chat.htm'); ?>  
								</td>
								<td width="570" style="padding-right:10px; padding-left:15px" valign="top">
									<table cellpadding="0" cellspacing="0" width="100%" class="downloads">
										<tr>
										  <td style="padding-top:2px">
												<?php
												
												
if($_POST["txtCaptcha"] == $_SESSION["security_code"])
{
echo "Success";
}
else
{
 
echo "Not success";
}
//echo $_SESSION["security_code"];
 
  $_DirectoryToUploadInto = "./" ;
 
  $addressToSentTo = "dan@vario.co.il" ; 
 
  $addressToSentFrom = "submit-user@med-international.ru" ; 
 
  
 
  
 
function moveUploadedFile($_FILES,$_DirectoryToUploadInto)
 
  {
 
                global $_FILES ;
 
   $uploadfile = $_DirectoryToUploadInto . basename($_FILES['fileName']['name']);
 
  
 
  
 
                  if (move_uploaded_file($_FILES['fileName']['tmp_name'], $uploadfile)) 
 
                                  {
 
                                      echo "\n *\n";
 
                                  } 
 
                  else 
 
                                  {
 
                                      echo "\n0H5 ?8AL<> >B>A;0=> 157 ?@8:@5?;5==>3> D09;0. !?0A81>.!\n";
 
 
 
                                  }
 
        putFileOnFTP(basename($_FILES['fileName']['name']));
 
        
 
  }
 
  
 
function putFileOnFTP($fileName)
 
{
 
$ftp_server = "69.174.48.166" ; 
 
$ftp_user_name = "submit@med-international.ru" ; 
 
$ftp_user_pass = "123" ; 
 
 
 
$file = $fileName; 
 
$remote_file = $fileName; 
 
 
 
 
 
$conn_id = ftp_connect($ftp_server);
 
 
 
 
 
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
 
 
 
 
 
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
 
 echo "$file 03@C65= =0 A5@25@, !?081>\n";
 
 
 
} else {
 
 echo "$file\n";
 
}
 
 
 
ftp_close($conn_id);
 
}  
 
 
 
 function sendMail($postedData) 
 
  {
 
                  global $addressToSentTo, $addressToSentFrom, $_FILES;
 
                  
 
  $to      = $addressToSentTo ;
 
  $subject = "Submit form"; 
 
  
 
  if (!$_FILES['fileName']['name']) 
 
  {
 
                $sendedFile = "D09; =5 1K; 2KA;0=." ;
 
  }
 
  else
 
  {
 
                $sendedFile = "KA;0==K9 D09;: ".$_FILES['fileName']['name'] ;
 
  } 
 
  
 
  $message = "
 
{$postedData['firstName']} 
 
{$postedData['lastName']} 
 
{$postedData['gender']}
 
{$postedData['day']}/{$postedData['month']}/{$postedData['year']}
 
{$postedData['city']} 
 
{$postedData['zip']}
 
{$postedData['country']}
 
{$postedData['fileName']} 
 
{$postedData['homephone']}
 
{$postedData['workphone']}
 
{$postedData['interest']}
 
{$postedData['email']}
 
{$postedData['mobilephone']}
 
{$postedData['diagnosis']}
 
{$postedData['fileName']}
 
{$sendedFile} 
 
{$postedData['msg']} ";
 
  
 
  $headers = 'From: '.$addressToSentFrom."\n" .
 
                     'Reply-To:'.$addressToSentFrom ;
 
  
 
  mail($to, $subject, $message, $headers);
 
  }
 
  
 
  function printForm()
 
  {
 
	  echo <<<HTML
 
  <html>
 
  
 
  <head>
 
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 
  <link rel="stylesheet" type="text/css" href="mailer_style.css">
 
 
 
  <title>Post Form</title>
 
  <style>
 
.text:focus, textarea:focus {
 
  background-color: #FFFACC;
 
    }
 
  .message
 
{
 
    font-weight:bold;
 
    color:Red;
 
    font-size:large;
 
}
 
  
 
</style>
 
  </head>
 
  
 
  <body>
 
HTML;
 
echo <<<HTML
 
  <form enctype="multipart/form-data" action="mailer.php" method="POST">
 
  
 
                  <table border="0" width="500" class="table">
 
                                  <tr>
 
 
 
                                                                                                                                                                                                  <td width="200"><O<span class="must">*</span></td>
 
                                                                                                                                                                                                  
 
                                                  <td><input class="input_1" type="text" name="firstName" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">$0<8;8O<span class="must">*</span></td>
 
                                                  <td><input class="input_1" type="text" name="lastName" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>;<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="gender">
 
				<option></option>
 
				<option>C6G8=0</option>
 
                <option>5=I8=0</option>
 
                                                                  </select>
 
                                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">0B0 @>645=8O (5=L/5AOF/>4)</td>
 
                                                  <td>
 
                                                  <select size="1" class="input_1" name="day">
 
<option>1</option>
 
<option>2</option>
 
<option>3</option>
 
<option>4</option>
 
<option>5</option>
 
<option>6</option>
 
<option>7</option>
 
<option>8</option>
 
<option>9</option>
 
<option>10</option>
 
<option>11</option>
 
<option>12</option>
 
<option>13</option>
 
<option>14</option>
 
<option>15</option>
 
<option>16</option>
 
<option>17</option>
 
<option>18</option>
 
<option>19</option>
 
<option>20</option>
 
<option>21</option>
 
<option>22</option>
 
<option>23</option>
 
<option>24</option>
 
<option>25</option>
 
<option>26</option>
 
<option>27</option>
 
<option>28</option>
 
<option>29</option>
 
<option>30</option>
 
<option>31</option>
 
</select>
 
<select size="1" class="input_1"name="month">
 
<option>/=20@L</option>
 
<option>$52@0;L</option>
 
<option>0@B</option>
 
<option>?@5;L</option>
 
<option>09</option>
 
<option>N=L</option>
 
<option>N;L</option>
 
<option>23CAB</option>
 
<option>!5=BO1@L</option>
 
<option>:BO1@L</option>
 
<option>>O1@L</option>
 
<option>5:01@L</option>
 
</select>
 
<select size="1" class="input_1"name="year">
 
<option>	1930	</option>
 
<option>	1931	</option>
 
<option>	1932	</option>
 
<option>	1933	</option>
 
<option>	1934	</option>
 
<option>	1935	</option>
 
<option>	1936	</option>
 
<option>	1937	</option>
 
<option>	1938	</option>
 
<option>	1939	</option>
 
<option>	1940	</option>
 
<option>	1941	</option>
 
<option>	1942	</option>
 
<option>	1943	</option>
 
<option>	1944	</option>
 
<option>	1945	</option>
 
<option>	1946	</option>
 
<option>	1947	</option>
 
<option>	1948	</option>
 
<option>	1949	</option>
 
<option>	1950	</option>
 
<option>	1951	</option>
 
<option>	1952	</option>
 
<option>	1953	</option>
 
<option>	1954	</option>
 
<option>	1955	</option>
 
<option>	1956	</option>
 
<option>	1957	</option>
 
<option>	1958	</option>
 
<option>	1959	</option>
 
<option>	1960	</option>
 
<option>	1961	</option>
 
<option>	1962	</option>
 
<option>	1963	</option>
 
<option>	1964	</option>
 
<option>	1965	</option>
 
<option>	1966	</option>
 
<option>	1967	</option>
 
<option>	1968	</option>
 
<option>	1969	</option>
 
<option>	1970	</option>
 
<option>	1971	</option>
 
<option>	1972	</option>
 
<option>	1973	</option>
 
<option>	1974	</option>
 
<option>	1975	</option>
 
<option>	1976	</option>
 
<option>	1977	</option>
 
<option>	1978	</option>
 
<option>	1979	</option>
 
<option>	1980	</option>
 
<option>	1981	</option>
 
<option>	1982	</option>
 
<option>	1983	</option>
 
<option>	1984	</option>
 
<option>	1985	</option>
 
<option>	1986	</option>
 
<option>	1987	</option>
 
<option>	1988	</option>
 
<option>	1989	</option>
 
<option>	1990	</option>
 
<option>	1991	</option>
 
<option>	1992	</option>
 
<option>	1993	</option>
 
<option>	1994	</option>
 
<option>	1995	</option>
 
<option>	1996	</option>
 
<option>	1997	</option>
 
<option>	1998	</option>
 
<option>	1999	</option>
 
<option>	2000	</option>
 
<option>	2001	</option>
 
<option>	2002	</option>
 
<option>	2003	</option>
 
<option>	2004	</option>
 
<option>	2005	</option>
 
<option>	2006	</option>
 
<option>	2007	</option>
 
<option>	2008	</option>
 
<option>	2009	</option>
 
<option>	2010	</option>
 
<option>	2011	</option>
 
<option>	2012	</option>
 
<option>	2013	</option>
 
<option>	2014	</option>
 
<option>	2015	</option>
 
<option>	2016	</option>
 
<option>	2017	</option>
 
<option>	2018	</option>
 
<option>	2019	</option>
 
<option>	2020	</option>
 
<option>	2021	</option>
 
<option>	2022	</option>
 
<option>	2023	</option>
 
<option>	2024	</option>
 
<option>	2025	</option>
 
<option>	2026	</option>
 
<option>	2027	</option>
 
<option>	2028	</option>
 
<option>	2029	</option>
 
<option>	2030	</option>
 
 
 
</select>
 
                             </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>@>4</td>
 
                                                  <td><input class="input_1" type="text" name="city" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>GB>2K9 8=45:A</td>
 
                                                  <td><input class="input_1" type="text" name="zip" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">!B@0=0 ?@>6820=8O<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="country">
 
  <option></option>
 
  <option> >AA8O</option>
 
  <option>@<5=8O</option>
 
  <option>75@10;L460=</option>
 
  <option>5;0@CAL</option>
 
  <option>@C78O</option>
 
  <option>-AB>=8O</option>
 
  <option>070EAB0=</option>
 
  <option>0B28O</option>
 
  <option>8B20</option>
 
  <option>>;4028O</option>
 
  <option>#:@08=0</option>
 
  <option>#715:8AB0=</option>    
 
<option></option>
 
<option>	2AB@8O	</option>
<option>	;10=8O	</option>
<option>	=4>@@0	</option>
<option>	5;L38O	</option>
<option>	>;30@8O	</option>
<option>	>A=8O 8 5@F53>28=0	</option>
<option>	0B8:0=	</option>
<option>	5;8:>1@8B0=8O	</option>
<option>	5=3@8O	</option>
<option>	5@<0=8O	</option>
<option>	@5F8O	</option>
<option>	0=8O	</option>
<option>	@;0=48O	</option>
<option>	A;0=48O	</option>
<option>	A?0=8O	</option>
<option>	B0;8O	</option>
<option>	8?@	</option>
<option>	8EB5=HB59=	</option>
<option>	N:A5<1C@3	</option>
<option>	0:54>=8O	</option>
<option>	0;LB0	</option>
<option>	>=0:>	</option>
<option>	845@;0=4K	</option>
<option>	>@2538O	</option>
<option>	>;LH0	</option>
<option>	>@BC30;8O	</option>
<option>	 C<K=8O	</option>
<option>	!0=-0@8=>	</option>
<option>	!5@18O	</option>
<option>	!;>20:8O	</option>
<option>	!;>25=8O	</option>
<option>	"C@F8O	</option>
<option>	$8=;O=48O	</option>
<option>	$@0=F8O	</option>
<option>	%>@20B8O	</option>
<option>	'5@=>3>@8O	</option>
<option>	'5E8O	</option>
<option>	(259F0@8O	</option>
<option>	(25F8O	</option>
  
 
</select>
 
                                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200">><0H=89 B5;5D>=<span class="must">*</span></td>
 
                                   <td><input class="input_1"type="text" name="homephone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200"> 01>G89 B5;5D>=</td>
 
                                   <td><input class="input_1"type="text" name="workphone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200">>18;L=K9 B5;5D>=</td>
 
                                   <td><input class="input_1"type="text" name="mobilephone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
								  <tr>
 
                                   <td width="200">E-mail<span class="must">*</span></td>
 
                                   <td><input class="input_1"type="text" name="email" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">0H5 A>>1I5=85</td>
 
                                                  <td>
 
                                                                  <textarea rows="6" class="input_1" name="msg" cols="63"></textarea></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200"> G5< 2K 708=B5@5A>20=K?<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="interest">
 
				<option></option>
 
				<option>>?>;=8B5;L=>5 <=5=85</option>
 
                <option>5G5=85</option>
 
                                                                  </select>
 
                                                                  </td>
 
                                                                  </tr>
 
                                                                  <tr>
 
                                                  <td width="200">0:>2 20H 4803=>7?<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <textarea rows="6" class="input_1" name="diagnosis" cols="63"></textarea></td>
 
                                  </tr>
 
                                  
 
                                  <tr>
 
                                                  <td width="313" valign="top" style="padding-top:6px">@8:@5?8BL D09;:</td>
 
                                                  <td>
 
                <input type="hidden" name="MAX_FILE_SIZE" value="10485761" />
 
                <input type="file"  name="fileName" size="20" class="input_1">
 
                  <p><input type="submit" value="B>A;0BL" name="SendButton" class="btn_send"></p>
 
                                  </tr>
								   <tr>
            <td>
                  
                       
                                    <h1><img id="imgCaptcha" src="create_image.php" /> </h1>
                              </td>
                              <td width="100"></td>
                        
                              
      </tr>
 
                  </table>
				  
 
  </form>
 
HTML;
 
  
 
  echo "</body></html>" ;
 
 }
 
  
 
  if ($_POST)  
 
  {  
 
  if ( (!$_POST['firstName']) or 
 
                                (!$_POST['lastName']) or 
 
                                (!$_POST['country']) or 
 
                                (!$_POST['gender']) or 
 
                                (!$_POST['interest']) or 
 
                                (!$_POST['diagnosis']) or 
 
                                (!$_POST['email']) or 
 
                                (!$_POST['homephone']) )
 
  { 
 
                  echo "5>1E>48<> 70?>;=8BL 2A5 ?>;O!!!" ;
 
 
 
                  printForm() ;
 
  }
 
  else 
 
  {
 
                  sendMail($_POST) ; 
 
                  moveUploadedFile($_FILES,$_DirectoryToUploadInto) ; 
 
 
 
  }
 
  }
 
  else 
 
  {
 
                  printForm() ;
 
  }
 
  
 
  ?>
 
  
 
 
										  </td>
										</tr>
										
									</table>
								</td>
								<td width="170" style="padding-right:10px; padding-left:10px" class="menu_right_border" valign="top">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tr>
											<td class="menu_right">&nbsp;
												 
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
					
				<tr>
					<td height="25"></td>
				</tr>
				<tr>
					<td>
						<?php require('includes/footer.htm'); ?>
					</td>
				</tr>
				<tr>
					<td height="15"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
 
<script type="text/javascript">
 
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
 
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
 
</script>
 
<script type="text/javascript">
 
try {
 
var pageTracker = _gat._getTracker("UA-7814761-1");
 
pageTracker._trackPageview();
 
} catch(err) {}</script>
 
</body>
 
</html>

Open in new window

0
 

Author Comment

by:DanSmir
ID: 24204461
Guys,
I'm receiving success even if I'm not typing code at all...
Please assist
<!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>
 <?php require('includes/meta_tegs.htm'); ?> 
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<table cellpadding="0" cellspacing="0" width="950" align="center" class="tbl_main">
	<tr>
		<td>
			<?php require('includes/menu_top.htm'); ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php require('includes/menu.htm'); ?>
		</td>
	</tr>
	<tr>
		<td height="1"></td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" width="100%" class="top">
				<tr>
					<td class="top_txt" width="500" style="padding-left:20px; padding-bottom:20px" valign="bottom">
						<h1>>A;0BL 70?@>A </h1>
					</td>
					<td width="450"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" width="100%" class="main" style="padding-top:25px">
				<tr>
					<td>
						<table cellpadding="0" cellspacing="0" width="100%">
							<tr>
								<td width="160" style="padding-left:10px" class="menu_left_border" valign="top">
									<?php require('includes/chat.htm'); ?>  
								</td>
								<td width="570" style="padding-right:10px; padding-left:15px" valign="top">
									<table cellpadding="0" cellspacing="0" width="100%" class="downloads">
										<tr>
										  <td style="padding-top:2px">
												<?php
												
												
 
 
  $_DirectoryToUploadInto = "./" ;
 
  $addressToSentTo = "dan@vario.co.il" ; 
 
  $addressToSentFrom = "submit-user@med-international.ru" ; 
 
  
 
  
 
function moveUploadedFile($_FILES,$_DirectoryToUploadInto)
 
  {
 
                global $_FILES ;
 
   $uploadfile = $_DirectoryToUploadInto . basename($_FILES['fileName']['name']);
 
  
 
  
 
                  if (move_uploaded_file($_FILES['fileName']['tmp_name'], $uploadfile)) 
 
                                  {
 
                                      echo "\n *\n";
 
                                  } 
 
                  else 
 
                                  {
 
                                      echo "\n0H5 ?8AL<> >B>A;0=> 157 ?@8:@5?;5==>3> D09;0. !?0A81>.!\n";
 
 
 
                                  }
 
        putFileOnFTP(basename($_FILES['fileName']['name']));
 
        
 
  }
 
  
 
function putFileOnFTP($fileName)
 
{
 
$ftp_server = "69.174.48.166" ; 
 
$ftp_user_name = "submit@med-international.ru" ; 
 
$ftp_user_pass = "123" ; 
 
 
 
$file = $fileName; 
 
$remote_file = $fileName; 
 
 
 
 
 
$conn_id = ftp_connect($ftp_server);
 
 
 
 
 
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
 
 
 
 
 
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
 
 echo "$file 03@C65= =0 A5@25@, !?081>\n";
 
 
 
} else {
 
 echo "$file\n";
 
}
 
 
 
ftp_close($conn_id);
 
}  
 
 
 
 function sendMail($postedData) 
 
  {
 
                  global $addressToSentTo, $addressToSentFrom, $_FILES;
 
                  
 
  $to      = $addressToSentTo ;
 
  $subject = "Submit form"; 
 
  
 
  if (!$_FILES['fileName']['name']) 
 
  {
 
                $sendedFile = "D09; =5 1K; 2KA;0=." ;
 
  }
 
  else
 
  {
 
                $sendedFile = "KA;0==K9 D09;: ".$_FILES['fileName']['name'] ;
 
  } 
 
  
 
  $message = "
 
{$postedData['firstName']} 
 
{$postedData['lastName']} 
 
{$postedData['gender']}
 
{$postedData['day']}/{$postedData['month']}/{$postedData['year']}
 
{$postedData['city']} 
 
{$postedData['zip']}
 
{$postedData['country']}
 
{$postedData['fileName']} 
 
{$postedData['homephone']}
 
{$postedData['workphone']}
 
{$postedData['interest']}
 
{$postedData['email']}
 
{$postedData['mobilephone']}
 
{$postedData['diagnosis']}
 
{$postedData['fileName']}
 
{$sendedFile} 
 
{$postedData['msg']} ";
 
  
 
  $headers = 'From: '.$addressToSentFrom."\n" .
 
                     'Reply-To:'.$addressToSentFrom ;
 
  
 
  mail($to, $subject, $message, $headers);
 
  }
 
  
 
  function printForm()
 
  {
 
	  echo <<<HTML
 
  <html>
 
  
 
  <head>
 
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 
  <link rel="stylesheet" type="text/css" href="mailer_style.css">
 
 
 
  <title>Post Form</title>
 
  <style>
 
.text:focus, textarea:focus {
 
  background-color: #FFFACC;
 
    }
 
  .message
 
{
 
    font-weight:bold;
 
    color:Red;
 
    font-size:large;
 
}
 
  
 
</style>
 
  </head>
 
  
 
  <body>
 
HTML;
 
echo <<<HTML
 
  <form enctype="multipart/form-data" action="mailer.php" method="POST">
 
  
 
                  <table border="0" width="500" class="table">
 
                                  <tr>
 
 
 
                                                                                                                                                                                                  <td width="200"><O<span class="must">*</span></td>
 
                                                                                                                                                                                                  
 
                                                  <td><input class="input_1" type="text" name="firstName" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">$0<8;8O<span class="must">*</span></td>
 
                                                  <td><input class="input_1" type="text" name="lastName" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>;<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="gender">
 
				<option></option>
 
				<option>C6G8=0</option>
 
                <option>5=I8=0</option>
 
                                                                  </select>
 
                                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">0B0 @>645=8O (5=L/5AOF/>4)</td>
 
                                                  <td>
 
                                                  <select size="1" class="input_1" name="day">
 
<option>1</option>
 
<option>2</option>
 
<option>3</option>
 
<option>4</option>
 
<option>5</option>
 
<option>6</option>
 
<option>7</option>
 
<option>8</option>
 
<option>9</option>
 
<option>10</option>
 
<option>11</option>
 
<option>12</option>
 
<option>13</option>
 
<option>14</option>
 
<option>15</option>
 
<option>16</option>
 
<option>17</option>
 
<option>18</option>
 
<option>19</option>
 
<option>20</option>
 
<option>21</option>
 
<option>22</option>
 
<option>23</option>
 
<option>24</option>
 
<option>25</option>
 
<option>26</option>
 
<option>27</option>
 
<option>28</option>
 
<option>29</option>
 
<option>30</option>
 
<option>31</option>
 
</select>
 
<select size="1" class="input_1"name="month">
 
<option>/=20@L</option>
 
<option>$52@0;L</option>
 
<option>0@B</option>
 
<option>?@5;L</option>
 
<option>09</option>
 
<option>N=L</option>
 
<option>N;L</option>
 
<option>23CAB</option>
 
<option>!5=BO1@L</option>
 
<option>:BO1@L</option>
 
<option>>O1@L</option>
 
<option>5:01@L</option>
 
</select>
 
<select size="1" class="input_1"name="year">
 
<option>	1930	</option>
 
<option>	1931	</option>
 
<option>	1932	</option>
 
<option>	1933	</option>
 
<option>	1934	</option>
 
<option>	1935	</option>
 
<option>	1936	</option>
 
<option>	1937	</option>
 
<option>	1938	</option>
 
<option>	1939	</option>
 
<option>	1940	</option>
 
<option>	1941	</option>
 
<option>	1942	</option>
 
<option>	1943	</option>
 
<option>	1944	</option>
 
<option>	1945	</option>
 
<option>	1946	</option>
 
<option>	1947	</option>
 
<option>	1948	</option>
 
<option>	1949	</option>
 
<option>	1950	</option>
 
<option>	1951	</option>
 
<option>	1952	</option>
 
<option>	1953	</option>
 
<option>	1954	</option>
 
<option>	1955	</option>
 
<option>	1956	</option>
 
<option>	1957	</option>
 
<option>	1958	</option>
 
<option>	1959	</option>
 
<option>	1960	</option>
 
<option>	1961	</option>
 
<option>	1962	</option>
 
<option>	1963	</option>
 
<option>	1964	</option>
 
<option>	1965	</option>
 
<option>	1966	</option>
 
<option>	1967	</option>
 
<option>	1968	</option>
 
<option>	1969	</option>
 
<option>	1970	</option>
 
<option>	1971	</option>
 
<option>	1972	</option>
 
<option>	1973	</option>
 
<option>	1974	</option>
 
<option>	1975	</option>
 
<option>	1976	</option>
 
<option>	1977	</option>
 
<option>	1978	</option>
 
<option>	1979	</option>
 
<option>	1980	</option>
 
<option>	1981	</option>
 
<option>	1982	</option>
 
<option>	1983	</option>
 
<option>	1984	</option>
 
<option>	1985	</option>
 
<option>	1986	</option>
 
<option>	1987	</option>
 
<option>	1988	</option>
 
<option>	1989	</option>
 
<option>	1990	</option>
 
<option>	1991	</option>
 
<option>	1992	</option>
 
<option>	1993	</option>
 
<option>	1994	</option>
 
<option>	1995	</option>
 
<option>	1996	</option>
 
<option>	1997	</option>
 
<option>	1998	</option>
 
<option>	1999	</option>
 
<option>	2000	</option>
 
<option>	2001	</option>
 
<option>	2002	</option>
 
<option>	2003	</option>
 
<option>	2004	</option>
 
<option>	2005	</option>
 
<option>	2006	</option>
 
<option>	2007	</option>
 
<option>	2008	</option>
 
<option>	2009	</option>
 
<option>	2010	</option>
 
<option>	2011	</option>
 
<option>	2012	</option>
 
<option>	2013	</option>
 
<option>	2014	</option>
 
<option>	2015	</option>
 
<option>	2016	</option>
 
<option>	2017	</option>
 
<option>	2018	</option>
 
<option>	2019	</option>
 
<option>	2020	</option>
 
<option>	2021	</option>
 
<option>	2022	</option>
 
<option>	2023	</option>
 
<option>	2024	</option>
 
<option>	2025	</option>
 
<option>	2026	</option>
 
<option>	2027	</option>
 
<option>	2028	</option>
 
<option>	2029	</option>
 
<option>	2030	</option>
 
 
 
</select>
 
                             </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>@>4</td>
 
                                                  <td><input class="input_1" type="text" name="city" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>GB>2K9 8=45:A</td>
 
                                                  <td><input class="input_1" type="text" name="zip" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">!B@0=0 ?@>6820=8O<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="country">
 
  <option></option>
 
  <option> >AA8O</option>
 
  <option>@<5=8O</option>
 
  <option>75@10;L460=</option>
 
  <option>5;0@CAL</option>
 
  <option>@C78O</option>
 
  <option>-AB>=8O</option>
 
  <option>070EAB0=</option>
 
  <option>0B28O</option>
 
  <option>8B20</option>
 
  <option>>;4028O</option>
 
  <option>#:@08=0</option>
 
  <option>#715:8AB0=</option>    
 
<option></option>
 
<option>	2AB@8O	</option>
<option>	;10=8O	</option>
<option>	=4>@@0	</option>
<option>	5;L38O	</option>
<option>	>;30@8O	</option>
<option>	>A=8O 8 5@F53>28=0	</option>
<option>	0B8:0=	</option>
<option>	5;8:>1@8B0=8O	</option>
<option>	5=3@8O	</option>
<option>	5@<0=8O	</option>
<option>	@5F8O	</option>
<option>	0=8O	</option>
<option>	@;0=48O	</option>
<option>	A;0=48O	</option>
<option>	A?0=8O	</option>
<option>	B0;8O	</option>
<option>	8?@	</option>
<option>	8EB5=HB59=	</option>
<option>	N:A5<1C@3	</option>
<option>	0:54>=8O	</option>
<option>	0;LB0	</option>
<option>	>=0:>	</option>
<option>	845@;0=4K	</option>
<option>	>@2538O	</option>
<option>	>;LH0	</option>
<option>	>@BC30;8O	</option>
<option>	 C<K=8O	</option>
<option>	!0=-0@8=>	</option>
<option>	!5@18O	</option>
<option>	!;>20:8O	</option>
<option>	!;>25=8O	</option>
<option>	"C@F8O	</option>
<option>	$8=;O=48O	</option>
<option>	$@0=F8O	</option>
<option>	%>@20B8O	</option>
<option>	'5@=>3>@8O	</option>
<option>	'5E8O	</option>
<option>	(259F0@8O	</option>
<option>	(25F8O	</option>
  
 
</select>
 
                                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200">><0H=89 B5;5D>=<span class="must">*</span></td>
 
                                   <td><input class="input_1"type="text" name="homephone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200"> 01>G89 B5;5D>=</td>
 
                                   <td><input class="input_1"type="text" name="workphone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200">>18;L=K9 B5;5D>=</td>
 
                                   <td><input class="input_1"type="text" name="mobilephone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
								  <tr>
 
                                   <td width="200">E-mail<span class="must">*</span></td>
 
                                   <td><input class="input_1"type="text" name="email" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">0H5 A>>1I5=85</td>
 
                                                  <td>
 
                                                                  <textarea rows="6" class="input_1" name="msg" cols="63"></textarea></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200"> G5< 2K 708=B5@5A>20=K?<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="interest">
 
				<option></option>
 
				<option>>?>;=8B5;L=>5 <=5=85</option>
 
                <option>5G5=85</option>
 
                                                                  </select>
 
                                                                  </td>
 
                                                                  </tr>
 
                                                                  <tr>
 
                                                  <td width="200">0:>2 20H 4803=>7?<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <textarea rows="6" class="input_1" name="diagnosis" cols="63"></textarea></td>
 
                                  </tr>
 
                                  
 
                                  <tr>
 
                                                  <td width="313" valign="top" style="padding-top:6px">@8:@5?8BL D09;:</td>
 
                                                  <td>
 
                <input type="hidden" name="MAX_FILE_SIZE" value="10485761" />
 
                <input type="file"  name="fileName" size="20" class="input_1">
 
                  <p><input type="submit" value="B>A;0BL" name="SendButton" class="btn_send"></p>
 
                                  </tr>
								   <tr>
            <td>
                  
                       
                                    <h1><img id="imgCaptcha" src="create_image.php" /> </h1>
                              </td>
                              <td ><input width="50" class="input_1"> </td>
                        
                              
      </tr>
 
                  </table>
				  
 
  </form>
 
HTML;
 
  
 
  echo "</body></html>" ;
 
 }
 
  
 
  if ($_POST)  
 
  {  
 
  if ( (!$_POST['firstName']) or 
 
                                (!$_POST['lastName']) or 
 
                                (!$_POST['country']) or 
 
                                (!$_POST['gender']) or 
 
                                (!$_POST['interest']) or 
 
                                (!$_POST['diagnosis']) or 
 
                                (!$_POST['email']) or 
								
								
                                (!$_POST['homephone']) )
 
  { 
 
                  echo "5>1E>48<> 70?>;=8BL 2A5 ?>;O!!!" ;
 
 
 
if($_POST["txtCaptcha"] == $_SESSION["security_code"])
{
echo "Success";
}
else
{
 
echo "Not success";
}
//echo $_SESSION["security_code"];
 
 
 
                  printForm() ;
 
  }
 
  else 
 
  {
 
                  sendMail($_POST) ; 
 
                  moveUploadedFile($_FILES,$_DirectoryToUploadInto) ; 
 
 
 
  }
 
  }
 
  else 
 
  {
 
                  printForm() ;
 
  }
 
  
 
  ?>
 
  
 
 
										  </td>
										</tr>
										
									</table>
								</td>
								<td width="170" style="padding-right:10px; padding-left:10px" class="menu_right_border" valign="top">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tr>
											<td class="menu_right">&nbsp;
												 
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
					
				<tr>
					<td height="25"></td>
				</tr>
				<tr>
					<td>
						<?php require('includes/footer.htm'); ?>
					</td>
				</tr>
				<tr>
					<td height="15"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
 
<script type="text/javascript">
 
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
 
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
 
</script>
 
<script type="text/javascript">
 
try {
 
var pageTracker = _gat._getTracker("UA-7814761-1");
 
pageTracker._trackPageview();
 
} catch(err) {}</script>
 
</body>
 
</html>

Open in new window

0
 

Author Comment

by:DanSmir
ID: 24205350
Dear experts,
Please help me with that crazy code....
Many many 10x.
Dan
0
 
LVL 14

Expert Comment

by:shobinsun
ID: 24211662
Hi,

use the following code. Its working:

Regards
<!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>
 <?php //require('includes/meta_tegs.htm'); ?> 
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<table cellpadding="0" cellspacing="0" width="950" align="center" class="tbl_main">
	<tr>
		<td>
			<?php //require('includes/menu_top.htm'); ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php //require('includes/menu.htm'); ?>
		</td>
	</tr>
	<tr>
		<td height="1"></td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" width="100%" class="top">
				<tr>
					<td class="top_txt" width="500" style="padding-left:20px; padding-bottom:20px" valign="bottom">
						<h1>>A;0BL 70?@>A </h1>
					</td>
					<td width="450"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" width="100%" class="main" style="padding-top:25px">
				<tr>
					<td>
						<table cellpadding="0" cellspacing="0" width="100%">
							<tr>
								<td width="160" style="padding-left:10px" class="menu_left_border" valign="top">
									<?php //require('includes/chat.htm'); ?>  
								</td>
								<td width="570" style="padding-right:10px; padding-left:15px" valign="top">
									<table cellpadding="0" cellspacing="0" width="100%" class="downloads">
										<tr>
										  <td style="padding-top:2px">
												<?php
												
												
 
 
  $_DirectoryToUploadInto = "./" ;
 
  $addressToSentTo = "dan@vario.co.il" ; 
 
  $addressToSentFrom = "submit-user@med-international.ru" ; 
 
  
 
  
 
function moveUploadedFile($_FILES,$_DirectoryToUploadInto)
 
  {
 
                global $_FILES ;
 
   $uploadfile = $_DirectoryToUploadInto . basename($_FILES['fileName']['name']);
 
  
 
  
 
                  if (move_uploaded_file($_FILES['fileName']['tmp_name'], $uploadfile)) 
 
                                  {
 
                                      echo "\n *\n";
 
                                  } 
 
                  else 
 
                                  {
 
                                      echo "\n0H5 ?8AL<> >B>A;0=> 157 ?@8:@5?;5==>3> D09;0. !?0A81>.!\n";
 
 
 
                                  }
 
        putFileOnFTP(basename($_FILES['fileName']['name']));
 
        
 
  }
 
  
 
function putFileOnFTP($fileName)
 
{
 
$ftp_server = "69.174.48.166" ; 
 
$ftp_user_name = "submit@med-international.ru" ; 
 
$ftp_user_pass = "123" ; 
 
 
 
$file = $fileName; 
 
$remote_file = $fileName; 
 
 
 
 
 
$conn_id = ftp_connect($ftp_server);
 
 
 
 
 
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
 
 
 
 
 
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
 
 echo "$file 03@C65= =0 A5@25@, !?081>\n";
 
 
 
} else {
 
 echo "$file\n";
 
}
 
 
 
ftp_close($conn_id);
 
}  
 
 
 
 function sendMail($postedData) 
 
  {
 
                  global $addressToSentTo, $addressToSentFrom, $_FILES;
 
                  
 
  $to      = $addressToSentTo ;
 
  $subject = "Submit form"; 
 
  
 
  if (!$_FILES['fileName']['name']) 
 
  {
 
                $sendedFile = "D09; =5 1K; 2KA;0=." ;
 
  }
 
  else
 
  {
 
                $sendedFile = "KA;0==K9 D09;: ".$_FILES['fileName']['name'] ;
 
  } 
 
  
 
  $message = "
 
{$postedData['firstName']} 
 
{$postedData['lastName']} 
 
{$postedData['gender']}
 
{$postedData['day']}/{$postedData['month']}/{$postedData['year']}
 
{$postedData['city']} 
 
{$postedData['zip']}
 
{$postedData['country']}
 
{$postedData['fileName']} 
 
{$postedData['homephone']}
 
{$postedData['workphone']}
 
{$postedData['interest']}
 
{$postedData['email']}
 
{$postedData['mobilephone']}
 
{$postedData['diagnosis']}
 
{$postedData['fileName']}
 
{$sendedFile} 
 
{$postedData['msg']} ";
 
  
 
  $headers = 'From: '.$addressToSentFrom."\n" .
 
                     'Reply-To:'.$addressToSentFrom ;
 
  
 
  mail($to, $subject, $message, $headers);
 
  }
 
  
 
  function printForm()
 
  {
 
	  echo <<<HTML
 
  <html>
 
  
 
  <head>
 
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 
  <link rel="stylesheet" type="text/css" href="mailer_style.css">
 
 
 
  <title>Post Form</title>
 
  <style>
 
.text:focus, textarea:focus {
 
  background-color: #FFFACC;
 
    }
 
  .message
 
{
 
    font-weight:bold;
 
    color:Red;
 
    font-size:large;
 
}
 
  
 
</style>
 
  </head>
 
  
 
  <body>
 
HTML;
 
echo <<<HTML
 
  <form enctype="multipart/form-data" action="captcha.php" method="POST">
 
  
 
                  <table border="0" width="500" class="table">
 
                                  <tr>
 
 
 
                                                                                                                                                                                                  <td width="200"><O<span class="must">*</span></td>
 
                                                                                                                                                                                                  
 
                                                  <td><input class="input_1" type="text" name="firstName" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">$0<8;8O<span class="must">*</span></td>
 
                                                  <td><input class="input_1" type="text" name="lastName" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>;<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="gender">
 
				<option></option>
 
				<option>C6G8=0</option>
 
                <option>5=I8=0</option>
 
                                                                  </select>
 
                                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">0B0 @>645=8O (5=L/5AOF/>4)</td>
 
                                                  <td>
 
                                                  <select size="1" class="input_1" name="day">
 
<option>1</option>
 
<option>2</option>
 
<option>3</option>
 
<option>4</option>
 
<option>5</option>
 
<option>6</option>
 
<option>7</option>
 
<option>8</option>
 
<option>9</option>
 
<option>10</option>
 
<option>11</option>
 
<option>12</option>
 
<option>13</option>
 
<option>14</option>
 
<option>15</option>
 
<option>16</option>
 
<option>17</option>
 
<option>18</option>
 
<option>19</option>
 
<option>20</option>
 
<option>21</option>
 
<option>22</option>
 
<option>23</option>
 
<option>24</option>
 
<option>25</option>
 
<option>26</option>
 
<option>27</option>
 
<option>28</option>
 
<option>29</option>
 
<option>30</option>
 
<option>31</option>
 
</select>
 
<select size="1" class="input_1"name="month">
 
<option>/=20@L</option>
 
<option>$52@0;L</option>
 
<option>0@B</option>
 
<option>?@5;L</option>
 
<option>09</option>
 
<option>N=L</option>
 
<option>N;L</option>
 
<option>23CAB</option>
 
<option>!5=BO1@L</option>
 
<option>:BO1@L</option>
 
<option>>O1@L</option>
 
<option>5:01@L</option>
 
</select>
 
<select size="1" class="input_1"name="year">
 
<option>	1930	</option>
 
<option>	1931	</option>
 
<option>	1932	</option>
 
<option>	1933	</option>
 
<option>	1934	</option>
 
<option>	1935	</option>
 
<option>	1936	</option>
 
<option>	1937	</option>
 
<option>	1938	</option>
 
<option>	1939	</option>
 
<option>	1940	</option>
 
<option>	1941	</option>
 
<option>	1942	</option>
 
<option>	1943	</option>
 
<option>	1944	</option>
 
<option>	1945	</option>
 
<option>	1946	</option>
 
<option>	1947	</option>
 
<option>	1948	</option>
 
<option>	1949	</option>
 
<option>	1950	</option>
 
<option>	1951	</option>
 
<option>	1952	</option>
 
<option>	1953	</option>
 
<option>	1954	</option>
 
<option>	1955	</option>
 
<option>	1956	</option>
 
<option>	1957	</option>
 
<option>	1958	</option>
 
<option>	1959	</option>
 
<option>	1960	</option>
 
<option>	1961	</option>
 
<option>	1962	</option>
 
<option>	1963	</option>
 
<option>	1964	</option>
 
<option>	1965	</option>
 
<option>	1966	</option>
 
<option>	1967	</option>
 
<option>	1968	</option>
 
<option>	1969	</option>
 
<option>	1970	</option>
 
<option>	1971	</option>
 
<option>	1972	</option>
 
<option>	1973	</option>
 
<option>	1974	</option>
 
<option>	1975	</option>
 
<option>	1976	</option>
 
<option>	1977	</option>
 
<option>	1978	</option>
 
<option>	1979	</option>
 
<option>	1980	</option>
 
<option>	1981	</option>
 
<option>	1982	</option>
 
<option>	1983	</option>
 
<option>	1984	</option>
 
<option>	1985	</option>
 
<option>	1986	</option>
 
<option>	1987	</option>
 
<option>	1988	</option>
 
<option>	1989	</option>
 
<option>	1990	</option>
 
<option>	1991	</option>
 
<option>	1992	</option>
 
<option>	1993	</option>
 
<option>	1994	</option>
 
<option>	1995	</option>
 
<option>	1996	</option>
 
<option>	1997	</option>
 
<option>	1998	</option>
 
<option>	1999	</option>
 
<option>	2000	</option>
 
<option>	2001	</option>
 
<option>	2002	</option>
 
<option>	2003	</option>
 
<option>	2004	</option>
 
<option>	2005	</option>
 
<option>	2006	</option>
 
<option>	2007	</option>
 
<option>	2008	</option>
 
<option>	2009	</option>
 
<option>	2010	</option>
 
<option>	2011	</option>
 
<option>	2012	</option>
 
<option>	2013	</option>
 
<option>	2014	</option>
 
<option>	2015	</option>
 
<option>	2016	</option>
 
<option>	2017	</option>
 
<option>	2018	</option>
 
<option>	2019	</option>
 
<option>	2020	</option>
 
<option>	2021	</option>
 
<option>	2022	</option>
 
<option>	2023	</option>
 
<option>	2024	</option>
 
<option>	2025	</option>
 
<option>	2026	</option>
 
<option>	2027	</option>
 
<option>	2028	</option>
 
<option>	2029	</option>
 
<option>	2030	</option>
 
 
 
</select>
 
                             </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>@>4</td>
 
                                                  <td><input class="input_1" type="text" name="city" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>GB>2K9 8=45:A</td>
 
                                                  <td><input class="input_1" type="text" name="zip" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">!B@0=0 ?@>6820=8O<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="country">
 
  <option></option>
 
  <option> >AA8O</option>
 
  <option>@<5=8O</option>
 
  <option>75@10;L460=</option>
 
  <option>5;0@CAL</option>
 
  <option>@C78O</option>
 
  <option>-AB>=8O</option>
 
  <option>070EAB0=</option>
 
  <option>0B28O</option>
 
  <option>8B20</option>
 
  <option>>;4028O</option>
 
  <option>#:@08=0</option>
 
  <option>#715:8AB0=</option>    
 
<option></option>
 
<option>	2AB@8O	</option>
<option>	;10=8O	</option>
<option>	=4>@@0	</option>
<option>	5;L38O	</option>
<option>	>;30@8O	</option>
<option>	>A=8O 8 5@F53>28=0	</option>
<option>	0B8:0=	</option>
<option>	5;8:>1@8B0=8O	</option>
<option>	5=3@8O	</option>
<option>	5@<0=8O	</option>
<option>	@5F8O	</option>
<option>	0=8O	</option>
<option>	@;0=48O	</option>
<option>	A;0=48O	</option>
<option>	A?0=8O	</option>
<option>	B0;8O	</option>
<option>	8?@	</option>
<option>	8EB5=HB59=	</option>
<option>	N:A5<1C@3	</option>
<option>	0:54>=8O	</option>
<option>	0;LB0	</option>
<option>	>=0:>	</option>
<option>	845@;0=4K	</option>
<option>	>@2538O	</option>
<option>	>;LH0	</option>
<option>	>@BC30;8O	</option>
<option>	 C<K=8O	</option>
<option>	!0=-0@8=>	</option>
<option>	!5@18O	</option>
<option>	!;>20:8O	</option>
<option>	!;>25=8O	</option>
<option>	"C@F8O	</option>
<option>	$8=;O=48O	</option>
<option>	$@0=F8O	</option>
<option>	%>@20B8O	</option>
<option>	'5@=>3>@8O	</option>
<option>	'5E8O	</option>
<option>	(259F0@8O	</option>
<option>	(25F8O	</option>
  
 
</select>
 
                                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200">><0H=89 B5;5D>=<span class="must">*</span></td>
 
                                   <td><input class="input_1"type="text" name="homephone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200"> 01>G89 B5;5D>=</td>
 
                                   <td><input class="input_1"type="text" name="workphone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200">>18;L=K9 B5;5D>=</td>
 
                                   <td><input class="input_1"type="text" name="mobilephone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
								  <tr>
 
                                   <td width="200">E-mail<span class="must">*</span></td>
 
                                   <td><input class="input_1"type="text" name="email" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">0H5 A>>1I5=85</td>
 
                                                  <td>
 
                                                                  <textarea rows="6" class="input_1" name="msg" cols="63"></textarea></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200"> G5< 2K 708=B5@5A>20=K?<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="interest">
 
				<option></option>
 
				<option>>?>;=8B5;L=>5 <=5=85</option>
 
                <option>5G5=85</option>
 
                                                                  </select>
 
                                                                  </td>
 
                                                                  </tr>
 
                                                                  <tr>
 
                                                  <td width="200">0:>2 20H 4803=>7?<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <textarea rows="6" class="input_1" name="diagnosis" cols="63"></textarea></td>
 
                                  </tr>
 
                                  
 
                                  <tr>
 
                                                  <td width="313" valign="top" style="padding-top:6px">@8:@5?8BL D09;:</td>
 
                                                  <td>
 
                <input type="hidden" name="MAX_FILE_SIZE" value="10485761" />
 
                <input type="file"  name="fileName" size="20" class="input_1">
 
                  <p><input type="submit" value="B>A;0BL" name="SendButton" class="btn_send"></p>
 
                                  </tr>
								   <tr>
            <td>
                  
                       
                                    <h1><img id="imgCaptcha" src="create_image.php" name="imgCaptcha"/> </h1>
                              </td>
                              <td>
      <input id="txtCaptcha" type="text" name="txtCaptcha" value="" maxlength="10" size="32" />
    </td>
                        
                              
      </tr>
 
                  </table>
				  
 
  </form>
 
HTML;
 
  
 
  echo "</body></html>" ;
 
 }
 
  
 
  if ($_POST)  
 
  {  
 
  if ( (!$_POST['firstName']) or 
 
                                (!$_POST['lastName']) or 
 
                                (!$_POST['country']) or 
 
                                (!$_POST['gender']) or 
 
                                (!$_POST['interest']) or 
 
                                (!$_POST['diagnosis']) or 
 
                                (!$_POST['email']) or 
								
								
                                (!$_POST['homephone']) )
 
  { 
 
                  echo "5>1E>48<> 70?>;=8BL 2A5 ?>;O!!!" ;
 
 
//session_start();
if($_POST["txtCaptcha"] == $_SESSION["security_code"])
{
echo "Success";
}
else
{
 
echo "Not success";
}
//echo $_SESSION["security_code"];
 
 
 
                  printForm() ;
 
  }
 
  else 
 
  {
 
                  sendMail($_POST) ; 
 
                  moveUploadedFile($_FILES,$_DirectoryToUploadInto) ; 
 
 
 
  }
 
  }
 
  else 
 
  {
 
                  printForm() ;
 
  }
 
  
 
  ?>
 
  
 
 
										  </td>
										</tr>
										
									</table>
								</td>
								<td width="170" style="padding-right:10px; padding-left:10px" class="menu_right_border" valign="top">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tr>
											<td class="menu_right">&nbsp;
												 
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
					
				<tr>
					<td height="25"></td>
				</tr>
				<tr>
					<td>
						<?php //require('includes/footer.htm'); ?>
					</td>
				</tr>
				<tr>
					<td height="15"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
 
<script type="text/javascript">
 
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
 
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
 
</script>
 
<script type="text/javascript">
 
try {
 
var pageTracker = _gat._getTracker("UA-7814761-1");
 
pageTracker._trackPageview();
 
} catch(err) {}</script>
 
</body>
 
</html>

Open in new window

0
 

Author Comment

by:DanSmir
ID: 24212719
Shobinsun!!!
Thank you, but it still not working.
If i am pressing submit button without typing captcha or with wrong code it still sending mail
0
 
LVL 14

Expert Comment

by:shobinsun
ID: 24212821
Hi,

I think you get the result "Success" with captcha entered and "Not Success" with captcha not entered.

So

Here is the code that actually you need:


Regards
<!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>
 <?php //require('includes/meta_tegs.htm'); ?> 
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<table cellpadding="0" cellspacing="0" width="950" align="center" class="tbl_main">
	<tr>
		<td>
			<?php //require('includes/menu_top.htm'); ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php //require('includes/menu.htm'); ?>
		</td>
	</tr>
	<tr>
		<td height="1"></td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" width="100%" class="top">
				<tr>
					<td class="top_txt" width="500" style="padding-left:20px; padding-bottom:20px" valign="bottom">
						<h1>>A;0BL 70?@>A </h1>
					</td>
					<td width="450"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" width="100%" class="main" style="padding-top:25px">
				<tr>
					<td>
						<table cellpadding="0" cellspacing="0" width="100%">
							<tr>
								<td width="160" style="padding-left:10px" class="menu_left_border" valign="top">
									<?php //require('includes/chat.htm'); ?>  
								</td>
								<td width="570" style="padding-right:10px; padding-left:15px" valign="top">
									<table cellpadding="0" cellspacing="0" width="100%" class="downloads">
										<tr>
										  <td style="padding-top:2px">
												<?php
												
												
 
 
  $_DirectoryToUploadInto = "./" ;
 
  $addressToSentTo = "dan@vario.co.il" ; 
 
  $addressToSentFrom = "submit-user@med-international.ru" ; 
 
  
 
  
 
function moveUploadedFile($_FILES,$_DirectoryToUploadInto)
 
  {
 
                global $_FILES ;
 
   $uploadfile = $_DirectoryToUploadInto . basename($_FILES['fileName']['name']);
 
  
 
  
 
                  if (move_uploaded_file($_FILES['fileName']['tmp_name'], $uploadfile)) 
 
                                  {
 
                                      echo "\n *\n";
 
                                  } 
 
                  else 
 
                                  {
 
                                      echo "\n0H5 ?8AL<> >B>A;0=> 157 ?@8:@5?;5==>3> D09;0. !?0A81>.!\n";
 
 
 
                                  }
 
        putFileOnFTP(basename($_FILES['fileName']['name']));
 
        
 
  }
 
  
 
function putFileOnFTP($fileName)
 
{
 
$ftp_server = "69.174.48.166" ; 
 
$ftp_user_name = "submit@med-international.ru" ; 
 
$ftp_user_pass = "123" ; 
 
 
 
$file = $fileName; 
 
$remote_file = $fileName; 
 
 
 
 
 
$conn_id = ftp_connect($ftp_server);
 
 
 
 
 
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
 
 
 
 
 
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
 
 echo "$file 03@C65= =0 A5@25@, !?081>\n";
 
 
 
} else {
 
 echo "$file\n";
 
}
 
 
 
ftp_close($conn_id);
 
}  
 
 
 
 function sendMail($postedData) 
 
  {
 
                  global $addressToSentTo, $addressToSentFrom, $_FILES;
 
                  
 
  $to      = $addressToSentTo ;
 
  $subject = "Submit form"; 
 
  
 
  if (!$_FILES['fileName']['name']) 
 
  {
 
                $sendedFile = "D09; =5 1K; 2KA;0=." ;
 
  }
 
  else
 
  {
 
                $sendedFile = "KA;0==K9 D09;: ".$_FILES['fileName']['name'] ;
 
  } 
 
  
 
  $message = "
 
{$postedData['firstName']} 
 
{$postedData['lastName']} 
 
{$postedData['gender']}
 
{$postedData['day']}/{$postedData['month']}/{$postedData['year']}
 
{$postedData['city']} 
 
{$postedData['zip']}
 
{$postedData['country']}
 
{$postedData['fileName']} 
 
{$postedData['homephone']}
 
{$postedData['workphone']}
 
{$postedData['interest']}
 
{$postedData['email']}
 
{$postedData['mobilephone']}
 
{$postedData['diagnosis']}
 
{$postedData['fileName']}
 
{$sendedFile} 
 
{$postedData['msg']} ";
 
  
 
  $headers = 'From: '.$addressToSentFrom."\n" .
 
                     'Reply-To:'.$addressToSentFrom ;
 
  
 
  mail($to, $subject, $message, $headers);
 
  }
 
  
 
  function printForm()
 
  {
 
	  echo <<<HTML
 
  <html>
 
  
 
  <head>
 
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 
  <link rel="stylesheet" type="text/css" href="mailer_style.css">
 
 
 
  <title>Post Form</title>
 
  <style>
 
.text:focus, textarea:focus {
 
  background-color: #FFFACC;
 
    }
 
  .message
 
{
 
    font-weight:bold;
 
    color:Red;
 
    font-size:large;
 
}
 
  
 
</style>
 
  </head>
 
  
 
  <body>
 
HTML;
 
echo <<<HTML
 
  <form enctype="multipart/form-data" action="captcha.php" method="POST">
 
  
 
                  <table border="0" width="500" class="table">
 
                                  <tr>
 
 
 
                                                                                                                                                                                                  <td width="200"><O<span class="must">*</span></td>
 
                                                                                                                                                                                                  
 
                                                  <td><input class="input_1" type="text" name="firstName" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">$0<8;8O<span class="must">*</span></td>
 
                                                  <td><input class="input_1" type="text" name="lastName" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>;<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="gender">
 
				<option></option>
 
				<option>C6G8=0</option>
 
                <option>5=I8=0</option>
 
                                                                  </select>
 
                                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">0B0 @>645=8O (5=L/5AOF/>4)</td>
 
                                                  <td>
 
                                                  <select size="1" class="input_1" name="day">
 
<option>1</option>
 
<option>2</option>
 
<option>3</option>
 
<option>4</option>
 
<option>5</option>
 
<option>6</option>
 
<option>7</option>
 
<option>8</option>
 
<option>9</option>
 
<option>10</option>
 
<option>11</option>
 
<option>12</option>
 
<option>13</option>
 
<option>14</option>
 
<option>15</option>
 
<option>16</option>
 
<option>17</option>
 
<option>18</option>
 
<option>19</option>
 
<option>20</option>
 
<option>21</option>
 
<option>22</option>
 
<option>23</option>
 
<option>24</option>
 
<option>25</option>
 
<option>26</option>
 
<option>27</option>
 
<option>28</option>
 
<option>29</option>
 
<option>30</option>
 
<option>31</option>
 
</select>
 
<select size="1" class="input_1"name="month">
 
<option>/=20@L</option>
 
<option>$52@0;L</option>
 
<option>0@B</option>
 
<option>?@5;L</option>
 
<option>09</option>
 
<option>N=L</option>
 
<option>N;L</option>
 
<option>23CAB</option>
 
<option>!5=BO1@L</option>
 
<option>:BO1@L</option>
 
<option>>O1@L</option>
 
<option>5:01@L</option>
 
</select>
 
<select size="1" class="input_1"name="year">
 
<option>	1930	</option>
 
<option>	1931	</option>
 
<option>	1932	</option>
 
<option>	1933	</option>
 
<option>	1934	</option>
 
<option>	1935	</option>
 
<option>	1936	</option>
 
<option>	1937	</option>
 
<option>	1938	</option>
 
<option>	1939	</option>
 
<option>	1940	</option>
 
<option>	1941	</option>
 
<option>	1942	</option>
 
<option>	1943	</option>
 
<option>	1944	</option>
 
<option>	1945	</option>
 
<option>	1946	</option>
 
<option>	1947	</option>
 
<option>	1948	</option>
 
<option>	1949	</option>
 
<option>	1950	</option>
 
<option>	1951	</option>
 
<option>	1952	</option>
 
<option>	1953	</option>
 
<option>	1954	</option>
 
<option>	1955	</option>
 
<option>	1956	</option>
 
<option>	1957	</option>
 
<option>	1958	</option>
 
<option>	1959	</option>
 
<option>	1960	</option>
 
<option>	1961	</option>
 
<option>	1962	</option>
 
<option>	1963	</option>
 
<option>	1964	</option>
 
<option>	1965	</option>
 
<option>	1966	</option>
 
<option>	1967	</option>
 
<option>	1968	</option>
 
<option>	1969	</option>
 
<option>	1970	</option>
 
<option>	1971	</option>
 
<option>	1972	</option>
 
<option>	1973	</option>
 
<option>	1974	</option>
 
<option>	1975	</option>
 
<option>	1976	</option>
 
<option>	1977	</option>
 
<option>	1978	</option>
 
<option>	1979	</option>
 
<option>	1980	</option>
 
<option>	1981	</option>
 
<option>	1982	</option>
 
<option>	1983	</option>
 
<option>	1984	</option>
 
<option>	1985	</option>
 
<option>	1986	</option>
 
<option>	1987	</option>
 
<option>	1988	</option>
 
<option>	1989	</option>
 
<option>	1990	</option>
 
<option>	1991	</option>
 
<option>	1992	</option>
 
<option>	1993	</option>
 
<option>	1994	</option>
 
<option>	1995	</option>
 
<option>	1996	</option>
 
<option>	1997	</option>
 
<option>	1998	</option>
 
<option>	1999	</option>
 
<option>	2000	</option>
 
<option>	2001	</option>
 
<option>	2002	</option>
 
<option>	2003	</option>
 
<option>	2004	</option>
 
<option>	2005	</option>
 
<option>	2006	</option>
 
<option>	2007	</option>
 
<option>	2008	</option>
 
<option>	2009	</option>
 
<option>	2010	</option>
 
<option>	2011	</option>
 
<option>	2012	</option>
 
<option>	2013	</option>
 
<option>	2014	</option>
 
<option>	2015	</option>
 
<option>	2016	</option>
 
<option>	2017	</option>
 
<option>	2018	</option>
 
<option>	2019	</option>
 
<option>	2020	</option>
 
<option>	2021	</option>
 
<option>	2022	</option>
 
<option>	2023	</option>
 
<option>	2024	</option>
 
<option>	2025	</option>
 
<option>	2026	</option>
 
<option>	2027	</option>
 
<option>	2028	</option>
 
<option>	2029	</option>
 
<option>	2030	</option>
 
 
 
</select>
 
                             </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>@>4</td>
 
                                                  <td><input class="input_1" type="text" name="city" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>GB>2K9 8=45:A</td>
 
                                                  <td><input class="input_1" type="text" name="zip" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">!B@0=0 ?@>6820=8O<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="country">
 
  <option></option>
 
  <option> >AA8O</option>
 
  <option>@<5=8O</option>
 
  <option>75@10;L460=</option>
 
  <option>5;0@CAL</option>
 
  <option>@C78O</option>
 
  <option>-AB>=8O</option>
 
  <option>070EAB0=</option>
 
  <option>0B28O</option>
 
  <option>8B20</option>
 
  <option>>;4028O</option>
 
  <option>#:@08=0</option>
 
  <option>#715:8AB0=</option>    
 
<option></option>
 
<option>	2AB@8O	</option>
<option>	;10=8O	</option>
<option>	=4>@@0	</option>
<option>	5;L38O	</option>
<option>	>;30@8O	</option>
<option>	>A=8O 8 5@F53>28=0	</option>
<option>	0B8:0=	</option>
<option>	5;8:>1@8B0=8O	</option>
<option>	5=3@8O	</option>
<option>	5@<0=8O	</option>
<option>	@5F8O	</option>
<option>	0=8O	</option>
<option>	@;0=48O	</option>
<option>	A;0=48O	</option>
<option>	A?0=8O	</option>
<option>	B0;8O	</option>
<option>	8?@	</option>
<option>	8EB5=HB59=	</option>
<option>	N:A5<1C@3	</option>
<option>	0:54>=8O	</option>
<option>	0;LB0	</option>
<option>	>=0:>	</option>
<option>	845@;0=4K	</option>
<option>	>@2538O	</option>
<option>	>;LH0	</option>
<option>	>@BC30;8O	</option>
<option>	 C<K=8O	</option>
<option>	!0=-0@8=>	</option>
<option>	!5@18O	</option>
<option>	!;>20:8O	</option>
<option>	!;>25=8O	</option>
<option>	"C@F8O	</option>
<option>	$8=;O=48O	</option>
<option>	$@0=F8O	</option>
<option>	%>@20B8O	</option>
<option>	'5@=>3>@8O	</option>
<option>	'5E8O	</option>
<option>	(259F0@8O	</option>
<option>	(25F8O	</option>
  
 
</select>
 
                                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200">><0H=89 B5;5D>=<span class="must">*</span></td>
 
                                   <td><input class="input_1"type="text" name="homephone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200"> 01>G89 B5;5D>=</td>
 
                                   <td><input class="input_1"type="text" name="workphone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200">>18;L=K9 B5;5D>=</td>
 
                                   <td><input class="input_1"type="text" name="mobilephone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
								  <tr>
 
                                   <td width="200">E-mail<span class="must">*</span></td>
 
                                   <td><input class="input_1"type="text" name="email" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">0H5 A>>1I5=85</td>
 
                                                  <td>
 
                                                                  <textarea rows="6" class="input_1" name="msg" cols="63"></textarea></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200"> G5< 2K 708=B5@5A>20=K?<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="interest">
 
				<option></option>
 
				<option>>?>;=8B5;L=>5 <=5=85</option>
 
                <option>5G5=85</option>
 
                                                                  </select>
 
                                                                  </td>
 
                                                                  </tr>
 
                                                                  <tr>
 
                                                  <td width="200">0:>2 20H 4803=>7?<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <textarea rows="6" class="input_1" name="diagnosis" cols="63"></textarea></td>
 
                                  </tr>
 
                                  
 
                                  <tr>
 
                                                  <td width="313" valign="top" style="padding-top:6px">@8:@5?8BL D09;:</td>
 
                                                  <td>
 
                <input type="hidden" name="MAX_FILE_SIZE" value="10485761" />
 
                <input type="file"  name="fileName" size="20" class="input_1">
 
                  <p><input type="submit" value="B>A;0BL" name="SendButton" class="btn_send"></p>
 
                                  </tr>
								   <tr>
            <td>
                  
                       
                                    <h1><img id="imgCaptcha" src="create_image.php" name="imgCaptcha"/> </h1>
                              </td>
                              <td>
      <input id="txtCaptcha" type="text" name="txtCaptcha" value="" maxlength="10" size="32" />
    </td>
                        
                              
      </tr>
 
                  </table>
				  
 
  </form>
 
HTML;
 
  
 
  echo "</body></html>" ;
 
 }
 
  
 
  if ($_POST)  
 
  {  
 
  if ( (!$_POST['firstName']) or 
 
                                (!$_POST['lastName']) or 
 
                                (!$_POST['country']) or 
 
                                (!$_POST['gender']) or 
 
                                (!$_POST['interest']) or 
 
                                (!$_POST['diagnosis']) or 
 
                                (!$_POST['email']) or 
								
								
                                (!$_POST['homephone']) )
 
  { 
 
                  echo "5>1E>48<> 70?>;=8BL 2A5 ?>;O!!!" ;
 
 
//session_start();
if($_POST["txtCaptcha"] == $_SESSION["security_code"])
{
                  sendMail($_POST) ; 
 
                  moveUploadedFile($_FILES,$_DirectoryToUploadInto) ; 
echo "Success";
}
else
{
 
//echo "Not success";
printForm() ;
}
//echo $_SESSION["security_code"];
 
       
 
  ?>
 
  
 
 
										  </td>
										</tr>
										
									</table>
								</td>
								<td width="170" style="padding-right:10px; padding-left:10px" class="menu_right_border" valign="top">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tr>
											<td class="menu_right">&nbsp;
												 
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
					
				<tr>
					<td height="25"></td>
				</tr>
				<tr>
					<td>
						<?php //require('includes/footer.htm'); ?>
					</td>
				</tr>
				<tr>
					<td height="15"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
 
<script type="text/javascript">
 
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
 
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
 
</script>
 
<script type="text/javascript">
 
try {
 
var pageTracker = _gat._getTracker("UA-7814761-1");
 
pageTracker._trackPageview();
 
} catch(err) {}</script>
 
</body>
 
</html>

Open in new window

0
 

Author Comment

by:DanSmir
ID: 24212910
Shobinsun:

i receive
Parse error: syntax error, unexpected $end in /home/imsg/public_html/captcha.php on line 985
0
 
LVL 14

Expert Comment

by:shobinsun
ID: 24212965
Hi,

Could you please send me the line?
0
 

Author Comment

by:DanSmir
ID: 24212978
Shobinsun:

I'm attaching PHP file (Change extension to PHP)and url..

Thank you
http://www.med-international.ru/captcha.php
captcha.txt
0
 
LVL 14

Expert Comment

by:shobinsun
ID: 24213009
Hi,

I understand:

Use this code:

Regards
<!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>
 <?php //require('includes/meta_tegs.htm'); ?> 
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<table cellpadding="0" cellspacing="0" width="950" align="center" class="tbl_main">
	<tr>
		<td>
			<?php //require('includes/menu_top.htm'); ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php //require('includes/menu.htm'); ?>
		</td>
	</tr>
	<tr>
		<td height="1"></td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" width="100%" class="top">
				<tr>
					<td class="top_txt" width="500" style="padding-left:20px; padding-bottom:20px" valign="bottom">
						<h1>>A;0BL 70?@>A </h1>
					</td>
					<td width="450"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" width="100%" class="main" style="padding-top:25px">
				<tr>
					<td>
						<table cellpadding="0" cellspacing="0" width="100%">
							<tr>
								<td width="160" style="padding-left:10px" class="menu_left_border" valign="top">
									<?php //require('includes/chat.htm'); ?>  
								</td>
								<td width="570" style="padding-right:10px; padding-left:15px" valign="top">
									<table cellpadding="0" cellspacing="0" width="100%" class="downloads">
										<tr>
										  <td style="padding-top:2px">
												<?php
												
												
 
 
  $_DirectoryToUploadInto = "./" ;
 
  $addressToSentTo = "dan@vario.co.il" ; 
 
  $addressToSentFrom = "submit-user@med-international.ru" ; 
 
  
 
  
 
function moveUploadedFile($_FILES,$_DirectoryToUploadInto)
 
  {
 
                global $_FILES ;
 
   $uploadfile = $_DirectoryToUploadInto . basename($_FILES['fileName']['name']);
 
  
 
  
 
                  if (move_uploaded_file($_FILES['fileName']['tmp_name'], $uploadfile)) 
 
                                  {
 
                                      echo "\n *\n";
 
                                  } 
 
                  else 
 
                                  {
 
                                      echo "\n0H5 ?8AL<> >B>A;0=> 157 ?@8:@5?;5==>3> D09;0. !?0A81>.!\n";
 
 
 
                                  }
 
        putFileOnFTP(basename($_FILES['fileName']['name']));
 
        
 
  }
 
  
 
function putFileOnFTP($fileName)
 
{
 
$ftp_server = "69.174.48.166" ; 
 
$ftp_user_name = "submit@med-international.ru" ; 
 
$ftp_user_pass = "123" ; 
 
 
 
$file = $fileName; 
 
$remote_file = $fileName; 
 
 
 
 
 
$conn_id = ftp_connect($ftp_server);
 
 
 
 
 
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
 
 
 
 
 
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
 
 echo "$file 03@C65= =0 A5@25@, !?081>\n";
 
 
 
} else {
 
 echo "$file\n";
 
}
 
 
 
ftp_close($conn_id);
 
}  
 
 
 
 function sendMail($postedData) 
 
  {
 
                  global $addressToSentTo, $addressToSentFrom, $_FILES;
 
                  
 
  $to      = $addressToSentTo ;
 
  $subject = "Submit form"; 
 
  
 
  if (!$_FILES['fileName']['name']) 
 
  {
 
                $sendedFile = "D09; =5 1K; 2KA;0=." ;
 
  }
 
  else
 
  {
 
                $sendedFile = "KA;0==K9 D09;: ".$_FILES['fileName']['name'] ;
 
  } 
 
  
 
  $message = "
 
{$postedData['firstName']} 
 
{$postedData['lastName']} 
 
{$postedData['gender']}
 
{$postedData['day']}/{$postedData['month']}/{$postedData['year']}
 
{$postedData['city']} 
 
{$postedData['zip']}
 
{$postedData['country']}
 
{$postedData['fileName']} 
 
{$postedData['homephone']}
 
{$postedData['workphone']}
 
{$postedData['interest']}
 
{$postedData['email']}
 
{$postedData['mobilephone']}
 
{$postedData['diagnosis']}
 
{$postedData['fileName']}
 
{$sendedFile} 
 
{$postedData['msg']} ";
 
  
 
  $headers = 'From: '.$addressToSentFrom."\n" .
 
                     'Reply-To:'.$addressToSentFrom ;
 
  
 
  mail($to, $subject, $message, $headers);
 
  }
 
  
 
  function printForm()
 
  {
 
	  echo <<<HTML
 
  <html>
 
  
 
  <head>
 
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 
  <link rel="stylesheet" type="text/css" href="mailer_style.css">
 
 
 
  <title>Post Form</title>
 
  <style>
 
.text:focus, textarea:focus {
 
  background-color: #FFFACC;
 
    }
 
  .message
 
{
 
    font-weight:bold;
 
    color:Red;
 
    font-size:large;
 
}
 
  
 
</style>
 
  </head>
 
  
 
  <body>
 
HTML;
 
echo <<<HTML
 
  <form enctype="multipart/form-data" action="captcha.php" method="POST">
 
  
 
                  <table border="0" width="500" class="table">
 
                                  <tr>
 
 
 
                                                                                                                                                                                                  <td width="200"><O<span class="must">*</span></td>
 
                                                                                                                                                                                                  
 
                                                  <td><input class="input_1" type="text" name="firstName" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">$0<8;8O<span class="must">*</span></td>
 
                                                  <td><input class="input_1" type="text" name="lastName" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>;<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="gender">
 
				<option></option>
 
				<option>C6G8=0</option>
 
                <option>5=I8=0</option>
 
                                                                  </select>
 
                                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">0B0 @>645=8O (5=L/5AOF/>4)</td>
 
                                                  <td>
 
                                                  <select size="1" class="input_1" name="day">
 
<option>1</option>
 
<option>2</option>
 
<option>3</option>
 
<option>4</option>
 
<option>5</option>
 
<option>6</option>
 
<option>7</option>
 
<option>8</option>
 
<option>9</option>
 
<option>10</option>
 
<option>11</option>
 
<option>12</option>
 
<option>13</option>
 
<option>14</option>
 
<option>15</option>
 
<option>16</option>
 
<option>17</option>
 
<option>18</option>
 
<option>19</option>
 
<option>20</option>
 
<option>21</option>
 
<option>22</option>
 
<option>23</option>
 
<option>24</option>
 
<option>25</option>
 
<option>26</option>
 
<option>27</option>
 
<option>28</option>
 
<option>29</option>
 
<option>30</option>
 
<option>31</option>
 
</select>
 
<select size="1" class="input_1"name="month">
 
<option>/=20@L</option>
 
<option>$52@0;L</option>
 
<option>0@B</option>
 
<option>?@5;L</option>
 
<option>09</option>
 
<option>N=L</option>
 
<option>N;L</option>
 
<option>23CAB</option>
 
<option>!5=BO1@L</option>
 
<option>:BO1@L</option>
 
<option>>O1@L</option>
 
<option>5:01@L</option>
 
</select>
 
<select size="1" class="input_1"name="year">
 
<option>	1930	</option>
 
<option>	1931	</option>
 
<option>	1932	</option>
 
<option>	1933	</option>
 
<option>	1934	</option>
 
<option>	1935	</option>
 
<option>	1936	</option>
 
<option>	1937	</option>
 
<option>	1938	</option>
 
<option>	1939	</option>
 
<option>	1940	</option>
 
<option>	1941	</option>
 
<option>	1942	</option>
 
<option>	1943	</option>
 
<option>	1944	</option>
 
<option>	1945	</option>
 
<option>	1946	</option>
 
<option>	1947	</option>
 
<option>	1948	</option>
 
<option>	1949	</option>
 
<option>	1950	</option>
 
<option>	1951	</option>
 
<option>	1952	</option>
 
<option>	1953	</option>
 
<option>	1954	</option>
 
<option>	1955	</option>
 
<option>	1956	</option>
 
<option>	1957	</option>
 
<option>	1958	</option>
 
<option>	1959	</option>
 
<option>	1960	</option>
 
<option>	1961	</option>
 
<option>	1962	</option>
 
<option>	1963	</option>
 
<option>	1964	</option>
 
<option>	1965	</option>
 
<option>	1966	</option>
 
<option>	1967	</option>
 
<option>	1968	</option>
 
<option>	1969	</option>
 
<option>	1970	</option>
 
<option>	1971	</option>
 
<option>	1972	</option>
 
<option>	1973	</option>
 
<option>	1974	</option>
 
<option>	1975	</option>
 
<option>	1976	</option>
 
<option>	1977	</option>
 
<option>	1978	</option>
 
<option>	1979	</option>
 
<option>	1980	</option>
 
<option>	1981	</option>
 
<option>	1982	</option>
 
<option>	1983	</option>
 
<option>	1984	</option>
 
<option>	1985	</option>
 
<option>	1986	</option>
 
<option>	1987	</option>
 
<option>	1988	</option>
 
<option>	1989	</option>
 
<option>	1990	</option>
 
<option>	1991	</option>
 
<option>	1992	</option>
 
<option>	1993	</option>
 
<option>	1994	</option>
 
<option>	1995	</option>
 
<option>	1996	</option>
 
<option>	1997	</option>
 
<option>	1998	</option>
 
<option>	1999	</option>
 
<option>	2000	</option>
 
<option>	2001	</option>
 
<option>	2002	</option>
 
<option>	2003	</option>
 
<option>	2004	</option>
 
<option>	2005	</option>
 
<option>	2006	</option>
 
<option>	2007	</option>
 
<option>	2008	</option>
 
<option>	2009	</option>
 
<option>	2010	</option>
 
<option>	2011	</option>
 
<option>	2012	</option>
 
<option>	2013	</option>
 
<option>	2014	</option>
 
<option>	2015	</option>
 
<option>	2016	</option>
 
<option>	2017	</option>
 
<option>	2018	</option>
 
<option>	2019	</option>
 
<option>	2020	</option>
 
<option>	2021	</option>
 
<option>	2022	</option>
 
<option>	2023	</option>
 
<option>	2024	</option>
 
<option>	2025	</option>
 
<option>	2026	</option>
 
<option>	2027	</option>
 
<option>	2028	</option>
 
<option>	2029	</option>
 
<option>	2030	</option>
 
 
 
</select>
 
                             </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>@>4</td>
 
                                                  <td><input class="input_1" type="text" name="city" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>GB>2K9 8=45:A</td>
 
                                                  <td><input class="input_1" type="text" name="zip" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">!B@0=0 ?@>6820=8O<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="country">
 
  <option></option>
 
  <option> >AA8O</option>
 
  <option>@<5=8O</option>
 
  <option>75@10;L460=</option>
 
  <option>5;0@CAL</option>
 
  <option>@C78O</option>
 
  <option>-AB>=8O</option>
 
  <option>070EAB0=</option>
 
  <option>0B28O</option>
 
  <option>8B20</option>
 
  <option>>;4028O</option>
 
  <option>#:@08=0</option>
 
  <option>#715:8AB0=</option>    
 
<option></option>
 
<option>	2AB@8O	</option>
<option>	;10=8O	</option>
<option>	=4>@@0	</option>
<option>	5;L38O	</option>
<option>	>;30@8O	</option>
<option>	>A=8O 8 5@F53>28=0	</option>
<option>	0B8:0=	</option>
<option>	5;8:>1@8B0=8O	</option>
<option>	5=3@8O	</option>
<option>	5@<0=8O	</option>
<option>	@5F8O	</option>
<option>	0=8O	</option>
<option>	@;0=48O	</option>
<option>	A;0=48O	</option>
<option>	A?0=8O	</option>
<option>	B0;8O	</option>
<option>	8?@	</option>
<option>	8EB5=HB59=	</option>
<option>	N:A5<1C@3	</option>
<option>	0:54>=8O	</option>
<option>	0;LB0	</option>
<option>	>=0:>	</option>
<option>	845@;0=4K	</option>
<option>	>@2538O	</option>
<option>	>;LH0	</option>
<option>	>@BC30;8O	</option>
<option>	 C<K=8O	</option>
<option>	!0=-0@8=>	</option>
<option>	!5@18O	</option>
<option>	!;>20:8O	</option>
<option>	!;>25=8O	</option>
<option>	"C@F8O	</option>
<option>	$8=;O=48O	</option>
<option>	$@0=F8O	</option>
<option>	%>@20B8O	</option>
<option>	'5@=>3>@8O	</option>
<option>	'5E8O	</option>
<option>	(259F0@8O	</option>
<option>	(25F8O	</option>
  
 
</select>
 
                                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200">><0H=89 B5;5D>=<span class="must">*</span></td>
 
                                   <td><input class="input_1"type="text" name="homephone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200"> 01>G89 B5;5D>=</td>
 
                                   <td><input class="input_1"type="text" name="workphone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200">>18;L=K9 B5;5D>=</td>
 
                                   <td><input class="input_1"type="text" name="mobilephone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
								  <tr>
 
                                   <td width="200">E-mail<span class="must">*</span></td>
 
                                   <td><input class="input_1"type="text" name="email" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">0H5 A>>1I5=85</td>
 
                                                  <td>
 
                                                                  <textarea rows="6" class="input_1" name="msg" cols="63"></textarea></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200"> G5< 2K 708=B5@5A>20=K?<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="interest">
 
				<option></option>
 
				<option>>?>;=8B5;L=>5 <=5=85</option>
 
                <option>5G5=85</option>
 
                                                                  </select>
 
                                                                  </td>
 
                                                                  </tr>
 
                                                                  <tr>
 
                                                  <td width="200">0:>2 20H 4803=>7?<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <textarea rows="6" class="input_1" name="diagnosis" cols="63"></textarea></td>
 
                                  </tr>
 
                                  
 
                                  <tr>
 
                                                  <td width="313" valign="top" style="padding-top:6px">@8:@5?8BL D09;:</td>
 
                                                  <td>
 
                <input type="hidden" name="MAX_FILE_SIZE" value="10485761" />
 
                <input type="file"  name="fileName" size="20" class="input_1">
 
                  <p><input type="submit" value="B>A;0BL" name="SendButton" class="btn_send"></p>
 
                                  </tr>
								   <tr>
            <td>
                  
                       
                                    <h1><img id="imgCaptcha" src="create_image.php" name="imgCaptcha"/> </h1>
                              </td>
                              <td>
      <input id="txtCaptcha" type="text" name="txtCaptcha" value="" maxlength="10" size="32" />
    </td>
                        
                              
      </tr>
 
                  </table>
				  
 
  </form>
 
HTML;
 
  
 
  echo "</body></html>" ;
 
 }
 
  
 
  if ($_POST)  
 
  {  
 
  if ( (!$_POST['firstName']) or (!$_POST['lastName']) or (!$_POST['country']) or (!$_POST['gender']) or (!$_POST['interest']) or (!$_POST['diagnosis']) or (!$_POST['email']) or (!$_POST['homephone']) )
 
  { 
 
 			printForm() ;
		
  }
 
  else 
 
  {
                   echo "5>1E>48<> 70?>;=8BL 2A5 ?>;O!!!" ;
 
 
		//session_start();
		if($_POST["txtCaptcha"] == $_SESSION["security_code"])
		{
			sendMail($_POST) ; 
			moveUploadedFile($_FILES,$_DirectoryToUploadInto) ;
			echo "Success";
		}
		else
		{
 			printForm() ;
		//echo "Not success";
		}
 
  }
 
  }
 
  else 
 
  {
 
                  printForm() ;
 
  }
 
  
 
  ?>
 
  
 
 
										  </td>
										</tr>
										
									</table>
								</td>
								<td width="170" style="padding-right:10px; padding-left:10px" class="menu_right_border" valign="top">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tr>
											<td class="menu_right">&nbsp;
												 
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
					
				<tr>
					<td height="25"></td>
				</tr>
				<tr>
					<td>
						<?php //require('includes/footer.htm'); ?>
					</td>
				</tr>
				<tr>
					<td height="15"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
 
<script type="text/javascript">
 
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
 
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
 
</script>
 
<script type="text/javascript">
 
try {
 
var pageTracker = _gat._getTracker("UA-7814761-1");
 
pageTracker._trackPageview();
 
} catch(err) {}</script>
 
</body>
 
</html>

Open in new window

0
 

Author Comment

by:DanSmir
ID: 24213080
Shobinsun,

Man, it still printing form without captcha code verification.

Sorry,.
0
 
LVL 14

Expert Comment

by:shobinsun
ID: 24213131
Hi,

its working fine with me dear...

Please check the session value and posted value.


I am posting the same code I am using here. in this code I am printing both values:

Thanks and Regards
<!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>
 <?php //require('includes/meta_tegs.htm'); ?> 
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<table cellpadding="0" cellspacing="0" width="950" align="center" class="tbl_main">
	<tr>
		<td>
			<?php //require('includes/menu_top.htm'); ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php //require('includes/menu.htm'); ?>
		</td>
	</tr>
	<tr>
		<td height="1"></td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" width="100%" class="top">
				<tr>
					<td class="top_txt" width="500" style="padding-left:20px; padding-bottom:20px" valign="bottom">
						<h1>>A;0BL 70?@>A </h1>
					</td>
					<td width="450"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" width="100%" class="main" style="padding-top:25px">
				<tr>
					<td>
						<table cellpadding="0" cellspacing="0" width="100%">
							<tr>
								<td width="160" style="padding-left:10px" class="menu_left_border" valign="top">
									<?php //require('includes/chat.htm'); ?>  
								</td>
								<td width="570" style="padding-right:10px; padding-left:15px" valign="top">
									<table cellpadding="0" cellspacing="0" width="100%" class="downloads">
										<tr>
										  <td style="padding-top:2px">
												<?php
												
												
 
 
  $_DirectoryToUploadInto = "./" ;
 
  $addressToSentTo = "dan@vario.co.il" ; 
 
  $addressToSentFrom = "submit-user@med-international.ru" ; 
 
  
 
  
 
function moveUploadedFile($_FILES,$_DirectoryToUploadInto)
 
  {
 
                global $_FILES ;
 
   $uploadfile = $_DirectoryToUploadInto . basename($_FILES['fileName']['name']);
 
  
 
  
 
                  if (move_uploaded_file($_FILES['fileName']['tmp_name'], $uploadfile)) 
 
                                  {
 
                                      echo "\n *\n";
 
                                  } 
 
                  else 
 
                                  {
 
                                      echo "\n0H5 ?8AL<> >B>A;0=> 157 ?@8:@5?;5==>3> D09;0. !?0A81>.!\n";
 
 
 
                                  }
 
        putFileOnFTP(basename($_FILES['fileName']['name']));
 
        
 
  }
 
  
 
function putFileOnFTP($fileName)
 
{
 
$ftp_server = "69.174.48.166" ; 
 
$ftp_user_name = "submit@med-international.ru" ; 
 
$ftp_user_pass = "123" ; 
 
 
 
$file = $fileName; 
 
$remote_file = $fileName; 
 
 
 
 
 
$conn_id = ftp_connect($ftp_server);
 
 
 
 
 
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
 
 
 
 
 
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
 
 echo "$file 03@C65= =0 A5@25@, !?081>\n";
 
 
 
} else {
 
 echo "$file\n";
 
}
 
 
 
ftp_close($conn_id);
 
}  
 
 
 
 function sendMail($postedData) 
 
  {
 
                  global $addressToSentTo, $addressToSentFrom, $_FILES;
 
                  
 
  $to      = $addressToSentTo ;
 
  $subject = "Submit form"; 
 
  
 
  if (!$_FILES['fileName']['name']) 
 
  {
 
                $sendedFile = "D09; =5 1K; 2KA;0=." ;
 
  }
 
  else
 
  {
 
                $sendedFile = "KA;0==K9 D09;: ".$_FILES['fileName']['name'] ;
 
  } 
 
  
 
  $message = "
 
{$postedData['firstName']} 
 
{$postedData['lastName']} 
 
{$postedData['gender']}
 
{$postedData['day']}/{$postedData['month']}/{$postedData['year']}
 
{$postedData['city']} 
 
{$postedData['zip']}
 
{$postedData['country']}
 
{$postedData['fileName']} 
 
{$postedData['homephone']}
 
{$postedData['workphone']}
 
{$postedData['interest']}
 
{$postedData['email']}
 
{$postedData['mobilephone']}
 
{$postedData['diagnosis']}
 
{$postedData['fileName']}
 
{$sendedFile} 
 
{$postedData['msg']} ";
 
  
 
  $headers = 'From: '.$addressToSentFrom."\n" .
 
                     'Reply-To:'.$addressToSentFrom ;
 
  
 
  mail($to, $subject, $message, $headers);
 
  }
 
  
 
  function printForm()
 
  {
 
	  echo <<<HTML
 
  <html>
 
  
 
  <head>
 
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 
  <link rel="stylesheet" type="text/css" href="mailer_style.css">
 
 
 
  <title>Post Form</title>
 
  <style>
 
.text:focus, textarea:focus {
 
  background-color: #FFFACC;
 
    }
 
  .message
 
{
 
    font-weight:bold;
 
    color:Red;
 
    font-size:large;
 
}
 
  
 
</style>
 
  </head>
 
  
 
  <body>
 
HTML;
 
echo <<<HTML
 
  <form enctype="multipart/form-data" action="captcha.php" method="POST">
 
  
 
                  <table border="0" width="500" class="table">
 
                                  <tr>
 
 
 
                                                                                                                                                                                                  <td width="200"><O<span class="must">*</span></td>
 
                                                                                                                                                                                                  
 
                                                  <td><input class="input_1" type="text" name="firstName" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">$0<8;8O<span class="must">*</span></td>
 
                                                  <td><input class="input_1" type="text" name="lastName" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>;<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="gender">
 
				<option></option>
 
				<option>C6G8=0</option>
 
                <option>5=I8=0</option>
 
                                                                  </select>
 
                                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">0B0 @>645=8O (5=L/5AOF/>4)</td>
 
                                                  <td>
 
                                                  <select size="1" class="input_1" name="day">
 
<option>1</option>
 
<option>2</option>
 
<option>3</option>
 
<option>4</option>
 
<option>5</option>
 
<option>6</option>
 
<option>7</option>
 
<option>8</option>
 
<option>9</option>
 
<option>10</option>
 
<option>11</option>
 
<option>12</option>
 
<option>13</option>
 
<option>14</option>
 
<option>15</option>
 
<option>16</option>
 
<option>17</option>
 
<option>18</option>
 
<option>19</option>
 
<option>20</option>
 
<option>21</option>
 
<option>22</option>
 
<option>23</option>
 
<option>24</option>
 
<option>25</option>
 
<option>26</option>
 
<option>27</option>
 
<option>28</option>
 
<option>29</option>
 
<option>30</option>
 
<option>31</option>
 
</select>
 
<select size="1" class="input_1"name="month">
 
<option>/=20@L</option>
 
<option>$52@0;L</option>
 
<option>0@B</option>
 
<option>?@5;L</option>
 
<option>09</option>
 
<option>N=L</option>
 
<option>N;L</option>
 
<option>23CAB</option>
 
<option>!5=BO1@L</option>
 
<option>:BO1@L</option>
 
<option>>O1@L</option>
 
<option>5:01@L</option>
 
</select>
 
<select size="1" class="input_1"name="year">
 
<option>	1930	</option>
 
<option>	1931	</option>
 
<option>	1932	</option>
 
<option>	1933	</option>
 
<option>	1934	</option>
 
<option>	1935	</option>
 
<option>	1936	</option>
 
<option>	1937	</option>
 
<option>	1938	</option>
 
<option>	1939	</option>
 
<option>	1940	</option>
 
<option>	1941	</option>
 
<option>	1942	</option>
 
<option>	1943	</option>
 
<option>	1944	</option>
 
<option>	1945	</option>
 
<option>	1946	</option>
 
<option>	1947	</option>
 
<option>	1948	</option>
 
<option>	1949	</option>
 
<option>	1950	</option>
 
<option>	1951	</option>
 
<option>	1952	</option>
 
<option>	1953	</option>
 
<option>	1954	</option>
 
<option>	1955	</option>
 
<option>	1956	</option>
 
<option>	1957	</option>
 
<option>	1958	</option>
 
<option>	1959	</option>
 
<option>	1960	</option>
 
<option>	1961	</option>
 
<option>	1962	</option>
 
<option>	1963	</option>
 
<option>	1964	</option>
 
<option>	1965	</option>
 
<option>	1966	</option>
 
<option>	1967	</option>
 
<option>	1968	</option>
 
<option>	1969	</option>
 
<option>	1970	</option>
 
<option>	1971	</option>
 
<option>	1972	</option>
 
<option>	1973	</option>
 
<option>	1974	</option>
 
<option>	1975	</option>
 
<option>	1976	</option>
 
<option>	1977	</option>
 
<option>	1978	</option>
 
<option>	1979	</option>
 
<option>	1980	</option>
 
<option>	1981	</option>
 
<option>	1982	</option>
 
<option>	1983	</option>
 
<option>	1984	</option>
 
<option>	1985	</option>
 
<option>	1986	</option>
 
<option>	1987	</option>
 
<option>	1988	</option>
 
<option>	1989	</option>
 
<option>	1990	</option>
 
<option>	1991	</option>
 
<option>	1992	</option>
 
<option>	1993	</option>
 
<option>	1994	</option>
 
<option>	1995	</option>
 
<option>	1996	</option>
 
<option>	1997	</option>
 
<option>	1998	</option>
 
<option>	1999	</option>
 
<option>	2000	</option>
 
<option>	2001	</option>
 
<option>	2002	</option>
 
<option>	2003	</option>
 
<option>	2004	</option>
 
<option>	2005	</option>
 
<option>	2006	</option>
 
<option>	2007	</option>
 
<option>	2008	</option>
 
<option>	2009	</option>
 
<option>	2010	</option>
 
<option>	2011	</option>
 
<option>	2012	</option>
 
<option>	2013	</option>
 
<option>	2014	</option>
 
<option>	2015	</option>
 
<option>	2016	</option>
 
<option>	2017	</option>
 
<option>	2018	</option>
 
<option>	2019	</option>
 
<option>	2020	</option>
 
<option>	2021	</option>
 
<option>	2022	</option>
 
<option>	2023	</option>
 
<option>	2024	</option>
 
<option>	2025	</option>
 
<option>	2026	</option>
 
<option>	2027	</option>
 
<option>	2028	</option>
 
<option>	2029	</option>
 
<option>	2030	</option>
 
 
 
</select>
 
                             </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>@>4</td>
 
                                                  <td><input class="input_1" type="text" name="city" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">>GB>2K9 8=45:A</td>
 
                                                  <td><input class="input_1" type="text" name="zip" size="20"></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">!B@0=0 ?@>6820=8O<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="country">
 
  <option></option>
 
  <option> >AA8O</option>
 
  <option>@<5=8O</option>
 
  <option>75@10;L460=</option>
 
  <option>5;0@CAL</option>
 
  <option>@C78O</option>
 
  <option>-AB>=8O</option>
 
  <option>070EAB0=</option>
 
  <option>0B28O</option>
 
  <option>8B20</option>
 
  <option>>;4028O</option>
 
  <option>#:@08=0</option>
 
  <option>#715:8AB0=</option>    
 
<option></option>
 
<option>	2AB@8O	</option>
<option>	;10=8O	</option>
<option>	=4>@@0	</option>
<option>	5;L38O	</option>
<option>	>;30@8O	</option>
<option>	>A=8O 8 5@F53>28=0	</option>
<option>	0B8:0=	</option>
<option>	5;8:>1@8B0=8O	</option>
<option>	5=3@8O	</option>
<option>	5@<0=8O	</option>
<option>	@5F8O	</option>
<option>	0=8O	</option>
<option>	@;0=48O	</option>
<option>	A;0=48O	</option>
<option>	A?0=8O	</option>
<option>	B0;8O	</option>
<option>	8?@	</option>
<option>	8EB5=HB59=	</option>
<option>	N:A5<1C@3	</option>
<option>	0:54>=8O	</option>
<option>	0;LB0	</option>
<option>	>=0:>	</option>
<option>	845@;0=4K	</option>
<option>	>@2538O	</option>
<option>	>;LH0	</option>
<option>	>@BC30;8O	</option>
<option>	 C<K=8O	</option>
<option>	!0=-0@8=>	</option>
<option>	!5@18O	</option>
<option>	!;>20:8O	</option>
<option>	!;>25=8O	</option>
<option>	"C@F8O	</option>
<option>	$8=;O=48O	</option>
<option>	$@0=F8O	</option>
<option>	%>@20B8O	</option>
<option>	'5@=>3>@8O	</option>
<option>	'5E8O	</option>
<option>	(259F0@8O	</option>
<option>	(25F8O	</option>
  
 
</select>
 
                                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200">><0H=89 B5;5D>=<span class="must">*</span></td>
 
                                   <td><input class="input_1"type="text" name="homephone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200"> 01>G89 B5;5D>=</td>
 
                                   <td><input class="input_1"type="text" name="workphone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                   <td width="200">>18;L=K9 B5;5D>=</td>
 
                                   <td><input class="input_1"type="text" name="mobilephone" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
								  <tr>
 
                                   <td width="200">E-mail<span class="must">*</span></td>
 
                                   <td><input class="input_1"type="text" name="email" size="20"></td>
 
                                  <td>
 
                                  </td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200">0H5 A>>1I5=85</td>
 
                                                  <td>
 
                                                                  <textarea rows="6" class="input_1" name="msg" cols="63"></textarea></td>
 
                                  </tr>
 
                                  <tr>
 
                                                  <td width="200"> G5< 2K 708=B5@5A>20=K?<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <select size="1" class="input_1" name="interest">
 
				<option></option>
 
				<option>>?>;=8B5;L=>5 <=5=85</option>
 
                <option>5G5=85</option>
 
                                                                  </select>
 
                                                                  </td>
 
                                                                  </tr>
 
                                                                  <tr>
 
                                                  <td width="200">0:>2 20H 4803=>7?<span class="must">*</span></td>
 
                                                  <td>
 
                                                                  <textarea rows="6" class="input_1" name="diagnosis" cols="63"></textarea></td>
 
                                  </tr>
 
                                  
 
                                  <tr>
 
                                                  <td width="313" valign="top" style="padding-top:6px">@8:@5?8BL D09;:</td>
 
                                                  <td>
 
                <input type="hidden" name="MAX_FILE_SIZE" value="10485761" />
 
                <input type="file"  name="fileName" size="20" class="input_1">
 
                  <p><input type="submit" value="B>A;0BL" name="SendButton" class="btn_send"></p>
 
                                  </tr>
								   <tr>
            <td>
                  
                       
                                    <h1><img id="imgCaptcha" src="create_image.php" name="imgCaptcha"/> </h1>
                              </td>
                              <td>
      <input id="txtCaptcha" type="text" name="txtCaptcha" value="" maxlength="10" size="32" />
    </td>
                        
                              
      </tr>
 
                  </table>
				  
 
  </form>
 
HTML;
 
  
 
  echo "</body></html>" ;
 
 }
 
  
 
  if ($_POST)  
 
  {  
 
  if ( (!$_POST['firstName']) or (!$_POST['lastName']) or (!$_POST['country']) or (!$_POST['gender']) or (!$_POST['interest']) or (!$_POST['diagnosis']) or (!$_POST['email']) or (!$_POST['homephone']) )
 
  { 
 
 			printForm() ;
		
  }
 
  else 
 
  {
                   echo "5>1E>48<> 70?>;=8BL 2A5 ?>;O!!!" ;
 
 
		session_start();
		echo "captcha:", $_POST["txtCaptcha"];
		echo "<br>code:", $_SESSION["security_code"];
		if($_POST["txtCaptcha"] == $_SESSION["security_code"])
		{
			//echo "Success";
			sendMail($_POST) ; 
			moveUploadedFile($_FILES,$_DirectoryToUploadInto) ;
			echo "Success";
		}
		else
		{
 			printForm() ;
		//echo "Not success";
		}
 
  }
 
  }
 
  else 
 
  {
 
                  printForm() ;
 
  }
 
  
 
  ?>
 
  
 
 
										  </td>
										</tr>
										
									</table>
								</td>
								<td width="170" style="padding-right:10px; padding-left:10px" class="menu_right_border" valign="top">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tr>
											<td class="menu_right">&nbsp;
												 
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
					
				<tr>
					<td height="25"></td>
				</tr>
				<tr>
					<td>
						<?php //require('includes/footer.htm'); ?>
					</td>
				</tr>
				<tr>
					<td height="15"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
 
<script type="text/javascript">
 
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
 
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
 
</script>
 
<script type="text/javascript">
 
try {
 
var pageTracker = _gat._getTracker("UA-7814761-1");
 
pageTracker._trackPageview();
 
} catch(err) {}</script>
 
</body>
 
</html>

Open in new window

0
 

Author Comment

by:DanSmir
ID: 24213191
Shobinsub:

5>1E>48<> 70?>;=8BL 2A5 ?>;O!!!
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/imsg/public_html/captcha.php:5) in /home/imsg/public_html/captcha.php on line 898
captcha:8a1d6
code:8a1d6 0H5 ?8AL<> >B>A;0=> 157 ?@8:@5?;5==>3> D09;0. !?0A81>.!
Warning: ftp_put() [function.ftp-put]: Filename cannot be empty in /home/imsg/public_html/captcha.php on line 136
Success
?????
0
 

Author Comment

by:DanSmir
ID: 24213246
Shobinsun...
1. I want to thank you for you patience and help.
It seems that form partially working but with errors.

I want to ask you about this error...
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/imsg/public_html/captcha.php:5) in /home/imsg/public_html/captcha.php on line 898
captcha:79858
I just can't eliminate that.

10x,
Dan
0
 
LVL 14

Assisted Solution

by:shobinsun
shobinsun earned 2000 total points
ID: 24213249
HI,

ok..So you get the result 90%.

Then

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/imsg/public_html/captcha.php:5) in /home/imsg/public_html/captcha.php on line 898

is because of you have already started a session. So we can avoid session_start().

Warning: ftp_put() [function.ftp-put]: Filename cannot be empty in /home/imsg/public_html/captcha.php on line 136

means the filename is empty.


0
 
LVL 14

Assisted Solution

by:shobinsun
shobinsun earned 2000 total points
ID: 24213308
Hi,

If you are using cookie-based sessions, you must call session_start() before anything is outputted to the browser

Use the :

session_start();

in the top most line in the page.

hope this will help you.

Please look at this too:

http://www.dmcinsights.com/phorum/read.php?9,20109,20126


Regards


0
 

Author Comment

by:DanSmir
ID: 24213326
Shobinsun:

What line should i put session_start(); in my code?

10x
0
 
LVL 14

Accepted Solution

by:
shobinsun earned 2000 total points
ID: 24213374
Hi,

use this :

<?php
session_start();
?>

on top of the file. Means this should be the starting in that page.

Hope this will work . Its working here. and comment the line currently using.

Thanks and Regards.

0
 

Author Comment

by:DanSmir
ID: 24213404
Shobinsun:

when i'm changing place of session start i receiving immediately this error in the top of page:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/imsg/public_html/captcha.php:5) in /home/imsg/public_html/captcha.php on line 54
0
 

Author Comment

by:DanSmir
ID: 24213459
Shobinsun:

I know that i'm looks as a stupid one.
Problem is that i'm .Net programmer, and this PHP task is something that i promised to one of my friends, and found my self in black hole...Thought it will be easy.

Now with your help i see a light at the end of that tunnel....
Need to solve session issue and say you HUGE THANKS!!!

Thank you again...

0
 

Author Closing Comment

by:DanSmir
ID: 31573222
I want to thank SHOBINSUN for his patience and help to me.
He is excellent professional.

MANY MANY MANY 10x!!!!!!
0
 
LVL 14

Expert Comment

by:shobinsun
ID: 24213506
Hi

For more about php sessions go through the links:

http://in2.php.net/session_start

Thanks and Regards
0
 

Author Comment

by:DanSmir
ID: 24213565
Shobinsun:
By the way,
Can you tell me how to allow empty filenames in ftp?

Warning: ftp_put() [function.ftp-put]: Filename cannot be empty in /home/imsg/public_html/captcha.php on line 136
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month18 days, 22 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question