gos1
Mar 9th 2006, 7:37 am
there is a problem at my script. can you please check. It works fine for the first time but when I try to post data again. It always gives the
you cannot make two requests at that time
output. I echoed all the variables to see the problem $_SESSION['tarih'] variable is always equals to the $tarih variable. But I want it to be equal to the $tarih varible which is sent in a previous run.
-------------------------------------------
<?php
session_start();
?>
<html>
<head>
<title>Process Status</title>
</head>
<body bgcolor="#007297" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<table width="800" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" valign="top" rowspan="2"><img src="images/logo.gif" width="340" height="61"></td>
<td width="344" height="46"></td>
<td width="54"></td>
<td width="62"></td>
</tr>
<tr>
<td height="17"></td>
<td></td>
<td valign="top"><font color="#FFFFFF"><b><font face="Times New Roman, Times, serif" size="2"><a href="index.php">|
Home | </a></font></b></font></td>
</tr>
<tr>
<td colspan="5" height="19" valign="top"><img src="images/ayr.gif" width="800" height="19"></td>
</tr>
<tr>
<td height="141" width="127"></td>
<td colspan="2" valign="middle" align="center">
<?
$connect = mysql_connect ("localhost", "root", "molekuler");
mysql_select_db( "oncead" , $connect ) or die ("DB error!!!".mysql_error());
$em = $_POST["_email"];
$wi = $_POST["_width"];
$he = $_POST["_height"];
if ( !empty($em) && !empty($wi) && !empty($he))
{
$paym = ($wi * $he);
if ($paym >= 100)
{
$tarih = time();
$tarih1 = time() + 10;
$ip = $_SERVER['REMOTE_ADDR'];
if (!empty($_SESSION['tarih']) && $_SESSION['tarih'] < $tarih1)
{
echo "you cannot make two requests at that time";
echo "<BR>";
echo $_SESSION['tarih'];
echo "<BR>";
echo $_SESSION['ip'];
echo "<BR>";
echo $tarih1;
}
else
{
session_register("tarih");
session_register("ip");
mysql_query("INSERT INTO _requests ( email , width , height , req , tarih ) VALUES ('".$_POST["_email"]."', '".$_POST["_width"]."', '".$_POST["_height"]."', '".$_POST["_request"]."', '$tarih' )" ) or die (mysql_error());
echo "Thank you for your request" ;
}
}
else
{
echo "Please click back button and fill the form completely..." ;
}
}
else
{
echo "width * height must be at least 100";
}
?>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td height="70"></td>
<td width="213"></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>
---------------------------------
I am trying to do the same thing (time control to the form script.) For the first time I run this script it worked correctly then always gived the
-----------------------------------
you cannot make two requests at that time
-----------------------------------
output. After that just wanted to try it and I echoed all the variables. The $_SESSION['tarih'] variable is always equals to
------------------
$tarih1 - 10
-------------------
I did not find out where I do the mistake. Why the script is always setting the session variable to tarih at the beginning. ??????
you cannot make two requests at that time
output. I echoed all the variables to see the problem $_SESSION['tarih'] variable is always equals to the $tarih variable. But I want it to be equal to the $tarih varible which is sent in a previous run.
-------------------------------------------
<?php
session_start();
?>
<html>
<head>
<title>Process Status</title>
</head>
<body bgcolor="#007297" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<table width="800" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" valign="top" rowspan="2"><img src="images/logo.gif" width="340" height="61"></td>
<td width="344" height="46"></td>
<td width="54"></td>
<td width="62"></td>
</tr>
<tr>
<td height="17"></td>
<td></td>
<td valign="top"><font color="#FFFFFF"><b><font face="Times New Roman, Times, serif" size="2"><a href="index.php">|
Home | </a></font></b></font></td>
</tr>
<tr>
<td colspan="5" height="19" valign="top"><img src="images/ayr.gif" width="800" height="19"></td>
</tr>
<tr>
<td height="141" width="127"></td>
<td colspan="2" valign="middle" align="center">
<?
$connect = mysql_connect ("localhost", "root", "molekuler");
mysql_select_db( "oncead" , $connect ) or die ("DB error!!!".mysql_error());
$em = $_POST["_email"];
$wi = $_POST["_width"];
$he = $_POST["_height"];
if ( !empty($em) && !empty($wi) && !empty($he))
{
$paym = ($wi * $he);
if ($paym >= 100)
{
$tarih = time();
$tarih1 = time() + 10;
$ip = $_SERVER['REMOTE_ADDR'];
if (!empty($_SESSION['tarih']) && $_SESSION['tarih'] < $tarih1)
{
echo "you cannot make two requests at that time";
echo "<BR>";
echo $_SESSION['tarih'];
echo "<BR>";
echo $_SESSION['ip'];
echo "<BR>";
echo $tarih1;
}
else
{
session_register("tarih");
session_register("ip");
mysql_query("INSERT INTO _requests ( email , width , height , req , tarih ) VALUES ('".$_POST["_email"]."', '".$_POST["_width"]."', '".$_POST["_height"]."', '".$_POST["_request"]."', '$tarih' )" ) or die (mysql_error());
echo "Thank you for your request" ;
}
}
else
{
echo "Please click back button and fill the form completely..." ;
}
}
else
{
echo "width * height must be at least 100";
}
?>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td height="70"></td>
<td width="213"></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>
---------------------------------
I am trying to do the same thing (time control to the form script.) For the first time I run this script it worked correctly then always gived the
-----------------------------------
you cannot make two requests at that time
-----------------------------------
output. After that just wanted to try it and I echoed all the variables. The $_SESSION['tarih'] variable is always equals to
------------------
$tarih1 - 10
-------------------
I did not find out where I do the mistake. Why the script is always setting the session variable to tarih at the beginning. ??????