Page 2 of 2

Posted: Thu Jun 21, 2007 6:11 pm
by nita
i had altered some code .. so this is latest version of the scrip i worked out, no changes in results,
still, once submit button pressed php is moving to search else if part of the code (as if i press submit button on search form)

go to http://www.nita-on-line.com/movies.php
and test recomendation form, and see what is happenig your self ... please

i test it without any other if else stament and its ok ....
go to http://www.nita-on-line.com/test.php

I have no qlue why, i suspect some mistake in if else structre of the application, i need some suggestions ....

thank you a lot in advance

nita

Code: Select all

if(isset($_GET['cat'])) // when looking at selected category of movies
{

// display by chosen category

}

// so when i press submit button on my recomendation form php is 
// moving to this else if .. why?

else if(isset($_POST['search'])||isset($_GET['search'])) // when search button is pressed
{

// some code (display results when search button pressed)
// code for search form below ...
<form method='post' action='movies.php'>
	<input class='input1' type='text' name='search' size=15 maxlength=50>
	<input class='button1' type='submit' name='submit' value='Search'
	</form>


}

else  //when looking at the root of the aplication

{

// some code

if (isset($_POST['submitreco']))

{
	
   	$myemail = "kris@nita-on-line.com";
	$name = $_POST['name'];
	$email = $_POST['email'];
	$message = $_POST['message'];
	$messagehtml = str_replace("\r", '<br/>', $message);
	$thanks = "
	<p align='left' class='info2'><span class='info2'>
	Thank you !. Your recomendation has sucessfuly been sent!<br>
	<br></span></p>";
	$subject = "New Movie Recomendation from $Name";
	$messagetoemail = "Hi Kris. You recived a new movie recomendation.
	Name: $name
	E-mail: $email
	Recomendation: $messagehtml
	";
	$yourcode=$_POST['yourcode'];
   $thevalue1=$_POST['thevalue1'];
   
   if($yourcode==$thevalue1)
   {
 	echo "$thanks";

   }
   else
   {
      echo "You verification code is not right. Please go back and try again.";
   }
}

else

{
$PHP_SELF = $_SERVER['PHP_SELF'];
//this is recomandation form
echo "
<table width='100%'  border='0' cellspacing='0' cellpadding='10'>
  <tr>
    <td>

<form action='$PHP_SELF' method='post'>
  <table width='444' align='left' class='info4'>
    <tr>
      <td valign='top' align='right'><b>Name:</b></td>
      <td valign='top'>
        <input name='name' size='30'>
      </td>
    </tr>
    <tr>
      <td valign='top' align='right'><b>E-mail:</b></td>
      <td valign='top'>
        <input name='email' size='30'>
      </td>
    </tr>
    <tr>
      <td valign='top' align='right'><b>Recomendation:</b></td>
      <td valign='top'>
        <textarea name='message' rows='10' cols='30'></textarea>
      </td>
    </tr>
    <tr>
<td>";
$im = ImageCreate(60, 20);  //create image
$white = ImageColorAllocate($im, 0,0, 0);
$black = ImageColorAllocate($im, 120, 200, 68);
$md5 = md5(microtime() * mktime()); 
$string = substr($md5,0,5);
$verification = $string;
$thevalue= $string;
ImageFill($im, 0, 0, $black);
ImageString($im, 4, 10, 3, $verification, $white);
Imagejpeg($im, "inc/verify.jpeg");
ImageDestroy($im);
echo "
<img src='inc/verify.jpeg' border='0'>
<input type='hidden' value='$thevalue' name='thevalue1'>
</td>
	<td>
	<input type='text' name='yourcode' size='5' maxlength='5'>
	</td>
	</tr>
	<td valign='top' align='right'></td>
      <td valign='top' align='left'>
        <input class='button1' type='submit' value='Send' name='submitreco'>
        <input class='button1' type='reset' value='Reset' name='reset'>
      </td>
	
    </tr>
  </table>
</form>
</td>
  </tr>
</table><br>";
}
}    


Posted: Thu Jun 21, 2007 6:14 pm
by feyd
microtime() * mktime()? That just seems odd considering microtime() returns a string.

Posted: Thu Jun 21, 2007 6:34 pm
by nita
captcha it is a next step to develop, it is a very basic one, but good enough, to keep testing entire aplication,
and to develop some decent and secure posting form, and at the time i have no problem with it,
my concern is the action that php is taking when submit button pressed on recomendation form ...

and will by happy if you can give me some sugestion for strong captcha to ..
thanks a lot


nita

Posted: Fri Jun 22, 2007 4:50 am
by Styx
Your <input> tag for the search button is not closed. Try closing it.

Also, for captcha, you can try out this one if you like (example)